[glib/glib-2-24] Use correct offset for buffer data in GConverterOutputStream



commit 1f0694e51b8c8ed894cf2d7b690c666dc03bb145
Author: Jürg Billeter <j bitron ch>
Date:   Fri May 28 11:00:37 2010 +0200

    Use correct offset for buffer data in GConverterOutputStream
    
    Otherwise we overwrite already converted data in the case that more
    than one call to g_converter_convert is necessary in write() or
    flush().
    
    https://bugzilla.gnome.org/show_bug.cgi?id=619945
    (cherry picked from commit 6858ab20330ec31322dacbbdfaf66838fdcbfb78)

 gio/gconverteroutputstream.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gio/gconverteroutputstream.c b/gio/gconverteroutputstream.c
index 7ad8d5e..f59733d 100644
--- a/gio/gconverteroutputstream.c
+++ b/gio/gconverteroutputstream.c
@@ -427,7 +427,7 @@ g_converter_output_stream_write (GOutputStream *stream,
       res = g_converter_convert (priv->converter,
 				 to_convert + converted_bytes,
 				 to_convert_size - converted_bytes,
-				 buffer_data (&priv->converted_buffer),
+				 buffer_data (&priv->converted_buffer) + buffer_available (&priv->converted_buffer),
 				 buffer_tailspace (&priv->converted_buffer),
 				 0,
 				 &bytes_read,
@@ -542,7 +542,7 @@ g_converter_output_stream_flush (GOutputStream  *stream,
       res = g_converter_convert (priv->converter,
 				 buffer_data (&priv->output_buffer),
 				 buffer_available (&priv->output_buffer),
-				 buffer_data (&priv->converted_buffer),
+				 buffer_data (&priv->converted_buffer) + buffer_available (&priv->converted_buffer),
 				 buffer_tailspace (&priv->converted_buffer),
 				 is_closing ? G_CONVERTER_INPUT_AT_END : G_CONVERTER_FLUSH,
 				 &bytes_read,



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