[glib] GConverterInputStream: fix an infinite loop when fill_buffer returns an error
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] GConverterInputStream: fix an infinite loop when fill_buffer returns an error
- Date: Tue, 17 Apr 2012 16:33:25 +0000 (UTC)
commit adea9fb25210f2d04bcf2453c18847fb965927f7
Author: Dan Winship <danw gnome org>
Date: Tue Apr 17 11:46:50 2012 -0400
GConverterInputStream: fix an infinite loop when fill_buffer returns an error
The loop was using a GConverterResult variable where it meant to use a
gssize, and since GConverterResult was ending up as an unsigned type,
this meant the (res < 0) check always failed.
gio/gconverterinputstream.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/gio/gconverterinputstream.c b/gio/gconverterinputstream.c
index d81cd90..2fbf94d 100644
--- a/gio/gconverterinputstream.c
+++ b/gio/gconverterinputstream.c
@@ -495,18 +495,18 @@ g_converter_input_stream_read (GInputStream *stream,
{
/* Need more data */
my_error2 = NULL;
- res = fill_input_buffer (cstream,
- buffer_data_size (&priv->input_buffer) + 4096,
- cancellable,
- &my_error2);
- if (res < 0)
+ nread = fill_input_buffer (cstream,
+ buffer_data_size (&priv->input_buffer) + 4096,
+ cancellable,
+ &my_error2);
+ if (nread < 0)
{
/* Can't read any more data, return that error */
g_error_free (my_error);
g_propagate_error (error, my_error2);
return -1;
}
- else if (res == 0)
+ else if (nread == 0)
{
/* End of file, try INPUT_AT_END */
priv->at_input_end = TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]