Skip to content
  • Emmanuel Fleury's avatar
    Fixing signedness in glib/giochannel.c · 2f9e6e97
    Emmanuel Fleury authored
    In file included from glib/glibconfig.h:9,
                     from glib/gtypes.h:32,
                     from glib/gquark.h:32,
                     from glib/gerror.h:28,
                     from glib/gconvert.h:32,
                     from glib/giochannel.h:32,
                     from glib/giochannel.c:37:
    glib/giochannel.c: In function ‘g_io_channel_write_chars’:
    glib/gmacros.h:351:26: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘gssize’ {aka ‘long int’} [-Werror=sign-compare]
     #define MIN(a, b)  (((a) < (b)) ? (a) : (b))
                              ^
    glib/giochannel.c:2285:31: note: in expansion of macro ‘MIN’
               gssize write_this = MIN (space_in_buf, count - wrote_bytes);
                                   ^~~
    glib/gmacros.h:351:41: error: operand of ?: changes signedness from ‘gssize’ {aka ‘long int’} to ‘gsize’ {aka ‘long unsigned int’} due to unsignedness of other operand [-Werror=sign-compare]
     #define MIN(a, b)  (((a) < (b)) ? (a) : (b))
                                             ^~~
    glib/giochannel.c:2285:31: note: in expansion of macro ‘MIN’
               gssize write_this = MIN (space_in_buf, count - wrote_bytes);
                                   ^~~
    glib/giochannel.c:2415:41: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
                             g_assert (count == from_buf_len - from_buf_old_len);
                                             ^~
    glib/gmacros.h:455:25: note: in definition of macro ‘G_LIKELY’
     #define G_LIKELY(expr) (expr)
                             ^~~~
    glib/giochannel.c:2415:25: note: in expansion of macro ‘g_assert’
                             g_assert (count == from_buf_len - from_buf_old_len);
                             ^~~~~~~~
    2f9e6e97