[glib: 13/15] Fixing signedness warning in glib/tests/mainloop.c




commit 5444b7e74d3574a0ef800318a50148532bffea48
Author: Emmanuel Fleury <emmanuel fleury gmail com>
Date:   Sun Nov 8 22:37:53 2020 +0100

    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);
          |           ^~~

 glib/tests/mainloop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/glib/tests/mainloop.c b/glib/tests/mainloop.c
index efc896ccf..5cdb2a467 100644
--- a/glib/tests/mainloop.c
+++ b/glib/tests/mainloop.c
@@ -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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]