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);
       ^~~
This commit is contained in:
Emmanuel Fleury 2019-01-26 12:12:59 +01:00
parent 140b82083f
commit 9402940919

View File

@ -69,7 +69,7 @@ static const char*
sindent (guint n) sindent (guint n)
{ {
static const char spaces[] = " "; static const char spaces[] = " ";
int l = sizeof (spaces) - 1; gsize l = sizeof (spaces) - 1;
n = MIN (n, l); n = MIN (n, l);
return spaces + l - n; return spaces + l - n;
} }