[glib: 3/8] Fix signedness warning in glib/gdate.c




commit 5471c13f65db0e0b8a5ea80c1164a06c5aed1798
Author: Emmanuel Fleury <emmanuel fleury gmail com>
Date:   Fri May 14 12:22:15 2021 +0200

    Fix signedness warning in glib/gdate.c
    
    glib/gdate.c: In function 'win32_strftime_helper':
    glib/gdate.c:2582:12: warning: comparison of integer expressions of different signedness: 'gsize' {aka 
'long long unsigned int'} and 'glong' {aka 'long int'}
       if (slen <= convlen)
                ^~

 glib/gdate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/glib/gdate.c b/glib/gdate.c
index 59a85c4f6..5feb090c4 100644
--- a/glib/gdate.c
+++ b/glib/gdate.c
@@ -2588,7 +2588,8 @@ win32_strftime_helper (const GDate     *d,
       return 0;
     }
   
-  if (slen <= convlen)
+  g_assert (convlen >= 0);
+  if ((gsize) convlen >= slen)
     {
       /* Ensure only whole characters are copied into the buffer. */
       gchar *end = g_utf8_find_prev_char (convbuf, convbuf + slen);


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