From d4312f7cac4f6947719cda047645024a34c8795e Mon Sep 17 00:00:00 2001 From: Thomas Holder Date: Thu, 13 Dec 2018 21:43:49 +0100 Subject: extract_uri: fix, test, document --- src/object/sp-item.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/object/sp-item.cpp') 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(); } -- cgit v1.2.3