[librsvg] rsvg-load.c: Extract the unlimited_size flag from the handle
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] rsvg-load.c: Extract the unlimited_size flag from the handle
- Date: Mon, 10 Dec 2018 20:54:18 +0000 (UTC)
commit 283466b1c3dbf7b759131828feddffed92ec6fe3
Author: Federico Mena Quintero <federico gnome org>
Date: Mon Dec 10 12:54:57 2018 -0600
rsvg-load.c: Extract the unlimited_size flag from the handle
We don't need it as an argument to rsvg_load_new()
librsvg/rsvg-handle.c | 4 ++--
librsvg/rsvg-load.c | 12 +++++++-----
librsvg/rsvg-load.h | 2 +-
3 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/librsvg/rsvg-handle.c b/librsvg/rsvg-handle.c
index 5b077785..e0a72449 100644
--- a/librsvg/rsvg-handle.c
+++ b/librsvg/rsvg-handle.c
@@ -673,7 +673,7 @@ 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->flags & RSVG_HANDLE_FLAG_UNLIMITED) != 0);
+ priv->load = rsvg_load_new (handle);
}
g_assert (priv->hstate == RSVG_HANDLE_STATE_LOADING);
@@ -798,7 +798,7 @@ rsvg_handle_read_stream_sync (RsvgHandle *handle,
saved_load = priv->load;
- priv->load = rsvg_load_new (handle, (priv->flags & RSVG_HANDLE_FLAG_UNLIMITED) != 0);
+ priv->load = rsvg_load_new (handle);
read_successfully = rsvg_load_read_stream_sync (priv->load, stream, cancellable, error);
result = finish_load (handle, read_successfully, error);
diff --git a/librsvg/rsvg-load.c b/librsvg/rsvg-load.c
index d8089b1a..591df255 100644
--- a/librsvg/rsvg-load.c
+++ b/librsvg/rsvg-load.c
@@ -74,7 +74,6 @@ typedef struct {
/* Holds the GIO and loading state for compressed data */
struct RsvgLoad {
RsvgHandle *handle;
- gboolean unlimited_size;
LoadState state;
@@ -84,12 +83,11 @@ struct RsvgLoad {
};
RsvgLoad *
-rsvg_load_new (RsvgHandle *handle, gboolean unlimited_size)
+rsvg_load_new (RsvgHandle *handle)
{
RsvgLoad *load = g_new0 (RsvgLoad, 1);
load->handle = handle;
- load->unlimited_size = unlimited_size;
load->state = LOAD_STATE_START;
load->compressed_input_stream = NULL;
@@ -172,8 +170,10 @@ write_impl (RsvgLoad *load, const guchar * buf, gsize count, GError **error)
int result;
if (load->xml.ctxt == NULL) {
+ gboolean unlimited_size = (rsvg_handle_get_flags (load->handle) && RSVG_HANDLE_FLAG_UNLIMITED) != 0;
+
load->xml.ctxt = rsvg_create_xml_push_parser (load->xml.rust_state,
- load->unlimited_size,
+ unlimited_size,
rsvg_handle_get_base_uri (load->handle),
&real_error);
}
@@ -232,11 +232,13 @@ rsvg_load_read_stream_sync (RsvgLoad *load,
GError **error)
{
gboolean res = FALSE;
+ gboolean unlimited_size = (rsvg_handle_get_flags (load->handle) && RSVG_HANDLE_FLAG_UNLIMITED) != 0;
+
g_assert (load->xml.ctxt == NULL);
res = rsvg_xml_state_load_from_possibly_compressed_stream (load->xml.rust_state,
- load->unlimited_size,
+ unlimited_size,
stream,
cancellable,
error);
diff --git a/librsvg/rsvg-load.h b/librsvg/rsvg-load.h
index 1a38c9bc..8f29d7a0 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, gboolean unlimited_size) G_GNUC_WARN_UNUSED_RESULT;
+RsvgLoad *rsvg_load_new (RsvgHandle *handle) G_GNUC_WARN_UNUSED_RESULT;
G_GNUC_INTERNAL
void rsvg_load_free (RsvgLoad *load);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]