Fixing signedness warning in glib/tests/mainloop.c

glib/tests/mainloop.c: In function ‘write_bytes’:
glib/gmacros.h:809:26: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘long unsigned int’
  809 | #define MIN(a, b)  (((a) < (b)) ? (a) : (b))
      |                          ^
glib/tests/mainloop.c:1146:11: note: in expansion of macro ‘MIN’
 1146 |   limit = MIN (*to_write, sizeof zeros);
      |           ^~~
This commit is contained in:
Emmanuel Fleury 2020-11-08 22:37:53 +01:00
parent 8045b77c32
commit 5444b7e74d

View File

@ -1143,7 +1143,7 @@ write_bytes (gint fd,
/* Detect if we run before we should */
g_assert_cmpint (*to_write, >=, 0);
limit = MIN (*to_write, sizeof zeros);
limit = MIN ((gsize) *to_write, sizeof zeros);
*to_write -= write (fd, zeros, limit);
return TRUE;