mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-31 21:34:12 +02:00
Fix signedness warnings in glib/gutf8.c
glib/gutf8.c: In function 'g_utf8_get_char_extended': glib/gutf8.c:626:39: error: comparison of integer expressions of different signedness: 'guint' {aka 'unsigned int'} and 'gssize' {aka 'int'} 626 | if (G_UNLIKELY (max_len >= 0 && len > max_len)) | ^ glib/gmacros.h:1091:27: note: in definition of macro 'G_UNLIKELY' 1091 | #define G_UNLIKELY(expr) (expr) | ^~~~ glib/gutf8.c:628:21: error: comparison of integer expressions of different signedness: 'guint' {aka 'unsigned int'} and 'gssize' {aka 'int'} 628 | for (i = 1; i < max_len; i++) | ^
This commit is contained in:
@@ -574,7 +574,7 @@ static inline gunichar
|
||||
g_utf8_get_char_extended (const gchar *p,
|
||||
gssize max_len)
|
||||
{
|
||||
guint i, len;
|
||||
gsize i, len;
|
||||
gunichar min_code;
|
||||
gunichar wc = (guchar) *p;
|
||||
const gunichar partial_sequence = (gunichar) -2;
|
||||
@@ -623,9 +623,9 @@ g_utf8_get_char_extended (const gchar *p,
|
||||
return malformed_sequence;
|
||||
}
|
||||
|
||||
if (G_UNLIKELY (max_len >= 0 && len > max_len))
|
||||
if (G_UNLIKELY (max_len >= 0 && len > (gsize) max_len))
|
||||
{
|
||||
for (i = 1; i < max_len; i++)
|
||||
for (i = 1; i < (gsize) max_len; i++)
|
||||
{
|
||||
if ((((guchar *)p)[i] & 0xc0) != 0x80)
|
||||
return malformed_sequence;
|
||||
|
Reference in New Issue
Block a user