• Emmanuel Fleury's avatar
    Fixing various warnings in glib/gstring.c · 165a922a
    Emmanuel Fleury authored
    In file included from glib/glibconfig.h:9,
                     from glib/gtypes.h:32,
                     from glib/gstring.h:32,
                     from glib/gstring.c:37:
    glib/gstring.c: In function ‘g_string_insert_len’:
    glib/gstring.c:441:31: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
         g_return_val_if_fail (pos <= string->len, string);
                                   ^~
    glib/gmacros.h:455:25: note: in definition of macro ‘G_LIKELY’
     #define G_LIKELY(expr) (expr)
                             ^~~~
    glib/gstring.c:441:5: note: in expansion of macro ‘g_return_val_if_fail’
         g_return_val_if_fail (pos <= string->len, string);
         ^~~~~~~~~~~~~~~~~~~~
    glib/gstring.c:458:15: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
           if (pos < string->len)
                   ^
    glib/gstring.c:462:18: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘gssize’ {aka ‘long int’} [-Werror=sign-compare]
           if (offset < pos)
                      ^
    In file included from glib/glibconfig.h:9,
                     from glib/gtypes.h:32,
                     from glib/gstring.h:32,
                     from glib/gstring.c:37:
    glib/gmacros.h:351:26: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘long unsigned int’ [-Werror=sign-compare]
     #define MIN(a, b)  (((a) < (b)) ? (a) : (b))
                              ^
    glib/gstring.c:464:22: note: in expansion of macro ‘MIN’
               precount = MIN (len, pos - offset);
                          ^~~
    glib/gmacros.h:351:35: error: operand of ?: changes signedness from ‘gssize’ {aka ‘long int’} to ‘long unsigned int’ due to unsignedness of other operand [-Werror=sign-compare]
     #define MIN(a, b)  (((a) < (b)) ? (a) : (b))
                                       ^~~
    glib/gstring.c:464:22: note: in expansion of macro ‘MIN’
               precount = MIN (len, pos - offset);
                          ^~~
    glib/gstring.c:469:15: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
           if (len > precount)
                   ^
    glib/gstring.c:481:15: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
           if (pos < string->len)
                   ^
    In file included from glib/glibconfig.h:9,
                     from glib/gtypes.h:32,
                     from glib/gstring.h:32,
                     from glib/gstring.c:37:
    glib/gstring.c: In function ‘g_string_insert_c’:
    glib/gstring.c:782:31: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
         g_return_val_if_fail (pos <= string->len, string);
                                   ^~
    glib/gmacros.h:455:25: note: in definition of macro ‘G_LIKELY’
     #define G_LIKELY(expr) (expr)
                             ^~~~
    glib/gstring.c:782:5: note: in expansion of macro ‘g_return_val_if_fail’
         g_return_val_if_fail (pos <= string->len, string);
         ^~~~~~~~~~~~~~~~~~~~
    glib/gstring.c:785:11: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
       if (pos < string->len)
               ^
    In file included from glib/glibconfig.h:9,
                     from glib/gtypes.h:32,
                     from glib/gstring.h:32,
                     from glib/gstring.c:37:
    glib/gstring.c: In function ‘g_string_insert_unichar’:
    glib/gstring.c:857:31: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
         g_return_val_if_fail (pos <= string->len, string);
                                   ^~
    glib/gmacros.h:455:25: note: in definition of macro ‘G_LIKELY’
     #define G_LIKELY(expr) (expr)
                             ^~~~
    glib/gstring.c:857:5: note: in expansion of macro ‘g_return_val_if_fail’
         g_return_val_if_fail (pos <= string->len, string);
         ^~~~~~~~~~~~~~~~~~~~
    glib/gstring.c:860:11: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
       if (pos < string->len)
               ^
    In file included from glib/glibconfig.h:9,
                     from glib/gtypes.h:32,
                     from glib/gstring.h:32,
                     from glib/gstring.c:37:
    glib/gstring.c: In function ‘g_string_erase’:
    glib/gstring.c:969:29: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
       g_return_val_if_fail (pos <= string->len, string);
                                 ^~
    glib/gmacros.h:455:25: note: in definition of macro ‘G_LIKELY’
     #define G_LIKELY(expr) (expr)
                             ^~~~
    glib/gstring.c:969:3: note: in expansion of macro ‘g_return_val_if_fail’
       g_return_val_if_fail (pos <= string->len, string);
       ^~~~~~~~~~~~~~~~~~~~
    glib/gstring.c:975:39: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
           g_return_val_if_fail (pos + len <= string->len, string);
                                           ^~
    glib/gmacros.h:455:25: note: in definition of macro ‘G_LIKELY’
     #define G_LIKELY(expr) (expr)
                             ^~~~
    glib/gstring.c:975:7: note: in expansion of macro ‘g_return_val_if_fail’
           g_return_val_if_fail (pos + len <= string->len, string);
           ^~~~~~~~~~~~~~~~~~~~
    glib/gstring.c:977:21: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
           if (pos + len < string->len)
                         ^
    165a922a
gstring.c 29.9 KB