diff --git a/gio/gbufferedinputstream.c b/gio/gbufferedinputstream.c index f5090d064..b0e609c0d 100644 --- a/gio/gbufferedinputstream.c +++ b/gio/gbufferedinputstream.c @@ -661,10 +661,10 @@ g_buffered_input_stream_real_fill (GBufferedInputStream *stream, in_buffer = priv->end - priv->pos; /* Never fill more than can fit in the buffer */ - count = MIN (count, priv->len - in_buffer); + count = MIN ((gsize) count, priv->len - in_buffer); /* If requested length does not fit at end, compact */ - if (priv->len - priv->end < count) + if (priv->len - priv->end < (gsize) count) compact_buffer (stream); base_stream = G_FILTER_INPUT_STREAM (stream)->base_stream; @@ -1072,10 +1072,10 @@ g_buffered_input_stream_real_fill_async (GBufferedInputStream *stream, in_buffer = priv->end - priv->pos; /* Never fill more than can fit in the buffer */ - count = MIN (count, priv->len - in_buffer); + count = MIN ((gsize) count, priv->len - in_buffer); /* If requested length does not fit at end, compact */ - if (priv->len - priv->end < count) + if (priv->len - priv->end < (gsize) count) compact_buffer (stream); task = g_task_new (stream, cancellable, callback, user_data); diff --git a/gio/gbufferedoutputstream.c b/gio/gbufferedoutputstream.c index 98bda501d..969bbae0b 100644 --- a/gio/gbufferedoutputstream.c +++ b/gio/gbufferedoutputstream.c @@ -208,7 +208,7 @@ g_buffered_output_stream_set_buffer_size (GBufferedOutputStream *stream, if (priv->buffer) { - size = MAX (size, priv->pos); + size = (priv->pos > 0) ? MAX (size, (gsize) priv->pos) : size; buffer = g_malloc (size); memcpy (buffer, priv->buffer, priv->pos);