mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-23 22:16:16 +01:00
Fix signedness warning in gio/gbufferedoutputstream.c:g_buffered_output_stream_set_buffer_size()
gio/gbufferedoutputstream.c: In function ‘g_buffered_output_stream_set_buffer_size’: glib/gmacros.h:806:26: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘goffset’ {aka ‘long int’} 806 | #define MAX(a, b) (((a) > (b)) ? (a) : (b)) | ^ gio/gbufferedoutputstream.c:211:14: note: in expansion of macro ‘MAX’ 211 | size = MAX (size, priv->pos); | ^~~ Fix signedness warning in gio/gbufferedinputstream.c:g_buffered_input_stream_real_fill() gio/gbufferedinputstream.c: In function ‘g_buffered_input_stream_real_fill’: glib/gmacros.h:809:26: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’}K [-Werror=sign-compare] 809 | #define MIN(a, b) (((a) < (b)) ? (a) : (b)) | ^ gio/gbufferedinputstream.c:664:11: note: in expansion of macro ‘MIN’ 664 | count = MIN (count, priv->len - in_buffer); | ^~~ gio/gbufferedinputstream.c:667:29: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘gssize’ {aka ‘long int’} 667 | if (priv->len - priv->end < count) | ^ Fix signedness warnings in gio/gbufferedinputstream.c:g_buffered_input_stream_real_fill_async() gio/gbufferedinputstream.c: In function ‘g_buffered_input_stream_real_fill_async’: glib/gmacros.h:809:26: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’} 809 | #define MIN(a, b) (((a) < (b)) ? (a) : (b)) | ^ gio/gbufferedinputstream.c:1075:11: note: in expansion of macro ‘MIN’ 1075 | count = MIN (count, priv->len - in_buffer); | ^~~ gio/gbufferedinputstream.c:1078:29: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘gssize’ {aka ‘long int’} 1078 | if (priv->len - priv->end < count) | ^
This commit is contained in:
parent
50c85523a2
commit
477d53b2b0
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user