mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-11 03:46:17 +01:00
Merge branch 'fix_more_warnings' into 'master'
Fix more warnings See merge request GNOME/glib!1740
This commit is contained in:
commit
332bc1708e
@ -4355,12 +4355,12 @@ test_lookup_value (void)
|
||||
const gchar *dict, *key, *value;
|
||||
} cases[] = {
|
||||
{ "@a{ss} {'x': 'y'}", "x", "'y'" },
|
||||
{ "@a{ss} {'x': 'y'}", "y" },
|
||||
{ "@a{ss} {'x': 'y'}", "y", NULL },
|
||||
{ "@a{os} {'/x': 'y'}", "/x", "'y'" },
|
||||
{ "@a{os} {'/x': 'y'}", "/y" },
|
||||
{ "@a{os} {'/x': 'y'}", "/y", NULL },
|
||||
{ "@a{sv} {'x': <'y'>}", "x", "'y'" },
|
||||
{ "@a{sv} {'x': <5>}", "x", "5" },
|
||||
{ "@a{sv} {'x': <'y'>}", "y" }
|
||||
{ "@a{sv} {'x': <'y'>}", "y", NULL }
|
||||
};
|
||||
gsize i;
|
||||
|
||||
|
@ -51,6 +51,8 @@ static GSourceFuncs funcs = {
|
||||
prepare,
|
||||
check,
|
||||
dispatch,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
@ -419,6 +421,8 @@ static GSourceFuncs counter_source_funcs = {
|
||||
NULL,
|
||||
counter_source_dispatch,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
static GSource *
|
||||
@ -942,7 +946,7 @@ test_ready_time (void)
|
||||
GThread *thread;
|
||||
GSource *source;
|
||||
GSourceFuncs source_funcs = {
|
||||
NULL, NULL, ready_time_dispatch
|
||||
NULL, NULL, ready_time_dispatch, NULL, NULL, NULL
|
||||
};
|
||||
GMainLoop *loop;
|
||||
|
||||
@ -1085,7 +1089,9 @@ trivial_finalize (GSource *source)
|
||||
static void
|
||||
test_unref_while_pending (void)
|
||||
{
|
||||
static GSourceFuncs funcs = { trivial_prepare, NULL, NULL, trivial_finalize };
|
||||
static GSourceFuncs funcs = {
|
||||
trivial_prepare, NULL, NULL, trivial_finalize, NULL, NULL
|
||||
};
|
||||
GMainContext *context;
|
||||
GSource *source;
|
||||
|
||||
@ -1143,7 +1149,7 @@ write_bytes (gint fd,
|
||||
/* Detect if we run before we should */
|
||||
g_assert_cmpint (*to_write, >=, 0);
|
||||
|
||||
limit = MIN (*to_write, sizeof zeros);
|
||||
limit = MIN ((gsize) *to_write, sizeof zeros);
|
||||
*to_write -= write (fd, zeros, limit);
|
||||
|
||||
return TRUE;
|
||||
@ -1399,7 +1405,7 @@ static void
|
||||
test_source_unix_fd_api (void)
|
||||
{
|
||||
GSourceFuncs no_funcs = {
|
||||
NULL, NULL, return_true
|
||||
NULL, NULL, return_true, NULL, NULL, NULL
|
||||
};
|
||||
GSource *source_a;
|
||||
GSource *source_b;
|
||||
@ -1839,7 +1845,9 @@ static GSourceFuncs source_funcs = {
|
||||
prepare,
|
||||
check,
|
||||
dispatch,
|
||||
finalize
|
||||
finalize,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
static void
|
||||
@ -1915,7 +1923,9 @@ static GSourceFuncs source_with_source_funcs = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
finalize_source_with_source
|
||||
finalize_source_with_source,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
static void
|
||||
@ -1998,7 +2008,9 @@ static GSourceFuncs source_with_source_funcs_dispatch = {
|
||||
NULL,
|
||||
NULL,
|
||||
dispatch_source_with_source,
|
||||
finalize_source_with_source
|
||||
finalize_source_with_source,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
static void
|
||||
|
@ -76,7 +76,7 @@ start (GMarkupParseContext *context,
|
||||
}
|
||||
}
|
||||
|
||||
static GMarkupParser parser = { start };
|
||||
static GMarkupParser parser = { start, NULL, NULL, NULL, NULL };
|
||||
|
||||
struct test
|
||||
{
|
||||
@ -91,13 +91,14 @@ static struct test tests[] =
|
||||
{ "<bool mb='y'>", "<bool(1) 1 0 -1>",
|
||||
G_MARKUP_ERROR_PARSE, "'bool'" },
|
||||
|
||||
{ "<bool mb='false'/>", "<bool(1) 0 0 -1>" },
|
||||
{ "<bool mb='true'/>", "<bool(1) 1 0 -1>" },
|
||||
{ "<bool mb='t' ob='f' tri='1'/>", "<bool(1) 1 0 1>" },
|
||||
{ "<bool mb='y' ob='n' tri='0'/>", "<bool(1) 1 0 0>" },
|
||||
{ "<bool mb='false'/>", "<bool(1) 0 0 -1>", 0, NULL },
|
||||
{ "<bool mb='true'/>", "<bool(1) 1 0 -1>", 0, NULL },
|
||||
{ "<bool mb='t' ob='f' tri='1'/>", "<bool(1) 1 0 1>", 0, NULL },
|
||||
{ "<bool mb='y' ob='n' tri='0'/>", "<bool(1) 1 0 0>", 0, NULL },
|
||||
|
||||
{ "<bool mb='y' my:attr='q'><my:tag/></bool>", "<bool(1) 1 0 -1>" },
|
||||
{ "<bool mb='y' my:attr='q'><my:tag>some <b>text</b> is in here</my:tag></bool>", "<bool(1) 1 0 -1>" },
|
||||
{ "<bool mb='y' my:attr='q'><my:tag/></bool>", "<bool(1) 1 0 -1>", 0, NULL },
|
||||
{ "<bool mb='y' my:attr='q'><my:tag>some <b>text</b> is in here</my:tag></bool>",
|
||||
"<bool(1) 1 0 -1>", 0, NULL },
|
||||
|
||||
{ "<bool ob='y'/>", "<bool(0) 0 0 -1>",
|
||||
G_MARKUP_ERROR_MISSING_ATTRIBUTE, "'mb'" },
|
||||
@ -108,7 +109,7 @@ static struct test tests[] =
|
||||
{ "<bool mb='y' tri='y' tri='n'/>", "<bool(0) 0 0 -1>",
|
||||
G_MARKUP_ERROR_INVALID_CONTENT, "'tri'" },
|
||||
|
||||
{ "<str cm='x' am='y'/>", "<str(1) x y (null) (null)>" },
|
||||
{ "<str cm='x' am='y'/>", "<str(1) x y (null) (null)>", 0, NULL },
|
||||
|
||||
{ "<str am='x' co='y'/>", "<str(0) (null) (null) (null) (null)>",
|
||||
G_MARKUP_ERROR_MISSING_ATTRIBUTE, "'cm'" },
|
||||
@ -165,7 +166,7 @@ test_collect (gconstpointer d)
|
||||
}
|
||||
else
|
||||
{
|
||||
g_assert_error (error, G_MARKUP_ERROR, test->error_code);
|
||||
g_assert_error (error, G_MARKUP_ERROR, (gint) test->error_code);
|
||||
}
|
||||
|
||||
g_markup_parse_context_free (ctx);
|
||||
@ -194,7 +195,7 @@ start_element (GMarkupParseContext *context,
|
||||
}
|
||||
|
||||
static GMarkupParser cleanup_parser = {
|
||||
start_element
|
||||
start_element, NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
static void
|
||||
|
@ -265,7 +265,10 @@ end_element (GMarkupParseContext *context,
|
||||
static GMarkupParser parser =
|
||||
{
|
||||
start_element,
|
||||
end_element
|
||||
end_element,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
typedef struct
|
||||
@ -331,15 +334,15 @@ test (gconstpointer user_data)
|
||||
|
||||
TestCase test_cases[] = /* successful runs */
|
||||
{
|
||||
/* in */ /* out */
|
||||
{ "<test/>", "<test></test>" },
|
||||
{ "<sub><foo/></sub>", "<sub><<{foo}{/foo}>></sub>" },
|
||||
{ "<sub><foo/><bar/></sub>", "<sub><<{foo}{/foo}{bar}{/bar}>></sub>" },
|
||||
{ "<foo><bar/></foo>", "<foo>[[{foo}{bar}{/bar}{/foo}]]</foo>" },
|
||||
{ "<foo><x/><y/></foo>", "<foo>[[{foo}{x}{/x}{y}{/y}{/foo}]]</foo>" },
|
||||
{ "<foo/>", "<foo>[[{foo}{/foo}]]</foo>" },
|
||||
/* in */ /* out */ /* error */
|
||||
{ "<test/>", "<test></test>", NULL },
|
||||
{ "<sub><foo/></sub>", "<sub><<{foo}{/foo}>></sub>", NULL },
|
||||
{ "<sub><foo/><bar/></sub>", "<sub><<{foo}{/foo}{bar}{/bar}>></sub>", NULL },
|
||||
{ "<foo><bar/></foo>", "<foo>[[{foo}{bar}{/bar}{/foo}]]</foo>", NULL },
|
||||
{ "<foo><x/><y/></foo>", "<foo>[[{foo}{x}{/x}{y}{/y}{/foo}]]</foo>", NULL },
|
||||
{ "<foo/>", "<foo>[[{foo}{/foo}]]</foo>", NULL },
|
||||
{ "<sub><foo/></sub><bar/>", "<sub><<{foo}{/foo}>></sub>"
|
||||
"<bar>[[{bar}{/bar}]]</bar>" }
|
||||
"<bar>[[{bar}{/bar}]]</bar>", NULL }
|
||||
};
|
||||
|
||||
TestCase error_cases[] = /* error cases */
|
||||
@ -356,7 +359,7 @@ TestCase error_cases[] = /* error cases */
|
||||
|
||||
#define add_tests(func, basename, array) \
|
||||
G_STMT_START { \
|
||||
int __add_tests_i; \
|
||||
gsize __add_tests_i; \
|
||||
\
|
||||
for (__add_tests_i = 0; \
|
||||
__add_tests_i < G_N_ELEMENTS (array); \
|
||||
@ -364,7 +367,8 @@ TestCase error_cases[] = /* error cases */
|
||||
{ \
|
||||
char *testname; \
|
||||
\
|
||||
testname = g_strdup_printf ("%s/%d", basename, __add_tests_i); \
|
||||
testname = g_strdup_printf ("%s/%" G_GSIZE_FORMAT, \
|
||||
basename, __add_tests_i); \
|
||||
g_test_add_data_func (testname, &array[__add_tests_i], func); \
|
||||
g_free (testname); \
|
||||
} \
|
||||
|
@ -111,7 +111,8 @@ test_group_captions (void)
|
||||
{
|
||||
const gchar *test_name_base[] = { "help", "help-all", "help-test" };
|
||||
gchar *test_name;
|
||||
gint i, j;
|
||||
guint i;
|
||||
gsize j;
|
||||
|
||||
g_test_bug ("504142");
|
||||
|
||||
@ -132,7 +133,7 @@ test_group_captions (void)
|
||||
if (g_test_verbose ())
|
||||
trap_flags |= G_TEST_SUBPROCESS_INHERIT_STDOUT | G_TEST_SUBPROCESS_INHERIT_STDERR;
|
||||
|
||||
test_name = g_strdup_printf ("/option/group/captions/subprocess/%s-%d",
|
||||
test_name = g_strdup_printf ("/option/group/captions/subprocess/%s-%u",
|
||||
test_name_base[j], i);
|
||||
g_test_trap_subprocess (test_name, 0, trap_flags);
|
||||
g_free (test_name);
|
||||
@ -942,7 +943,7 @@ callback_test_optional_5 (void)
|
||||
gchar **argv_copy;
|
||||
int argc;
|
||||
GOptionEntry entries [] =
|
||||
{ { "dummy", 'd', 0, G_OPTION_ARG_NONE, &dummy, NULL },
|
||||
{ { "dummy", 'd', 0, G_OPTION_ARG_NONE, &dummy, NULL, NULL },
|
||||
{ "test", 't', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK,
|
||||
callback_parse_optional, NULL, NULL },
|
||||
{ NULL } };
|
||||
@ -980,7 +981,7 @@ callback_test_optional_6 (void)
|
||||
gchar **argv_copy;
|
||||
int argc;
|
||||
GOptionEntry entries [] =
|
||||
{ { "dummy", 'd', 0, G_OPTION_ARG_NONE, &dummy, NULL },
|
||||
{ { "dummy", 'd', 0, G_OPTION_ARG_NONE, &dummy, NULL, NULL },
|
||||
{ "test", 't', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK,
|
||||
callback_parse_optional, NULL, NULL },
|
||||
{ NULL } };
|
||||
@ -1018,7 +1019,7 @@ callback_test_optional_7 (void)
|
||||
gchar **argv_copy;
|
||||
int argc;
|
||||
GOptionEntry entries [] =
|
||||
{ { "dummy", 'd', 0, G_OPTION_ARG_NONE, &dummy, NULL },
|
||||
{ { "dummy", 'd', 0, G_OPTION_ARG_NONE, &dummy, NULL, NULL },
|
||||
{ "test", 't', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK,
|
||||
callback_parse_optional, NULL, NULL },
|
||||
{ NULL } };
|
||||
@ -1056,7 +1057,7 @@ callback_test_optional_8 (void)
|
||||
gchar **argv_copy;
|
||||
int argc;
|
||||
GOptionEntry entries [] =
|
||||
{ { "dummy", 'd', 0, G_OPTION_ARG_NONE, &dummy, NULL },
|
||||
{ { "dummy", 'd', 0, G_OPTION_ARG_NONE, &dummy, NULL, NULL },
|
||||
{ "test", 't', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK,
|
||||
callback_parse_optional, NULL, NULL },
|
||||
{ NULL } };
|
||||
@ -1331,8 +1332,8 @@ ignore_test3 (void)
|
||||
g_option_context_free (context);
|
||||
}
|
||||
|
||||
void
|
||||
static array_test1 (void)
|
||||
static void
|
||||
array_test1 (void)
|
||||
{
|
||||
GOptionContext *context;
|
||||
gboolean retval;
|
||||
@ -2361,7 +2362,7 @@ option_context_parse_command_line (GOptionContext *context,
|
||||
argv_new_len = g_strv_length (argv);
|
||||
|
||||
g_strfreev (argv);
|
||||
return success ? argv_len - argv_new_len : -1;
|
||||
return success ? (gint) (argv_len - argv_new_len) : -1;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -31,7 +31,7 @@ static char *echo_prog_path;
|
||||
static void
|
||||
multithreaded_test_run (GThreadFunc function)
|
||||
{
|
||||
int i;
|
||||
guint i;
|
||||
GPtrArray *threads = g_ptr_array_new ();
|
||||
guint n_threads;
|
||||
|
||||
@ -42,7 +42,7 @@ multithreaded_test_run (GThreadFunc function)
|
||||
{
|
||||
GThread *thread;
|
||||
|
||||
thread = g_thread_new ("test", function, GINT_TO_POINTER (i));
|
||||
thread = g_thread_new ("test", function, GUINT_TO_POINTER (i));
|
||||
g_ptr_array_add (threads, thread);
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ multithreaded_test_run (GThreadFunc function)
|
||||
{
|
||||
gpointer ret;
|
||||
ret = g_thread_join (g_ptr_array_index (threads, i));
|
||||
g_assert_cmpint (GPOINTER_TO_INT (ret), ==, i);
|
||||
g_assert_cmpint (GPOINTER_TO_UINT (ret), ==, i);
|
||||
}
|
||||
g_ptr_array_free (threads, TRUE);
|
||||
}
|
||||
@ -58,14 +58,14 @@ multithreaded_test_run (GThreadFunc function)
|
||||
static gpointer
|
||||
test_spawn_sync_multithreaded_instance (gpointer data)
|
||||
{
|
||||
int tnum = GPOINTER_TO_INT (data);
|
||||
guint tnum = GPOINTER_TO_UINT (data);
|
||||
GError *error = NULL;
|
||||
GPtrArray *argv;
|
||||
char *arg;
|
||||
char *stdout_str;
|
||||
int estatus;
|
||||
|
||||
arg = g_strdup_printf ("thread %d", tnum);
|
||||
arg = g_strdup_printf ("thread %u", tnum);
|
||||
|
||||
argv = g_ptr_array_new ();
|
||||
g_ptr_array_add (argv, echo_prog_path);
|
||||
@ -79,7 +79,7 @@ test_spawn_sync_multithreaded_instance (gpointer data)
|
||||
g_free (stdout_str);
|
||||
g_ptr_array_free (argv, TRUE);
|
||||
|
||||
return GINT_TO_POINTER (tnum);
|
||||
return GUINT_TO_POINTER (tnum);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -147,7 +147,7 @@ on_child_stdout (GIOChannel *channel,
|
||||
static gpointer
|
||||
test_spawn_async_multithreaded_instance (gpointer thread_data)
|
||||
{
|
||||
int tnum = GPOINTER_TO_INT (thread_data);
|
||||
guint tnum = GPOINTER_TO_UINT (thread_data);
|
||||
GError *error = NULL;
|
||||
GPtrArray *argv;
|
||||
char *arg;
|
||||
@ -162,7 +162,7 @@ test_spawn_async_multithreaded_instance (gpointer thread_data)
|
||||
context = g_main_context_new ();
|
||||
loop = g_main_loop_new (context, TRUE);
|
||||
|
||||
arg = g_strdup_printf ("thread %d", tnum);
|
||||
arg = g_strdup_printf ("thread %u", tnum);
|
||||
|
||||
argv = g_ptr_array_new ();
|
||||
g_ptr_array_add (argv, echo_prog_path);
|
||||
@ -203,7 +203,7 @@ test_spawn_async_multithreaded_instance (gpointer thread_data)
|
||||
|
||||
g_free (arg);
|
||||
|
||||
return GINT_TO_POINTER (tnum);
|
||||
return GUINT_TO_POINTER (tnum);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -333,7 +333,7 @@ static void
|
||||
test_tree_traverse (void)
|
||||
{
|
||||
GTree *tree;
|
||||
gint i;
|
||||
gsize i;
|
||||
TraverseData orders[] = {
|
||||
{ G_IN_ORDER, -1, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" },
|
||||
{ G_IN_ORDER, 1, "0" },
|
||||
|
Loading…
Reference in New Issue
Block a user