diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2016-03-14 16:37:50 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2016-03-14 16:37:50 +0000 |
| commit | b8d22beef5345210ad27cdc2685083aeae6f8f3b (patch) | |
| tree | d69b8bfd19d3627a8425a1b265c2abf229b05354 /src/resource-manager.cpp | |
| parent | fixes for update to trunk (diff) | |
| parent | "Relative to" option for node alignment. (diff) | |
| download | inkscape-b8d22beef5345210ad27cdc2685083aeae6f8f3b.tar.gz inkscape-b8d22beef5345210ad27cdc2685083aeae6f8f3b.zip | |
update to trunk
(bzr r13708.1.39)
Diffstat (limited to 'src/resource-manager.cpp')
| -rw-r--r-- | src/resource-manager.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/resource-manager.cpp b/src/resource-manager.cpp index fe53eca4f..18d7c6ba2 100644 --- a/src/resource-manager.cpp +++ b/src/resource-manager.cpp @@ -179,9 +179,9 @@ std::vector<Glib::ustring> ResourceManagerImpl::findBrokenLinks( SPDocument *doc std::set<Glib::ustring> uniques; if ( doc ) { - GSList const *images = doc->getResourceList("image"); - for (GSList const *it = images; it; it = it->next) { - Inkscape::XML::Node *ir = static_cast<SPObject *>(it->data)->getRepr(); + std::set<SPObject *> images = doc->getResourceList("image"); + for (std::set<SPObject *>::const_iterator it = images.begin(); it != images.end(); ++it) { + Inkscape::XML::Node *ir = (*it)->getRepr(); gchar const *href = ir->attribute("xlink:href"); if ( href && ( uniques.find(href) == uniques.end() ) ) { @@ -222,11 +222,15 @@ std::map<Glib::ustring, Glib::ustring> ResourceManagerImpl::locateLinks(Glib::us Glib::ustring uri = (*it)->get_uri(); std::string scheme = Glib::uri_parse_scheme(uri); if ( scheme == "file" ) { - std::string path = Glib::filename_from_uri(uri); - path = Glib::path_get_dirname(path); - if ( std::find(priorLocations.begin(), priorLocations.end(), path) == priorLocations.end() ) { - // TODO debug g_message(" ==>[%s]", path.c_str()); - priorLocations.push_back(path); + try { + std::string path = Glib::filename_from_uri(uri); + path = Glib::path_get_dirname(path); + if ( std::find(priorLocations.begin(), priorLocations.end(), path) == priorLocations.end() ) { + // TODO debug g_message(" ==>[%s]", path.c_str()); + priorLocations.push_back(path); + } + } catch (Glib::ConvertError e) { + g_warning("Bad URL ignored [%s]", uri.c_str()); } } } @@ -301,10 +305,10 @@ bool ResourceManagerImpl::fixupBrokenLinks(SPDocument *doc) bool savedUndoState = DocumentUndo::getUndoSensitive(doc); DocumentUndo::setUndoSensitive(doc, true); - - GSList const *images = doc->getResourceList("image"); - for (GSList const *it = images; it; it = it->next) { - Inkscape::XML::Node *ir = static_cast<SPObject *>(it->data)->getRepr(); + + std::set<SPObject *> images = doc->getResourceList("image"); + for (std::set<SPObject *>::const_iterator it = images.begin(); it != images.end(); ++it) { + Inkscape::XML::Node *ir = (*it)->getRepr(); gchar const *href = ir->attribute("xlink:href"); if ( href ) { |
