[glib: 1/10] Fixing signedness warning in sindent():gtester.c



commit 9402940919cb275cd06b289c63abf0bae3f3cd0c
Author: Emmanuel Fleury <emmanuel fleury u-bordeaux fr>
Date:   Sat Jan 26 12:12:59 2019 +0100

    Fixing signedness warning in sindent():gtester.c
    
    ../glib.git/glib/gtester.c: In function ‘sindent’:
    ../glib.git/glib/gmacros.h:351:26: error: comparison of integer expressions of different signedness: 
‘guint’ {aka ‘unsigned int’} and ‘int’ [-Werror=sign-compare]
     #define MIN(a, b)  (((a) < (b)) ? (a) : (b))
                              ^
    ../glib.git/glib/gtester.c:73:7: note: in expansion of macro ‘MIN’
       n = MIN (n, l);
           ^~~
    ../glib.git/glib/gmacros.h:351:41: error: operand of ?: changes signedness from ‘int’ to ‘guint’ {aka 
‘unsigned int’} due to unsignedness of other operand [-Werror=sign-compare]
     #define MIN(a, b)  (((a) < (b)) ? (a) : (b))
                                             ^~~
    ../glib.git/glib/gtester.c:73:7: note: in expansion of macro ‘MIN’
       n = MIN (n, l);
           ^~~

 glib/gtester.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/glib/gtester.c b/glib/gtester.c
index c54221a4d..fb79fbb0d 100644
--- a/glib/gtester.c
+++ b/glib/gtester.c
@@ -69,7 +69,7 @@ static const char*
 sindent (guint n)
 {
   static const char spaces[] = "                                                                             
                       ";
-  int l = sizeof (spaces) - 1;
+  gsize l = sizeof (spaces) - 1;
   n = MIN (n, l);
   return spaces + l - n;
 }


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