[librsvg: 5/18] rsvg-io.c: Use rsvg_acquire_gvfs_stream() for all cases



commit b0e81036dadc85e830d0b664ea3d0d8f99635740
Author: Federico Mena Quintero <federico gnome org>
Date:   Thu Nov 22 19:34:20 2018 -0600

    rsvg-io.c: Use rsvg_acquire_gvfs_stream() for all cases
    
    This obviates the need for the old rsvg_acquire_file_data(), which did
    the same work, but with g_file_get_contents() instead of the stream APIs.

 librsvg/rsvg-io.c | 48 ------------------------------------------------
 1 file changed, 48 deletions(-)
---
diff --git a/librsvg/rsvg-io.c b/librsvg/rsvg-io.c
index 965be423..576fe08a 100644
--- a/librsvg/rsvg-io.c
+++ b/librsvg/rsvg-io.c
@@ -35,48 +35,6 @@ rsvg_decode_data_uri (const char *uri,
                       gsize *out_len,
                       GError **error);
 
-static char *
-rsvg_acquire_file_data (const char *uri,
-                        char **out_mime_type,
-                        gsize *out_len,
-                        GCancellable *cancellable,
-                        GError **error)
-{
-    GFile *file;
-    gchar *path, *data;
-    gsize len;
-    char *content_type;
-
-    rsvg_return_val_if_fail (uri != NULL, NULL, error);
-    g_assert (out_len != NULL);
-
-    file = g_file_new_for_uri (uri);
-    path = g_file_get_path (file);
-
-    if (path == NULL) {
-        g_object_unref (file);
-        return NULL;
-    }
-
-    if (!g_file_get_contents (path, &data, &len, error)) {
-        g_free (path);
-        g_object_unref (file);
-        return NULL;
-    }
-
-    if (out_mime_type &&
-        (content_type = g_content_type_guess (path, (guchar *) data, len, NULL))) {
-        *out_mime_type = g_content_type_get_mime_type (content_type);
-        g_free (content_type);
-    }
-
-    g_free (path);
-    g_object_unref (file);
-
-    *out_len = len;
-    return data;
-}
-
 static GInputStream *
 rsvg_acquire_gvfs_stream (const char *uri, 
                           const char *base_uri, 
@@ -203,9 +161,6 @@ _rsvg_io_acquire_data (const char *href,
     if (strncmp (href, "data:", 5) == 0)
       return rsvg_decode_data_uri (href, mime_type, len, error);
 
-    if ((data = rsvg_acquire_file_data (href, mime_type, len, cancellable, NULL)))
-      return data;
-
     if ((data = rsvg_acquire_gvfs_data (href, base_uri, mime_type, len, cancellable, error)))
       return data;
 
@@ -236,9 +191,6 @@ _rsvg_io_acquire_stream (const char *href,
         return g_memory_input_stream_new_from_data (data, len, (GDestroyNotify) g_free);
     }
 
-    if ((data = rsvg_acquire_file_data (href, mime_type, &len, cancellable, NULL)))
-      return g_memory_input_stream_new_from_data (data, len, (GDestroyNotify) g_free);
-
     if ((stream = rsvg_acquire_gvfs_stream (href, base_uri, mime_type, cancellable, error)))
       return stream;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]