diff --git a/glib/gsequence.c b/glib/gsequence.c index 96f21d6e4..9d76dbb22 100644 --- a/glib/gsequence.c +++ b/glib/gsequence.c @@ -1255,9 +1255,9 @@ g_sequence_set (GSequenceIter *iter, * g_sequence_get_length: * @seq: a #GSequence * - * Returns the length of @seq. Note that this method is O(h) where `h' is the - * height of the tree. It is thus more efficient to use g_sequence_is_empty() - * when comparing the length to zero. + * Returns the positive length (>= 0) of @seq. Note that this method is + * O(h) where `h' is the height of the tree. It is thus more efficient + * to use g_sequence_is_empty() when comparing the length to zero. * * Returns: the length of @seq * diff --git a/glib/guri.c b/glib/guri.c index ceed7133d..23b8e6dd8 100644 --- a/glib/guri.c +++ b/glib/guri.c @@ -752,7 +752,7 @@ static gboolean should_normalize_empty_path (const char *scheme) { const char * const schemes[] = { "https", "http", "wss", "ws" }; - int i; + gsize i; for (i = 0; i < G_N_ELEMENTS (schemes); ++i) { if (!strcmp (schemes[i], scheme)) diff --git a/glib/tests/sequence.c b/glib/tests/sequence.c index db7d2a559..c2eba2c79 100644 --- a/glib/tests/sequence.c +++ b/glib/tests/sequence.c @@ -15,7 +15,7 @@ struct _GSequence struct _GSequenceNode { - gint n_nodes; + guint n_nodes; GSequenceNode * parent; GSequenceNode * left; GSequenceNode * right; @@ -99,7 +99,7 @@ typedef struct SequenceInfo { GQueue * queue; GSequence * sequence; - int n_items; + guint n_items; } SequenceInfo; typedef struct @@ -137,7 +137,7 @@ check_integrity (SequenceInfo *info) g_sequence_get_length (info->sequence), info->n_items); #endif g_assert (info->n_items == g_queue_get_length (info->queue)); - g_assert (g_sequence_get_length (info->sequence) == info->n_items); + g_assert ((guint) g_sequence_get_length (info->sequence) == info->n_items); iter = g_sequence_get_begin_iter (info->sequence); list = info->queue->head; @@ -155,7 +155,7 @@ check_integrity (SequenceInfo *info) } g_assert (info->n_items == g_queue_get_length (info->queue)); - g_assert (g_sequence_get_length (info->sequence) == info->n_items); + g_assert ((guint) g_sequence_get_length (info->sequence) == info->n_items); } static gpointer @@ -551,7 +551,7 @@ run_random_tests (gconstpointer d) { int i; - g_assert (g_queue_get_length (seq->queue) == g_sequence_get_length (seq->sequence)); + g_assert (g_queue_get_length (seq->queue) == (guint) g_sequence_get_length (seq->sequence)); for (i = 0; i < 10; ++i) { @@ -1387,7 +1387,7 @@ int main (int argc, char **argv) { - gint i; + gsize i; guint32 seed; gchar *path; diff --git a/glib/tests/shell.c b/glib/tests/shell.c index 1ed356e15..5cde37119 100644 --- a/glib/tests/shell.c +++ b/glib/tests/shell.c @@ -186,28 +186,28 @@ do_unquote_test (gconstpointer d) int main (int argc, char *argv[]) { - gint i; + gsize i; gchar *path; g_test_init (&argc, &argv, NULL); for (i = 0; i < G_N_ELEMENTS (cmdline_tests); i++) { - path = g_strdup_printf ("/shell/cmdline/%d", i); + path = g_strdup_printf ("/shell/cmdline/%" G_GSIZE_FORMAT, i); g_test_add_data_func (path, &cmdline_tests[i], do_cmdline_test); g_free (path); } for (i = 0; i < G_N_ELEMENTS (quote_tests); i++) { - path = g_strdup_printf ("/shell/quote/%d", i); + path = g_strdup_printf ("/shell/quote/%" G_GSIZE_FORMAT, i); g_test_add_data_func (path, "e_tests[i], do_quote_test); g_free (path); } for (i = 0; i < G_N_ELEMENTS (unquote_tests); i++) { - path = g_strdup_printf ("/shell/unquote/%d", i); + path = g_strdup_printf ("/shell/unquote/%" G_GSIZE_FORMAT, i); g_test_add_data_func (path, &unquote_tests[i], do_unquote_test); g_free (path); } diff --git a/glib/tests/slice.c b/glib/tests/slice.c index b0ad3da66..f37826f3a 100644 --- a/glib/tests/slice.c +++ b/glib/tests/slice.c @@ -137,7 +137,7 @@ test_allocate (void) { GThread *threads[30]; gint size; - gint i; + gsize i; for (i = 0; i < 30; i++) for (size = 1; size <= 4096; size++) diff --git a/glib/tests/spawn-singlethread.c b/glib/tests/spawn-singlethread.c index ab449eb95..c4417fe19 100644 --- a/glib/tests/spawn-singlethread.c +++ b/glib/tests/spawn-singlethread.c @@ -179,7 +179,7 @@ test_spawn_async_with_fds (void) int tnum = 1; GPtrArray *argv; char *arg; - int i; + gsize i; /* Each test has 3 variable parameters: stdin, stdout, stderr */ enum fd_type { diff --git a/glib/tests/timer.c b/glib/tests/timer.c index 149b3af4b..e805ef581 100644 --- a/glib/tests/timer.c +++ b/glib/tests/timer.c @@ -208,7 +208,7 @@ test_timeval_from_iso8601 (void) }; GTimeVal out; gboolean success; - gint i; + gsize i; /* Always run in UTC so the comparisons of parsed values are valid. */ if (!g_setenv ("TZ", "UTC", TRUE)) @@ -250,7 +250,7 @@ test_timeval_to_iso8601 (void) { { 657454877, 0 }, "1990-11-01T10:21:17Z" }, { { 17, 123400 }, "1970-01-01T00:00:17.123400Z" } }; - gint i; + gsize i; gchar *out; GTimeVal val; gboolean ret;