[librsvg] rsvg_load_new(): Take the unlimited_size argument again



commit af6845e45e2a59ebaf0b450aec8482e287472c84
Author: Federico Mena Quintero <federico gnome org>
Date:   Mon Dec 10 14:53:29 2018 -0600

    rsvg_load_new(): Take the unlimited_size argument again
    
    This removes references to the handle from all of rsvg-load.c, except
    for rsvg_load_new() itself.

 librsvg/rsvg-handle.c | 3 ++-
 librsvg/rsvg-load.c   | 9 ++++-----
 librsvg/rsvg-load.h   | 2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/librsvg/rsvg-handle.c b/librsvg/rsvg-handle.c
index 70c9ca39..166708f3 100644
--- a/librsvg/rsvg-handle.c
+++ b/librsvg/rsvg-handle.c
@@ -683,7 +683,8 @@ rsvg_handle_write (RsvgHandle *handle, const guchar *buf, gsize count, GError **
 
     if (priv->hstate == RSVG_HANDLE_STATE_START) {
         priv->hstate = RSVG_HANDLE_STATE_LOADING;
-        priv->load = rsvg_load_new (handle);
+        priv->load = rsvg_load_new (handle,
+                                    (priv->flags && RSVG_HANDLE_FLAG_UNLIMITED) != 0);
     }
 
     g_assert (priv->hstate == RSVG_HANDLE_STATE_LOADING);
diff --git a/librsvg/rsvg-load.c b/librsvg/rsvg-load.c
index b32f8c9c..2d65c5ed 100644
--- a/librsvg/rsvg-load.c
+++ b/librsvg/rsvg-load.c
@@ -37,7 +37,7 @@ typedef enum {
 
 /* Holds the GIO and loading state for compressed data */
 struct RsvgLoad {
-    RsvgHandle *handle;
+    gboolean unlimited_size;
 
     LoadState state;
     GByteArray *buffer;
@@ -46,11 +46,11 @@ struct RsvgLoad {
 };
 
 RsvgLoad *
-rsvg_load_new (RsvgHandle *handle)
+rsvg_load_new (RsvgHandle *handle, gboolean unlimited_size)
 {
     RsvgLoad *load = g_new0 (RsvgLoad, 1);
 
-    load->handle = handle;
+    load->unlimited_size = unlimited_size;
     load->state = LOAD_STATE_START;
     load->buffer = NULL;
 
@@ -132,7 +132,6 @@ rsvg_load_close (RsvgLoad *load, GError **error)
     case LOAD_STATE_READING: {
         GInputStream *stream;
         GBytes *bytes;
-        gboolean unlimited_size = (rsvg_handle_get_flags (load->handle) && RSVG_HANDLE_FLAG_UNLIMITED) != 0; 
       
 
         bytes = g_byte_array_free_to_bytes (load->buffer);
         load->buffer = NULL;
@@ -141,7 +140,7 @@ rsvg_load_close (RsvgLoad *load, GError **error)
         g_bytes_unref (bytes);
         
         res = rsvg_xml_state_load_from_possibly_compressed_stream (load->rust_state,
-                                                                   unlimited_size,
+                                                                   load->unlimited_size,
                                                                    stream,
                                                                    NULL,
                                                                    error);
diff --git a/librsvg/rsvg-load.h b/librsvg/rsvg-load.h
index d9253da9..6777ab40 100644
--- a/librsvg/rsvg-load.h
+++ b/librsvg/rsvg-load.h
@@ -26,7 +26,7 @@
 #include "rsvg-private.h"
 
 G_GNUC_INTERNAL
-RsvgLoad *rsvg_load_new (RsvgHandle *handle) G_GNUC_WARN_UNUSED_RESULT;
+RsvgLoad *rsvg_load_new (RsvgHandle *handle, gboolean unlimited_size) G_GNUC_WARN_UNUSED_RESULT;
 
 G_GNUC_INTERNAL
 RsvgXmlState *rsvg_load_free (RsvgLoad *load) G_GNUC_WARN_UNUSED_RESULT;


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