mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-19 07:08:54 +02:00
Merge branch 'fix_warnings' into 'master'
Fix signedness warnings See merge request GNOME/glib!1699
This commit is contained in:
@@ -194,8 +194,7 @@ append_tuple_type_string (GString *string,
|
|||||||
{
|
{
|
||||||
GVariantType *result, *other_result;
|
GVariantType *result, *other_result;
|
||||||
GVariantType **types;
|
GVariantType **types;
|
||||||
gint size;
|
gsize i, size;
|
||||||
gsize i;
|
|
||||||
|
|
||||||
g_string_append_c (string, '(');
|
g_string_append_c (string, '(');
|
||||||
g_string_append (description, "t of [");
|
g_string_append (description, "t of [");
|
||||||
@@ -376,8 +375,7 @@ describe_type (const GVariantType *type)
|
|||||||
{
|
{
|
||||||
const GVariantType *sub;
|
const GVariantType *sub;
|
||||||
GString *string;
|
GString *string;
|
||||||
gint length;
|
gsize i, length;
|
||||||
gsize i;
|
|
||||||
|
|
||||||
string = g_string_new ("t of [");
|
string = g_string_new ("t of [");
|
||||||
|
|
||||||
@@ -873,8 +871,7 @@ describe_info (GVariantTypeInfo *info)
|
|||||||
{
|
{
|
||||||
const gchar *sep = "";
|
const gchar *sep = "";
|
||||||
GString *string;
|
GString *string;
|
||||||
gint length;
|
gsize i, length;
|
||||||
gsize i;
|
|
||||||
|
|
||||||
string = g_string_new ("t of [");
|
string = g_string_new ("t of [");
|
||||||
length = g_variant_type_info_n_members (info);
|
length = g_variant_type_info_n_members (info);
|
||||||
@@ -935,11 +932,10 @@ static void
|
|||||||
check_offsets (GVariantTypeInfo *info,
|
check_offsets (GVariantTypeInfo *info,
|
||||||
const GVariantType *type)
|
const GVariantType *type)
|
||||||
{
|
{
|
||||||
gsize flavour;
|
gsize flavour, length;
|
||||||
gint length;
|
|
||||||
|
|
||||||
length = g_variant_type_info_n_members (info);
|
length = g_variant_type_info_n_members (info);
|
||||||
g_assert_cmpint (length, ==, g_variant_type_n_items (type));
|
g_assert_cmpuint (length, ==, g_variant_type_n_items (type));
|
||||||
|
|
||||||
/* the 'flavour' is the low order bits of the ending point of
|
/* the 'flavour' is the low order bits of the ending point of
|
||||||
* variable-size items in the tuple. this lets us test that the type
|
* variable-size items in the tuple. this lets us test that the type
|
||||||
@@ -2637,7 +2633,7 @@ tree_instance_check_gvariant (TreeInstance *tree,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'b':
|
case 'b':
|
||||||
return g_variant_get_boolean (value) == tree->data.integer;
|
return g_variant_get_boolean (value) == (gboolean) tree->data.integer;
|
||||||
|
|
||||||
case 'y':
|
case 'y':
|
||||||
return g_variant_get_byte (value) == (guchar) tree->data.integer;
|
return g_variant_get_byte (value) == (guchar) tree->data.integer;
|
||||||
@@ -3091,7 +3087,7 @@ test_varargs (void)
|
|||||||
i = 0;
|
i = 0;
|
||||||
g_variant_iter_init (&iter, value);
|
g_variant_iter_init (&iter, value);
|
||||||
while (g_variant_iter_loop (&iter, "mi", NULL, &val))
|
while (g_variant_iter_loop (&iter, "mi", NULL, &val))
|
||||||
g_assert_true (val == i++ || val == 0);
|
g_assert_true (val == (gint) i++ || val == 0);
|
||||||
g_assert_cmpuint (i, ==, 100);
|
g_assert_cmpuint (i, ==, 100);
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
|
@@ -591,7 +591,7 @@ test_hash_misc (void)
|
|||||||
gint value = 120;
|
gint value = 120;
|
||||||
gint *pvalue;
|
gint *pvalue;
|
||||||
GList *keys, *values;
|
GList *keys, *values;
|
||||||
gint keys_len, values_len;
|
gsize keys_len, values_len;
|
||||||
GHashTableIter iter;
|
GHashTableIter iter;
|
||||||
gpointer ikey, ivalue;
|
gpointer ikey, ivalue;
|
||||||
int result_array[10000];
|
int result_array[10000];
|
||||||
|
@@ -398,7 +398,7 @@ compare_field (const GLogField *f1, const GLogField *f2)
|
|||||||
static gboolean
|
static gboolean
|
||||||
compare_fields (const GLogField *f1, gsize n1, const GLogField *f2, gsize n2)
|
compare_fields (const GLogField *f1, gsize n1, const GLogField *f2, gsize n2)
|
||||||
{
|
{
|
||||||
int i, j;
|
gsize i, j;
|
||||||
|
|
||||||
for (i = 0; i < n1; i++)
|
for (i = 0; i < n1; i++)
|
||||||
{
|
{
|
||||||
|
@@ -220,14 +220,14 @@ test_cleanup (void)
|
|||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
int 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 (tests); i++)
|
for (i = 0; i < G_N_ELEMENTS (tests); i++)
|
||||||
{
|
{
|
||||||
path = g_strdup_printf ("/markup/collect/%d", i);
|
path = g_strdup_printf ("/markup/collect/%" G_GSIZE_FORMAT, i);
|
||||||
g_test_add_data_func (path, &tests[i], test_collect);
|
g_test_add_data_func (path, &tests[i], test_collect);
|
||||||
g_free (path);
|
g_free (path);
|
||||||
}
|
}
|
||||||
|
@@ -144,21 +144,21 @@ format_test (void)
|
|||||||
|
|
||||||
int main (int argc, char **argv)
|
int 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 (escape_tests); i++)
|
for (i = 0; i < G_N_ELEMENTS (escape_tests); i++)
|
||||||
{
|
{
|
||||||
path = g_strdup_printf ("/markup/escape-text/%d", i);
|
path = g_strdup_printf ("/markup/escape-text/%" G_GSIZE_FORMAT, i);
|
||||||
g_test_add_data_func (path, &escape_tests[i], escape_test);
|
g_test_add_data_func (path, &escape_tests[i], escape_test);
|
||||||
g_free (path);
|
g_free (path);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (unichar_tests); i++)
|
for (i = 0; i < G_N_ELEMENTS (unichar_tests); i++)
|
||||||
{
|
{
|
||||||
path = g_strdup_printf ("/markup/escape-unichar/%d", i);
|
path = g_strdup_printf ("/markup/escape-unichar/%" G_GSIZE_FORMAT, i);
|
||||||
g_test_add_data_func (path, &unichar_tests[i], unichar_test);
|
g_test_add_data_func (path, &unichar_tests[i], unichar_test);
|
||||||
g_free (path);
|
g_free (path);
|
||||||
}
|
}
|
||||||
|
@@ -168,7 +168,7 @@ traversal_test (void)
|
|||||||
{ G_LEVEL_ORDER, G_TRAVERSE_ALL, 3, 7, "ABFCDEG" },
|
{ G_LEVEL_ORDER, G_TRAVERSE_ALL, 3, 7, "ABFCDEG" },
|
||||||
{ G_LEVEL_ORDER, G_TRAVERSE_ALL, 3, 8, "ABFCDEG" },
|
{ G_LEVEL_ORDER, G_TRAVERSE_ALL, 3, 8, "ABFCDEG" },
|
||||||
};
|
};
|
||||||
gint i;
|
gsize i;
|
||||||
CallbackData data;
|
CallbackData data;
|
||||||
|
|
||||||
root = g_node_new (C2P ('A'));
|
root = g_node_new (C2P ('A'));
|
||||||
|
@@ -173,7 +173,7 @@ thread_func (gpointer data)
|
|||||||
static void
|
static void
|
||||||
test_once_init_multi_threaded (void)
|
test_once_init_multi_threaded (void)
|
||||||
{
|
{
|
||||||
gint i;
|
gsize i;
|
||||||
GThread *threads[THREADS];
|
GThread *threads[THREADS];
|
||||||
|
|
||||||
g_test_summary ("Test g_once_init_{enter,leave}() usage from multiple threads");
|
g_test_summary ("Test g_once_init_{enter,leave}() usage from multiple threads");
|
||||||
|
@@ -210,28 +210,28 @@ test_equal (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 (compile_tests); i++)
|
for (i = 0; i < G_N_ELEMENTS (compile_tests); i++)
|
||||||
{
|
{
|
||||||
path = g_strdup_printf ("/pattern/compile/%d", i);
|
path = g_strdup_printf ("/pattern/compile/%" G_GSIZE_FORMAT, i);
|
||||||
g_test_add_data_func (path, &compile_tests[i], test_compilation);
|
g_test_add_data_func (path, &compile_tests[i], test_compilation);
|
||||||
g_free (path);
|
g_free (path);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (match_tests); i++)
|
for (i = 0; i < G_N_ELEMENTS (match_tests); i++)
|
||||||
{
|
{
|
||||||
path = g_strdup_printf ("/pattern/match/%d", i);
|
path = g_strdup_printf ("/pattern/match/%" G_GSIZE_FORMAT, i);
|
||||||
g_test_add_data_func (path, &match_tests[i], test_match);
|
g_test_add_data_func (path, &match_tests[i], test_match);
|
||||||
g_free (path);
|
g_free (path);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (equal_tests); i++)
|
for (i = 0; i < G_N_ELEMENTS (equal_tests); i++)
|
||||||
{
|
{
|
||||||
path = g_strdup_printf ("/pattern/equal/%d", i);
|
path = g_strdup_printf ("/pattern/equal/%" G_GSIZE_FORMAT, i);
|
||||||
g_test_add_data_func (path, &equal_tests[i], test_equal);
|
g_test_add_data_func (path, &equal_tests[i], test_equal);
|
||||||
g_free (path);
|
g_free (path);
|
||||||
}
|
}
|
||||||
|
@@ -246,7 +246,7 @@ test_error (void)
|
|||||||
"/glib/testing/protocol/critical",
|
"/glib/testing/protocol/critical",
|
||||||
"/glib/testing/protocol/error"
|
"/glib/testing/protocol/error"
|
||||||
};
|
};
|
||||||
gint i;
|
gsize i;
|
||||||
int messages = 0;
|
int messages = 0;
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (tests); i++)
|
for (i = 0; i < G_N_ELEMENTS (tests); i++)
|
||||||
|
@@ -14,7 +14,7 @@ check_integrity (GQueue *queue)
|
|||||||
GList *last;
|
GList *last;
|
||||||
GList *links;
|
GList *links;
|
||||||
GList *link;
|
GList *link;
|
||||||
gint n;
|
guint n;
|
||||||
|
|
||||||
g_assert (queue->length < 4000000000u);
|
g_assert (queue->length < 4000000000u);
|
||||||
|
|
||||||
@@ -266,7 +266,7 @@ random_test (gconstpointer d)
|
|||||||
break;
|
break;
|
||||||
case GET_LENGTH:
|
case GET_LENGTH:
|
||||||
{
|
{
|
||||||
int l;
|
guint l;
|
||||||
|
|
||||||
l = g_queue_get_length (q);
|
l = g_queue_get_length (q);
|
||||||
|
|
||||||
@@ -416,13 +416,13 @@ random_test (gconstpointer d)
|
|||||||
int n = get_random_position (q, TRUE);
|
int n = get_random_position (q, TRUE);
|
||||||
gpointer elm = g_queue_peek_nth (q, n);
|
gpointer elm = g_queue_peek_nth (q, n);
|
||||||
|
|
||||||
if (n == q->length - 1)
|
if (n == (int) (q->length - 1))
|
||||||
qinf->tail = qinf->tail->prev;
|
qinf->tail = qinf->tail->prev;
|
||||||
|
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
qinf->head = qinf->head->next;
|
qinf->head = qinf->head->next;
|
||||||
|
|
||||||
if (n >= 0 && n < q->length)
|
if (n >= 0 && (guint) n < q->length)
|
||||||
qinf->length--;
|
qinf->length--;
|
||||||
|
|
||||||
g_assert (elm == g_queue_pop_nth (q, n));
|
g_assert (elm == g_queue_pop_nth (q, n));
|
||||||
@@ -450,7 +450,7 @@ random_test (gconstpointer d)
|
|||||||
{
|
{
|
||||||
GList *list;
|
GList *list;
|
||||||
int n = get_random_position (q, TRUE);
|
int n = get_random_position (q, TRUE);
|
||||||
if (n < 0 || n >= q->length)
|
if (n < 0 || (guint) n >= q->length)
|
||||||
{
|
{
|
||||||
g_assert (g_queue_peek_nth (q, n) == NULL);
|
g_assert (g_queue_peek_nth (q, n) == NULL);
|
||||||
}
|
}
|
||||||
@@ -637,7 +637,7 @@ random_test (gconstpointer d)
|
|||||||
{
|
{
|
||||||
int n = get_random_position (q, FALSE);
|
int n = get_random_position (q, FALSE);
|
||||||
|
|
||||||
if (n == g_queue_get_length (q) - 1)
|
if (n == (int) (g_queue_get_length (q) - 1))
|
||||||
qinf->tail = qinf->tail->prev;
|
qinf->tail = qinf->tail->prev;
|
||||||
|
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
|
@@ -241,7 +241,7 @@ test_rcbox_alignment (void)
|
|||||||
sizeof (gint32) * 3,
|
sizeof (gint32) * 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
int i;
|
gsize i;
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (block_sizes); i++)
|
for (i = 0; i < G_N_ELEMENTS (block_sizes); i++)
|
||||||
{
|
{
|
||||||
@@ -265,7 +265,7 @@ test_atomic_rcbox_alignment (void)
|
|||||||
sizeof (gint32) * 3,
|
sizeof (gint32) * 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
int i;
|
gsize i;
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (block_sizes); i++)
|
for (i = 0; i < G_N_ELEMENTS (block_sizes); i++)
|
||||||
{
|
{
|
||||||
|
@@ -1305,8 +1305,7 @@ test_match_all (gconstpointer d)
|
|||||||
GMatchInfo *match_info;
|
GMatchInfo *match_info;
|
||||||
GSList *l_exp;
|
GSList *l_exp;
|
||||||
gboolean match_ok;
|
gboolean match_ok;
|
||||||
gint match_count;
|
guint i, match_count;
|
||||||
gint i;
|
|
||||||
|
|
||||||
regex = g_regex_new (data->pattern, 0, 0, NULL);
|
regex = g_regex_new (data->pattern, 0, 0, NULL);
|
||||||
match_ok = g_regex_match_all (regex, data->string, 0, &match_info);
|
match_ok = g_regex_match_all (regex, data->string, 0, &match_info);
|
||||||
@@ -1331,7 +1330,7 @@ test_match_all (gconstpointer d)
|
|||||||
|
|
||||||
matched_string = g_match_info_fetch (match_info, i);
|
matched_string = g_match_info_fetch (match_info, i);
|
||||||
g_match_info_fetch_pos (match_info, i, &start, &end);
|
g_match_info_fetch_pos (match_info, i, &start, &end);
|
||||||
g_message ("%d. %d-%d '%s'", i, start, end, matched_string);
|
g_message ("%u. %d-%d '%s'", i, start, end, matched_string);
|
||||||
g_free (matched_string);
|
g_free (matched_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1342,11 +1341,11 @@ test_match_all (gconstpointer d)
|
|||||||
{
|
{
|
||||||
Match *exp = l_exp->data;
|
Match *exp = l_exp->data;
|
||||||
|
|
||||||
g_message ("%d. %d-%d '%s'", i, exp->start, exp->end, exp->string);
|
g_message ("%u. %d-%d '%s'", i, exp->start, exp->end, exp->string);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_error ("match_count not as expected: %d != %d",
|
g_error ("match_count not as expected: %u != %d",
|
||||||
match_count, g_slist_length (data->expected));
|
match_count, g_slist_length (data->expected));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -111,8 +111,8 @@ test_scanner_tokens (ScannerFixture *fix,
|
|||||||
gchar buf[] = "(\t\n\r\\){}";
|
gchar buf[] = "(\t\n\r\\){}";
|
||||||
const gint buflen = strlen (buf);
|
const gint buflen = strlen (buf);
|
||||||
gchar tokbuf[] = "(\\){}";
|
gchar tokbuf[] = "(\\){}";
|
||||||
const gint tokbuflen = strlen (tokbuf);
|
const gsize tokbuflen = strlen (tokbuf);
|
||||||
guint i;
|
gsize i;
|
||||||
|
|
||||||
g_scanner_input_text (fix->scanner, buf, buflen);
|
g_scanner_input_text (fix->scanner, buf, buflen);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user