summaryrefslogtreecommitdiffstats
path: root/src/object/sp-item.cpp
diff options
context:
space:
mode:
authorThomas Holder <thomas@thomas-holder.de>2018-12-13 20:43:49 +0000
committerThomas Holder <thomas@thomas-holder.de>2018-12-13 20:43:49 +0000
commitd4312f7cac4f6947719cda047645024a34c8795e (patch)
tree180cea4ed59fbca47eb3740f8b8a940e18a97e25 /src/object/sp-item.cpp
parentremove most of Inkscape::URI::Impl (diff)
downloadinkscape-d4312f7cac4f6947719cda047645024a34c8795e.tar.gz
inkscape-d4312f7cac4f6947719cda047645024a34c8795e.zip
extract_uri: fix, test, document
Diffstat (limited to 'src/object/sp-item.cpp')
-rw-r--r--src/object/sp-item.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/object/sp-item.cpp b/src/object/sp-item.cpp
index d6d1bdf56..edf216481 100644
--- a/src/object/sp-item.cpp
+++ b/src/object/sp-item.cpp
@@ -441,15 +441,14 @@ void SPItem::set(SPAttributeEnum key, gchar const* value) {
break;
}
case SP_PROP_CLIP_PATH: {
- gchar *uri = extract_uri(value);
- if (uri) {
+ auto uri = extract_uri(value);
+ if (!uri.empty()) {
try {
- item->clip_ref->attach(Inkscape::URI(uri));
+ item->clip_ref->attach(Inkscape::URI(uri.c_str()));
} catch (Inkscape::BadURIException &e) {
g_warning("%s", e.what());
item->clip_ref->detach();
}
- g_free(uri);
} else {
item->clip_ref->detach();
}
@@ -457,15 +456,14 @@ void SPItem::set(SPAttributeEnum key, gchar const* value) {
break;
}
case SP_PROP_MASK: {
- gchar *uri = extract_uri(value);
- if (uri) {
+ auto uri = extract_uri(value);
+ if (!uri.empty()) {
try {
- item->mask_ref->attach(Inkscape::URI(uri));
+ item->mask_ref->attach(Inkscape::URI(uri.c_str()));
} catch (Inkscape::BadURIException &e) {
g_warning("%s", e.what());
item->mask_ref->detach();
}
- g_free(uri);
} else {
item->mask_ref->detach();
}