Getting colder with our second freeze... it's 3.31.91 release day and string freeze, upload a tarball and lock those strings 🏂

Create the compressed_input_stream in a separate function

parent d0e169e9
......@@ -1862,6 +1862,24 @@ rsvg_handle_set_size_callback (RsvgHandle * handle,
#define GZ_MAGIC_0 ((guchar) 0x1f)
#define GZ_MAGIC_1 ((guchar) 0x8b)
/* Creates handle->priv->compressed_input_stream and adds the gzip header data
* to it. We implicitly consume the header data from the caller in
* rsvg_handle_write(); that's why we add it back here.
*/
static void
create_compressed_input_stream (RsvgHandle *handle)
{
RsvgHandlePrivate *priv = handle->priv;
static const guchar gz_magic[2] = { GZ_MAGIC_0, GZ_MAGIC_1 };
g_assert (priv->compressed_input_stream == NULL);
priv->compressed_input_stream = g_memory_input_stream_new ();
g_memory_input_stream_add_data (G_MEMORY_INPUT_STREAM (priv->compressed_input_stream),
gz_magic, 2, NULL);
}
/**
* rsvg_handle_write:
* @handle: an #RsvgHandle
......@@ -1907,13 +1925,8 @@ rsvg_handle_write (RsvgHandle * handle, const guchar * buf, gsize count, GError
case RSVG_HANDLE_STATE_EXPECTING_GZ_1:
if (buf[0] == GZ_MAGIC_1) {
static const guchar gz_magic[2] = { GZ_MAGIC_0, GZ_MAGIC_1 };
priv->compressed_input_stream = g_memory_input_stream_new ();
g_memory_input_stream_add_data (G_MEMORY_INPUT_STREAM (priv->compressed_input_stream),
gz_magic, 2, NULL);
priv->state = RSVG_HANDLE_STATE_READING;
create_compressed_input_stream (handle);
buf++;
count--;
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment