[librsvg: 1/6] rsvg_acquire_gvfs_stream(): Remove the out_mime_type argument after all



commit a72df75fefadb67111dc6b6ea383ee629d832075
Author: Federico Mena Quintero <federico gnome org>
Date:   Fri Nov 23 16:58:03 2018 -0600

    rsvg_acquire_gvfs_stream(): Remove the out_mime_type argument after all
    
    None of the callers (or callers of callers...) actually need it.

 librsvg/rsvg-handle.c  |  2 --
 librsvg/rsvg-io.c      | 34 ++++++++++------------------------
 librsvg/rsvg-io.h      |  1 -
 librsvg/rsvg-load.c    |  5 +----
 librsvg/rsvg-private.h |  1 -
 5 files changed, 11 insertions(+), 32 deletions(-)
---
diff --git a/librsvg/rsvg-handle.c b/librsvg/rsvg-handle.c
index 13bb0aad..a3bc1bf0 100644
--- a/librsvg/rsvg-handle.c
+++ b/librsvg/rsvg-handle.c
@@ -1691,7 +1691,6 @@ _rsvg_handle_acquire_data (RsvgHandle *handle,
 GInputStream *
 _rsvg_handle_acquire_stream (RsvgHandle *handle,
                              const char *href,
-                             char **content_type,
                              GError **error)
 {
     RsvgHandlePrivate *priv = handle->priv;
@@ -1702,7 +1701,6 @@ _rsvg_handle_acquire_stream (RsvgHandle *handle,
 
     if (allow_load (priv->base_gfile, uri, error)) {
         stream = _rsvg_io_acquire_stream (uri,
-                                          content_type,
                                           handle->priv->cancellable,
                                           error);
     } else {
diff --git a/librsvg/rsvg-io.c b/librsvg/rsvg-io.c
index 4566ef78..e87b37d1 100644
--- a/librsvg/rsvg-io.c
+++ b/librsvg/rsvg-io.c
@@ -37,7 +37,6 @@ rsvg_decode_data_uri (const char *uri,
 
 static GInputStream *
 rsvg_acquire_gvfs_stream (const char *uri, 
-                          char **out_mime_type,
                           GCancellable *cancellable,
                           GError **error)
 {
@@ -53,24 +52,6 @@ rsvg_acquire_gvfs_stream (const char *uri,
         return NULL;
     }
 
-    if (out_mime_type) {
-        GFileInfo *file_info;
-        const char *content_type;
-
-        file_info = g_file_input_stream_query_info (stream, 
-                                                    G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
-                                                    cancellable,
-                                                    NULL /* error */);
-        if (file_info &&
-            (content_type = g_file_info_get_content_type (file_info)))
-            *out_mime_type = g_content_type_get_mime_type (content_type);
-        else
-            *out_mime_type = NULL;
-
-        if (file_info)
-            g_object_unref (file_info);
-    }
-
     return G_INPUT_STREAM (stream);
 }
 
@@ -131,22 +112,27 @@ _rsvg_io_acquire_data (const char *uri,
 
 GInputStream *
 _rsvg_io_acquire_stream (const char *uri,
-                         char **mime_type,
                          GCancellable *cancellable,
                          GError **error)
 {
     GInputStream *stream;
-    char *data;
-    gsize len;
 
     if (strncmp (uri, "data:", 5) == 0) {
-        if (!(data = rsvg_decode_data_uri (uri, mime_type, &len, error)))
+        char *mime_type = NULL;
+        char *data;
+        gsize len;
+
+        data = rsvg_decode_data_uri (uri, &mime_type, &len, error);
+        g_free (mime_type);
+
+        if (!data) {
             return NULL;
+        }
 
         return g_memory_input_stream_new_from_data (data, len, (GDestroyNotify) g_free);
     }
 
-    if ((stream = rsvg_acquire_gvfs_stream (uri, mime_type, cancellable, error)))
+    if ((stream = rsvg_acquire_gvfs_stream (uri, cancellable, error)))
       return stream;
 
     return NULL;
diff --git a/librsvg/rsvg-io.h b/librsvg/rsvg-io.h
index 831dd582..1d38a74d 100644
--- a/librsvg/rsvg-io.h
+++ b/librsvg/rsvg-io.h
@@ -33,7 +33,6 @@ char *_rsvg_io_acquire_data (const char *uri,
                             GError **error);
 
 GInputStream *_rsvg_io_acquire_stream (const char *uri,
-                                       char **mime_type,
                                        GCancellable *cancellable,
                                        GError **error);
 
diff --git a/librsvg/rsvg-load.c b/librsvg/rsvg-load.c
index 45183d94..eeaa2130 100644
--- a/librsvg/rsvg-load.c
+++ b/librsvg/rsvg-load.c
@@ -273,13 +273,10 @@ rsvg_load_handle_xml_xinclude (RsvgHandle *handle, const char *href)
     GInputStream *stream;
     GError *err = NULL;
     xmlParserCtxtPtr xml_parser;
-    gchar *mime_type;
 
     g_assert (handle->priv->load != NULL);
 
-    stream = _rsvg_handle_acquire_stream (handle, href, &mime_type, NULL);
-
-    g_free (mime_type);
+    stream = _rsvg_handle_acquire_stream (handle, href, NULL);
 
     if (stream) {
         gboolean success = FALSE;
diff --git a/librsvg/rsvg-private.h b/librsvg/rsvg-private.h
index e0465f21..f8ff9186 100644
--- a/librsvg/rsvg-private.h
+++ b/librsvg/rsvg-private.h
@@ -272,7 +272,6 @@ char *_rsvg_handle_acquire_data (RsvgHandle *handle,
 G_GNUC_INTERNAL
 GInputStream *_rsvg_handle_acquire_stream (RsvgHandle *handle,
                                            const char *href,
-                                           char **content_type,
                                            GError **error);
 
 #define rsvg_return_if_fail(expr, error)    G_STMT_START{                      \


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