mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-27 07:56:14 +01:00
Fixing signedness warnings in glib/gdatetime.c
glib/gdatetime.c: In function ‘get_iso8601_int’: glib/gdatetime.c:1142:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare] for (i = 0; i < length; i++) ^ glib/gdatetime.c: In function ‘get_iso8601_seconds’: glib/gdatetime.c:1175:9: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare] if (i == length) ^~ glib/gdatetime.c:1178:12: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare] for (; i < length; i++) ^ In file included from glib/glibconfig.h:9, from glib/gtypes.h:32, from glib/gtimezone.h:27, from glib/gdatetime.h:31, from glib/gdatetime.c:62: glib/gdatetime.c: In function ‘initialize_alt_digits’: glib/gdatetime.c:2806:27: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘long int’ [-Werror=sign-compare] g_assert (digit_len < buffer + sizeof (buffer) - buffer_end); ^ glib/gmacros.h:455:25: note: in definition of macro ‘G_LIKELY’ #define G_LIKELY(expr) (expr) ^~~~ glib/gdatetime.c:2806:7: note: in expansion of macro ‘g_assert’ g_assert (digit_len < buffer + sizeof (buffer) - buffer_end); ^~~~~~~~
This commit is contained in:
parent
b8efd0df41
commit
3384ed3f7f
@ -1134,7 +1134,8 @@ g_date_time_new_from_timeval_utc (const GTimeVal *tv)
|
||||
static gboolean
|
||||
get_iso8601_int (const gchar *text, gsize length, gint *value)
|
||||
{
|
||||
gint i, v = 0;
|
||||
gsize i;
|
||||
guint v = 0;
|
||||
|
||||
if (length < 1 || length > 4)
|
||||
return FALSE;
|
||||
@ -1155,7 +1156,7 @@ get_iso8601_int (const gchar *text, gsize length, gint *value)
|
||||
static gboolean
|
||||
get_iso8601_seconds (const gchar *text, gsize length, gdouble *value)
|
||||
{
|
||||
gint i;
|
||||
gsize i;
|
||||
gdouble divisor = 1, v = 0;
|
||||
|
||||
if (length < 2)
|
||||
@ -2803,7 +2804,7 @@ initialize_alt_digits (void)
|
||||
if (digit == NULL)
|
||||
return NULL;
|
||||
|
||||
g_assert (digit_len < buffer + sizeof (buffer) - buffer_end);
|
||||
g_assert (digit_len < (gsize) (buffer + sizeof (buffer) - buffer_end));
|
||||
|
||||
alt_digits[i] = buffer_end;
|
||||
buffer_end = g_stpcpy (buffer_end, digit);
|
||||
|
Loading…
Reference in New Issue
Block a user