diff options
| author | Thomas Holder <thomas@thomas-holder.de> | 2018-11-05 22:37:54 +0000 |
|---|---|---|
| committer | Thomas Holder <thomas@thomas-holder.de> | 2018-11-05 22:37:54 +0000 |
| commit | 8fe8df064850bdaf5cd0c6015430c4b12132c8ab (patch) | |
| tree | 2ef547a667ff1f1a3ba8fc66dc8350b5ae3c4089 /src/object | |
| parent | Replacement for xmlBuildRelativeURI (diff) | |
| download | inkscape-8fe8df064850bdaf5cd0c6015430c4b12132c8ab.tar.gz inkscape-8fe8df064850bdaf5cd0c6015430c4b12132c8ab.zip | |
remove Inkscape::URI::toString
Diffstat (limited to 'src/object')
| -rw-r--r-- | src/object/box3d.cpp | 5 | ||||
| -rw-r--r-- | src/object/sp-conn-end-pair.cpp | 5 | ||||
| -rw-r--r-- | src/object/sp-filter.cpp | 5 | ||||
| -rw-r--r-- | src/object/sp-gradient.cpp | 5 | ||||
| -rw-r--r-- | src/object/sp-item.cpp | 14 | ||||
| -rw-r--r-- | src/object/sp-tag-use.cpp | 5 | ||||
| -rw-r--r-- | src/object/sp-tref.cpp | 4 | ||||
| -rw-r--r-- | src/object/sp-use.cpp | 5 | ||||
| -rw-r--r-- | src/object/uri-references.cpp | 4 | ||||
| -rw-r--r-- | src/object/uri.h | 11 |
10 files changed, 19 insertions, 44 deletions
diff --git a/src/object/box3d.cpp b/src/object/box3d.cpp index 98dfddbb4..94920e419 100644 --- a/src/object/box3d.cpp +++ b/src/object/box3d.cpp @@ -217,9 +217,8 @@ Inkscape::XML::Node* SPBox3D::write(Inkscape::XML::Document *xml_doc, Inkscape:: /* box is not yet linked to a perspective; use the document's current perspective */ SPDocument *doc = object->document; if (box->persp_ref->getURI()) { - gchar *uri_string = box->persp_ref->getURI()->toString(); - repr->setAttribute("inkscape:perspectiveID", uri_string); - g_free(uri_string); + auto uri_string = box->persp_ref->getURI()->str(); + repr->setAttribute("inkscape:perspectiveID", uri_string.c_str()); } else { Glib::ustring href = "#"; href += doc->getCurrentPersp3D()->getId(); diff --git a/src/object/sp-conn-end-pair.cpp b/src/object/sp-conn-end-pair.cpp index f05b211da..160d48aca 100644 --- a/src/object/sp-conn-end-pair.cpp +++ b/src/object/sp-conn-end-pair.cpp @@ -143,9 +143,8 @@ void SPConnEndPair::writeRepr(Inkscape::XML::Node *const repr) const for (unsigned handle_ix = 0; handle_ix < 2; ++handle_ix) { const Inkscape::URI* U = this->_connEnd[handle_ix]->ref.getURI(); if (U) { - gchar *str = U->toString(); - repr->setAttribute(attr_strs[handle_ix], str); - g_free(str); + auto str = U->str(); + repr->setAttribute(attr_strs[handle_ix], str.c_str()); } } repr->setAttribute("inkscape:connector-curvature", Glib::Ascii::dtostr(_connCurvature).c_str()); diff --git a/src/object/sp-filter.cpp b/src/object/sp-filter.cpp index ef61e4fdb..4c012fbdf 100644 --- a/src/object/sp-filter.cpp +++ b/src/object/sp-filter.cpp @@ -316,9 +316,8 @@ Inkscape::XML::Node* SPFilter::write(Inkscape::XML::Document *doc, Inkscape::XML } if (this->href->getURI()) { - gchar *uri_string = this->href->getURI()->toString(); - repr->setAttribute("xlink:href", uri_string); - g_free(uri_string); + auto uri_string = this->href->getURI()->str(); + repr->setAttribute("xlink:href", uri_string.c_str()); } SPObject::write(doc, repr, flags); diff --git a/src/object/sp-gradient.cpp b/src/object/sp-gradient.cpp index c8e7f92b0..9aee288be 100644 --- a/src/object/sp-gradient.cpp +++ b/src/object/sp-gradient.cpp @@ -629,9 +629,8 @@ Inkscape::XML::Node *SPGradient::write(Inkscape::XML::Document *xml_doc, Inkscap } if (this->ref->getURI()) { - gchar *uri_string = this->ref->getURI()->toString(); - repr->setAttribute("xlink:href", uri_string); - g_free(uri_string); + auto uri_string = this->ref->getURI()->str(); + repr->setAttribute("xlink:href", uri_string.c_str()); } if ((flags & SP_OBJECT_WRITE_ALL) || this->units_set) { diff --git a/src/object/sp-item.cpp b/src/object/sp-item.cpp index 3a641eca2..bc5922b3f 100644 --- a/src/object/sp-item.cpp +++ b/src/object/sp-item.cpp @@ -749,20 +749,14 @@ Inkscape::XML::Node* SPItem::write(Inkscape::XML::Document *xml_doc, Inkscape::X if (item->clip_ref){ if (item->clip_ref->getObject()) { - gchar *uri = item->clip_ref->getURI()->toString(); - const gchar *value = g_strdup_printf ("url(%s)", uri); - repr->setAttribute ("clip-path", value); - g_free ((void *) value); - g_free ((void *) uri); + auto value = item->clip_ref->getURI()->cssStr(); + repr->setAttribute("clip-path", value.c_str()); } } if (item->mask_ref){ if (item->mask_ref->getObject()) { - gchar *uri = item->mask_ref->getURI()->toString(); - const gchar *value = g_strdup_printf ("url(%s)", uri); - repr->setAttribute ("mask", value); - g_free ((void *) value); - g_free ((void *) uri); + auto value = item->clip_ref->getURI()->cssStr(); + repr->setAttribute("mask", value.c_str()); } } if (item->_highlightColor){ diff --git a/src/object/sp-tag-use.cpp b/src/object/sp-tag-use.cpp index e1dae8167..c9180c693 100644 --- a/src/object/sp-tag-use.cpp +++ b/src/object/sp-tag-use.cpp @@ -128,9 +128,8 @@ SPTagUse::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, gui SPObject::write(xml_doc, repr, flags); if (ref->getURI()) { - gchar *uri_string = ref->getURI()->toString(); - repr->setAttribute("xlink:href", uri_string); - g_free(uri_string); + auto uri_string = ref->getURI()->str(); + repr->setAttribute("xlink:href", uri_string.c_str()); } return repr; diff --git a/src/object/sp-tref.cpp b/src/object/sp-tref.cpp index c3db8780f..ef5b6c106 100644 --- a/src/object/sp-tref.cpp +++ b/src/object/sp-tref.cpp @@ -173,10 +173,10 @@ Inkscape::XML::Node* SPTRef::write(Inkscape::XML::Document *xml_doc, Inkscape::X this->attributes.writeTo(repr); if (this->uriOriginalRef->getURI()) { - gchar *uri_string = this->uriOriginalRef->getURI()->toString(); + auto uri = this->uriOriginalRef->getURI()->str(); + auto uri_string = uri.c_str(); debug("uri_string=%s", uri_string); repr->setAttribute("xlink:href", uri_string); - g_free(uri_string); } SPItem::write(xml_doc, repr, flags); diff --git a/src/object/sp-use.cpp b/src/object/sp-use.cpp index 876c822e6..941bb6274 100644 --- a/src/object/sp-use.cpp +++ b/src/object/sp-use.cpp @@ -172,9 +172,8 @@ Inkscape::XML::Node* SPUse::write(Inkscape::XML::Document *xml_doc, Inkscape::XM repr->setAttribute("height", sp_svg_length_write_with_units(this->height).c_str()); if (this->ref->getURI()) { - gchar *uri_string = this->ref->getURI()->toString(); - repr->setAttribute("xlink:href", uri_string); - g_free(uri_string); + auto uri_string = this->ref->getURI()->str(); + repr->setAttribute("xlink:href", uri_string.c_str()); } SPShape *shape = dynamic_cast<SPShape *>(child); diff --git a/src/object/uri-references.cpp b/src/object/uri-references.cpp index b4af31278..24bef48aa 100644 --- a/src/object/uri-references.cpp +++ b/src/object/uri-references.cpp @@ -120,7 +120,7 @@ void URIReference::attach(const URI &uri) // createChildDoc() assumes that the referenced file is an SVG. // PNG and JPG files are allowed (in the case of feImage). - gchar *filename = uri.toString(); + gchar const *filename = uri.getPath() ? uri.getPath() : ""; bool skip = false; if (g_str_has_suffix(filename, ".jpg") || g_str_has_suffix(filename, ".JPG") || g_str_has_suffix(filename, ".png") || g_str_has_suffix(filename, ".PNG")) { @@ -139,10 +139,8 @@ void URIReference::attach(const URI &uri) } if (!document) { g_warning("Can't get document for referenced URI: %s", filename); - g_free(filename); return; } - g_free(filename); gchar const *fragment = uri.getFragment(); if (!uri.isRelative() || uri.getQuery() || !fragment) { diff --git a/src/object/uri.h b/src/object/uri.h index 8cfccfed0..9944d2219 100644 --- a/src/object/uri.h +++ b/src/object/uri.h @@ -137,17 +137,6 @@ public: std::string toNativeFilename() const; /** - * Returns a glib string version of this URI. - * - * The returned string must be freed with \c g_free(). - * - * @return a glib string version of this URI. - * - * @todo remove this method and use str() instead - */ - char *toString() const { return _impl->toString(); } - - /** * Return the string representation of this URI * * @param baseuri Return a relative path if this URI shares protocol and host with @a baseuri |
