[glib/glib-2-64: 1/3] Fixing signedness warning in glib/gfileutils.c




commit 3ff911afaac15759a2d2d4af91c8bc1251a96c3e
Author: Emmanuel Fleury <emmanuel fleury u-bordeaux fr>
Date:   Thu Aug 27 14:26:20 2020 +0200

    Fixing signedness warning in glib/gfileutils.c
    
    glib/gfileutils.c: In function ‘write_to_file’:
    glib/gfileutils.c:1176:19: error: comparison of integer expressions of different signedness: ‘gssize’ 
{aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
     1176 |       g_assert (s <= length);
          |                   ^~
    glib/gmacros.h:939:25: note: in definition of macro ‘G_LIKELY’
      939 | #define G_LIKELY(expr) (expr)
          |                         ^~~~
    glib/gfileutils.c:1176:7: note: in expansion of macro ‘g_assert’
     1176 |       g_assert (s <= length);
          |       ^~~~~~~~
    
    Related to issue #1735 (Get back to a -werror build)

 glib/gfileutils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/glib/gfileutils.c b/glib/gfileutils.c
index f0799e212..acf57b3a1 100644
--- a/glib/gfileutils.c
+++ b/glib/gfileutils.c
@@ -1106,7 +1106,7 @@ write_to_temp_file (const gchar  *contents,
           goto out;
         }
 
-      g_assert (s <= length);
+      g_assert ((gsize) s <= length);
 
       contents += s;
       length -= s;


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