Merge branch 'fix_warnings' into 'master'

Fix warnings

See merge request GNOME/glib!1750
This commit is contained in:
Sebastian Dröge 2020-11-17 17:20:01 +00:00
commit 1b7509c09b
7 changed files with 18 additions and 18 deletions

View File

@ -1255,9 +1255,9 @@ g_sequence_set (GSequenceIter *iter,
* g_sequence_get_length: * g_sequence_get_length:
* @seq: a #GSequence * @seq: a #GSequence
* *
* Returns the length of @seq. Note that this method is O(h) where `h' is the * Returns the positive length (>= 0) of @seq. Note that this method is
* height of the tree. It is thus more efficient to use g_sequence_is_empty() * O(h) where `h' is the height of the tree. It is thus more efficient
* when comparing the length to zero. * to use g_sequence_is_empty() when comparing the length to zero.
* *
* Returns: the length of @seq * Returns: the length of @seq
* *

View File

@ -752,7 +752,7 @@ static gboolean
should_normalize_empty_path (const char *scheme) should_normalize_empty_path (const char *scheme)
{ {
const char * const schemes[] = { "https", "http", "wss", "ws" }; const char * const schemes[] = { "https", "http", "wss", "ws" };
int i; gsize i;
for (i = 0; i < G_N_ELEMENTS (schemes); ++i) for (i = 0; i < G_N_ELEMENTS (schemes); ++i)
{ {
if (!strcmp (schemes[i], scheme)) if (!strcmp (schemes[i], scheme))

View File

@ -15,7 +15,7 @@ struct _GSequence
struct _GSequenceNode struct _GSequenceNode
{ {
gint n_nodes; guint n_nodes;
GSequenceNode * parent; GSequenceNode * parent;
GSequenceNode * left; GSequenceNode * left;
GSequenceNode * right; GSequenceNode * right;
@ -99,7 +99,7 @@ typedef struct SequenceInfo
{ {
GQueue * queue; GQueue * queue;
GSequence * sequence; GSequence * sequence;
int n_items; guint n_items;
} SequenceInfo; } SequenceInfo;
typedef struct typedef struct
@ -137,7 +137,7 @@ check_integrity (SequenceInfo *info)
g_sequence_get_length (info->sequence), info->n_items); g_sequence_get_length (info->sequence), info->n_items);
#endif #endif
g_assert (info->n_items == g_queue_get_length (info->queue)); 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); iter = g_sequence_get_begin_iter (info->sequence);
list = info->queue->head; 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 (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 static gpointer
@ -551,7 +551,7 @@ run_random_tests (gconstpointer d)
{ {
int i; 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) for (i = 0; i < 10; ++i)
{ {
@ -1387,7 +1387,7 @@ int
main (int argc, main (int argc,
char **argv) char **argv)
{ {
gint i; gsize i;
guint32 seed; guint32 seed;
gchar *path; gchar *path;

View File

@ -186,28 +186,28 @@ do_unquote_test (gconstpointer d)
int int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
gint i; gsize i;
gchar *path; gchar *path;
g_test_init (&argc, &argv, NULL); g_test_init (&argc, &argv, NULL);
for (i = 0; i < G_N_ELEMENTS (cmdline_tests); i++) 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_test_add_data_func (path, &cmdline_tests[i], do_cmdline_test);
g_free (path); g_free (path);
} }
for (i = 0; i < G_N_ELEMENTS (quote_tests); i++) 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, &quote_tests[i], do_quote_test); g_test_add_data_func (path, &quote_tests[i], do_quote_test);
g_free (path); g_free (path);
} }
for (i = 0; i < G_N_ELEMENTS (unquote_tests); i++) 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_test_add_data_func (path, &unquote_tests[i], do_unquote_test);
g_free (path); g_free (path);
} }

View File

@ -137,7 +137,7 @@ test_allocate (void)
{ {
GThread *threads[30]; GThread *threads[30];
gint size; gint size;
gint i; gsize i;
for (i = 0; i < 30; i++) for (i = 0; i < 30; i++)
for (size = 1; size <= 4096; size++) for (size = 1; size <= 4096; size++)

View File

@ -179,7 +179,7 @@ test_spawn_async_with_fds (void)
int tnum = 1; int tnum = 1;
GPtrArray *argv; GPtrArray *argv;
char *arg; char *arg;
int i; gsize i;
/* Each test has 3 variable parameters: stdin, stdout, stderr */ /* Each test has 3 variable parameters: stdin, stdout, stderr */
enum fd_type { enum fd_type {

View File

@ -208,7 +208,7 @@ test_timeval_from_iso8601 (void)
}; };
GTimeVal out; GTimeVal out;
gboolean success; gboolean success;
gint i; gsize i;
/* Always run in UTC so the comparisons of parsed values are valid. */ /* Always run in UTC so the comparisons of parsed values are valid. */
if (!g_setenv ("TZ", "UTC", TRUE)) if (!g_setenv ("TZ", "UTC", TRUE))
@ -250,7 +250,7 @@ test_timeval_to_iso8601 (void)
{ { 657454877, 0 }, "1990-11-01T10:21:17Z" }, { { 657454877, 0 }, "1990-11-01T10:21:17Z" },
{ { 17, 123400 }, "1970-01-01T00:00:17.123400Z" } { { 17, 123400 }, "1970-01-01T00:00:17.123400Z" }
}; };
gint i; gsize i;
gchar *out; gchar *out;
GTimeVal val; GTimeVal val;
gboolean ret; gboolean ret;