Code

Corrected image mask generation
[inkscape.git] / src / extension / internal / svg.cpp
index ab9c59830f99df36bf2cf958884af4ec25c25e5d..33cbfe1506229bb25de0384d4a33c56aa33d7843 100644 (file)
@@ -102,7 +102,7 @@ Svg::init(void)
 #ifdef WITH_GNOME_VFS
 #define BUF_SIZE 8192
 
-gchar *
+static gchar *
 _load_uri (const gchar *uri)
 {
     GnomeVFSHandle   *handle = NULL;
@@ -120,7 +120,7 @@ _load_uri (const gchar *uri)
     GnomeVFSResult result = gnome_vfs_open (&handle, uri_local, GNOME_VFS_OPEN_READ);
 
     if (result != GNOME_VFS_OK) {
-        g_warning(gnome_vfs_result_to_string(result));
+        g_warning("%s", gnome_vfs_result_to_string(result));
     }
 
     std::vector<gchar> doc;
@@ -148,7 +148,7 @@ SPDocument *
 Svg::open (Inkscape::Extension::Input *mod, const gchar *uri)
 {
 #ifdef WITH_GNOME_VFS
-    if (gnome_vfs_uri_is_local(gnome_vfs_uri_new(uri))) {
+    if (!gnome_vfs_initialized() || gnome_vfs_uri_is_local(gnome_vfs_uri_new(uri))) {
         // Use built-in loader instead of VFS for this
         return sp_document_new(uri, TRUE);
     }
@@ -208,13 +208,13 @@ Svg::save (Inkscape::Extension::Output *mod, SPDocument *doc, const gchar *uri)
         repr = sp_document_repr_root (doc);
     } else {
         rdoc = sp_repr_document_new ("svg:svg");
-        repr = sp_repr_document_root (rdoc);
+        repr = rdoc->root();
         repr = sp_document_root (doc)->updateRepr(repr, SP_OBJECT_WRITE_BUILD);
     }
 
     Inkscape::IO::fixupHrefs( doc, save_path, spns );
 
-    gboolean const s = sp_repr_save_file (sp_repr_document (repr), uri, SP_SVG_NS_URI);
+    gboolean const s = sp_repr_save_file (repr->document(), uri, SP_SVG_NS_URI);
     if (s == FALSE) {
         throw Inkscape::Extension::Output::save_failed();
     }