[gimp] app: add buffering to reading data files



commit d71ed885924fc04299e9fa804f3e207a3ed97970
Author: Michael Natterer <mitch gimp org>
Date:   Wed Feb 21 22:11:25 2018 +0100

    app: add buffering to reading data files
    
    gimp_data_factory_load_data(): use a GBufferedInputStream so we don't
    end up reading files byte-by-byte in the worst case.

 app/core/gimpdatafactory.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/app/core/gimpdatafactory.c b/app/core/gimpdatafactory.c
index eb5036f..f1becc6 100644
--- a/app/core/gimpdatafactory.c
+++ b/app/core/gimpdatafactory.c
@@ -894,7 +894,9 @@ gimp_data_factory_load_data (GimpDataFactory *factory,
 
   if (input)
     {
-      data_list = loader->load_func (context, file, input, &error);
+      GInputStream *buffered = g_buffered_input_stream_new (input);
+
+      data_list = loader->load_func (context, file, buffered, &error);
 
       if (error)
         {
@@ -909,6 +911,7 @@ gimp_data_factory_load_data (GimpDataFactory *factory,
                        gimp_file_get_utf8_name (file));
         }
 
+      g_object_unref (buffered);
       g_object_unref (input);
     }
   else


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