[glib] Ensure we always have some target space in GConverterOutputStream
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Ensure we always have some target space in GConverterOutputStream
- Date: Fri, 11 Jun 2010 08:01:43 +0000 (UTC)
commit 86592d675ff8f1bf0f647fe926ea6085e7b1f2bc
Author: Jürg Billeter <j bitron ch>
Date: Thu May 27 16:55:53 2010 +0200
Ensure we always have some target space in GConverterOutputStream
When the converter fills the whole buffer without reading all input,
we need to enlarge the buffer. Otherwise we get an assertion failure
for `outbuf_size > 0' in g_converter_convert.
https://bugzilla.gnome.org/show_bug.cgi?id=619945
gio/gconverteroutputstream.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/gio/gconverteroutputstream.c b/gio/gconverteroutputstream.c
index d1e1b6f..7ad8d5e 100644
--- a/gio/gconverteroutputstream.c
+++ b/gio/gconverteroutputstream.c
@@ -418,6 +418,10 @@ g_converter_output_stream_write (GOutputStream *stream,
converted_bytes = 0;
while (!priv->finished && converted_bytes < to_convert_size)
{
+ /* Ensure we have *some* target space */
+ if (buffer_tailspace (&priv->converted_buffer) == 0)
+ grow_buffer (&priv->converted_buffer);
+
/* Try to convert to our buffer */
my_error = NULL;
res = g_converter_convert (priv->converter,
@@ -529,6 +533,10 @@ g_converter_output_stream_flush (GOutputStream *stream,
flushed = FALSE;
while (!priv->finished && !flushed)
{
+ /* Ensure we have *some* target space */
+ if (buffer_tailspace (&priv->converted_buffer) == 0)
+ grow_buffer (&priv->converted_buffer);
+
/* Try to convert to our buffer */
my_error = NULL;
res = g_converter_convert (priv->converter,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]