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
This commit is contained in:
Jürg Billeter 2010-05-28 11:00:37 +02:00 committed by Alexander Larsson
parent 86592d675f
commit 6858ab2033

View File

@ -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,