[glib: 1/2] glib-compile-resources: Fix size allocation for compressed streams



commit 0985e70488cede2e856381fd2185d8aaf305b72d
Author: vmlobanov78 <vmlobanov78 gmail com>
Date:   Tue Sep 18 10:34:23 2018 +0000

    glib-compile-resources: Fix size allocation for compressed streams
    
    The length of the stolen data from a memory output stream is given by
    get_data_size() — get_size() can be larger, and hence cause unnecessary
    overallocation.

 gio/glib-compile-resources.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/gio/glib-compile-resources.c b/gio/glib-compile-resources.c
index 6ce5aec4a..7e318b254 100644
--- a/gio/glib-compile-resources.c
+++ b/gio/glib-compile-resources.c
@@ -483,7 +483,7 @@ end_element (GMarkupParseContext  *context,
            }
 
          g_free (data->content);
-         data->content_size = g_memory_output_stream_get_size (G_MEMORY_OUTPUT_STREAM (out));
+         data->content_size = g_memory_output_stream_get_data_size (G_MEMORY_OUTPUT_STREAM (out));
          data->content = g_memory_output_stream_steal_data (G_MEMORY_OUTPUT_STREAM (out));
 
          g_object_unref (compressor);


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