summaryrefslogtreecommitdiffstats
path: root/src/object/color-profile.cpp
diff options
context:
space:
mode:
authorThomas Holder <thomas@thomas-holder.de>2018-12-09 14:56:40 +0000
committerThomas Holder <thomas@thomas-holder.de>2018-12-09 20:50:04 +0000
commit34d2e296a45845f9241cedeafff7b23e06d8f5cf (patch)
treedea6c03ac9504dfbeebbd3671c5dd632671efcca /src/object/color-profile.cpp
parentFix license in new files (diff)
downloadinkscape-34d2e296a45845f9241cedeafff7b23e06d8f5cf.tar.gz
inkscape-34d2e296a45845f9241cedeafff7b23e06d8f5cf.zip
remove Inkscape::URI::getFullPath
Diffstat (limited to 'src/object/color-profile.cpp')
-rw-r--r--src/object/color-profile.cpp25
1 files changed, 9 insertions, 16 deletions
diff --git a/src/object/color-profile.cpp b/src/object/color-profile.cpp
index 8e4e8978b..9cfac23cf 100644
--- a/src/object/color-profile.cpp
+++ b/src/object/color-profile.cpp
@@ -352,33 +352,26 @@ void ColorProfile::set(SPAttributeEnum key, gchar const *value) {
//# 1. Get complete URI of document
gchar const *docbase = doc->getURI();
- gchar* escaped = g_uri_escape_string(this->href, "!*'();@=+$,/?#", TRUE);
-
- //g_message("docbase:%s\n", docbase);
- //org::w3c::dom::URI docUri(docbase);
Inkscape::URI docUri("");
if (docbase) { // The file has already been saved
docUri = Inkscape::URI::from_native_filename(docbase);
}
- //# 2. Get href of icc file. we don't care if it's rel or abs
- //org::w3c::dom::URI hrefUri(escaped);
- Inkscape::URI hrefUri(escaped);
- //# 3. Resolve the href according the docBase. This follows
- // the w3c specs. All absolute and relative issues are considered
- std::string fullpath = hrefUri.getFullPath(docUri.getFullPath(""));
-
- gchar* fullname = g_uri_unescape_string(fullpath.c_str(), "");
this->impl->_clearProfile();
- this->impl->_profHandle = cmsOpenProfileFromFile( fullname, "r" );
+
+ try {
+ auto hrefUri = Inkscape::URI(this->href, docUri);
+ auto contents = hrefUri.getContents();
+ this->impl->_profHandle = cmsOpenProfileFromMem(contents.data(), contents.size());
+ } catch (...) {
+ g_warning("Failed to open CMS profile URI '%.100s'", this->href);
+ }
+
if ( this->impl->_profHandle ) {
this->impl->_profileSpace = cmsGetColorSpace( this->impl->_profHandle );
this->impl->_profileClass = cmsGetDeviceClass( this->impl->_profHandle );
}
DEBUG_MESSAGE( lcmsOne, "cmsOpenProfileFromFile( '%s'...) = %p", fullname, (void*)this->impl->_profHandle );
- g_free(escaped);
- escaped = nullptr;
- g_free(fullname);
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
}
}