summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <slomo@coaxion.net>2021-04-29 10:58:34 +0000
committerSebastian Dröge <slomo@coaxion.net>2021-04-29 10:58:34 +0000
commit8312f0b7cf5cd7910684dbc6b63b7d8bbf8b0569 (patch)
tree61ec98d284bc6fdee00e49e46b6ae72e9a8177e1
parent28b18cab06874fa56e90c43b073d3716e39099b8 (diff)
parentb419761189989cada2101c9c005e2e27aebdf223 (diff)
downloadglib-8312f0b7cf5cd7910684dbc6b63b7d8bbf8b0569.tar.gz
Merge branch 'fix_more_warnings' into 'master'
Fix more warnings See merge request GNOME/glib!2063
-rw-r--r--gio/tests/basic-application.c8
-rw-r--r--gio/tests/dbus-appinfo.c8
-rw-r--r--gio/tests/readwrite.c6
-rw-r--r--gio/tests/unix-streams.c36
-rw-r--r--tests/gobject/defaultiface.c7
-rw-r--r--tests/gobject/testcommon.h9
-rw-r--r--tests/gobject/testgobject.c13
-rw-r--r--tests/onceinit.c2
8 files changed, 62 insertions, 27 deletions
diff --git a/gio/tests/basic-application.c b/gio/tests/basic-application.c
index 94100eb5f..362b2fd51 100644
--- a/gio/tests/basic-application.c
+++ b/gio/tests/basic-application.c
@@ -54,10 +54,10 @@ static void
startup (GApplication *app)
{
static GActionEntry actions[] = {
- { "new", new_activated, NULL, NULL, NULL },
- { "quit", quit_activated, NULL, NULL, NULL },
- { "action1", action1_activated, NULL, NULL, NULL },
- { "action2", action2_activated, "b", "false", change_action2 }
+ { "new", new_activated, NULL, NULL, NULL, { 0 } },
+ { "quit", quit_activated, NULL, NULL, NULL, { 0 } },
+ { "action1", action1_activated, NULL, NULL, NULL, { 0 } },
+ { "action2", action2_activated, "b", "false", change_action2, { 0 } }
};
g_action_map_add_action_entries (G_ACTION_MAP (app),
diff --git a/gio/tests/dbus-appinfo.c b/gio/tests/dbus-appinfo.c
index 7e2fc4d79..86bdfebee 100644
--- a/gio/tests/dbus-appinfo.c
+++ b/gio/tests/dbus-appinfo.c
@@ -174,10 +174,10 @@ test_application_quit (GSimpleAction *action,
}
static const GActionEntry app_actions[] = {
- { "frob", test_application_frob },
- { "tweak", test_application_tweak },
- { "twiddle", test_application_twiddle },
- { "quit", test_application_quit }
+ { "frob", test_application_frob, NULL, NULL, NULL, { 0 } },
+ { "tweak", test_application_tweak, NULL, NULL, NULL, { 0 } },
+ { "twiddle", test_application_twiddle, NULL, NULL, NULL, { 0 } },
+ { "quit", test_application_quit, NULL, NULL, NULL, { 0 } }
};
static void
diff --git a/gio/tests/readwrite.c b/gio/tests/readwrite.c
index 2aa925b30..7551e5384 100644
--- a/gio/tests/readwrite.c
+++ b/gio/tests/readwrite.c
@@ -32,6 +32,7 @@ static void
verify_iostream (GFileIOStream *file_iostream)
{
gboolean res;
+ gssize skipped;
GIOStream *iostream;
GError *error;
GInputStream *in;
@@ -73,8 +74,9 @@ verify_iostream (GFileIOStream *file_iostream)
g_assert (res == 5);
verify_pos (iostream, 15);
- res = g_input_stream_skip (in, 10000, NULL, NULL);
- g_assert (res == strlen (original_data) - 15);
+ skipped = g_input_stream_skip (in, 10000, NULL, NULL);
+ g_assert_cmpint (skipped, >=, 0);
+ g_assert ((gsize) skipped == strlen (original_data) - 15);
verify_pos (iostream, strlen (original_data));
res = g_seekable_seek (G_SEEKABLE (iostream),
diff --git a/gio/tests/unix-streams.c b/gio/tests/unix-streams.c
index 5ec829919..407a67dbd 100644
--- a/gio/tests/unix-streams.c
+++ b/gio/tests/unix-streams.c
@@ -474,8 +474,9 @@ test_write_wouldblock (void)
gint fd[2];
GError *err = NULL;
guint8 data_write[1024], data_read[1024];
- guint i;
- gint pipe_capacity;
+ gsize i;
+ int retval;
+ gsize pipe_capacity;
for (i = 0; i < sizeof (data_write); i++)
data_write[i] = i;
@@ -483,7 +484,9 @@ test_write_wouldblock (void)
g_assert_cmpint (pipe (fd), ==, 0);
g_assert_cmpint (fcntl (fd[0], F_SETPIPE_SZ, 4096, NULL), !=, 0);
- pipe_capacity = fcntl (fd[0], F_GETPIPE_SZ, &pipe_capacity, NULL);
+ retval = fcntl (fd[0], F_GETPIPE_SZ);
+ g_assert_cmpint (retval, >=, 0);
+ pipe_capacity = (gsize) retval;
g_assert_cmpint (pipe_capacity, >=, 4096);
g_assert_cmpint (pipe_capacity % 1024, >=, 0);
@@ -552,10 +555,11 @@ test_writev_wouldblock (void)
gint fd[2];
GError *err = NULL;
guint8 data_write[1024], data_read[1024];
- guint i;
+ gsize i;
+ int retval;
+ gsize pipe_capacity;
GOutputVector vectors[4];
GPollableReturn res;
- gint pipe_capacity;
for (i = 0; i < sizeof (data_write); i++)
data_write[i] = i;
@@ -563,7 +567,9 @@ test_writev_wouldblock (void)
g_assert_cmpint (pipe (fd), ==, 0);
g_assert_cmpint (fcntl (fd[0], F_SETPIPE_SZ, 4096, NULL), !=, 0);
- pipe_capacity = fcntl (fd[0], F_GETPIPE_SZ, &pipe_capacity, NULL);
+ retval = fcntl (fd[0], F_GETPIPE_SZ);
+ g_assert_cmpint (retval, >=, 0);
+ pipe_capacity = (gsize) retval;
g_assert_cmpint (pipe_capacity, >=, 4096);
g_assert_cmpint (pipe_capacity % 1024, >=, 0);
@@ -667,8 +673,9 @@ test_write_async_wouldblock (void)
GUnixOutputStream *os;
gint fd[2];
guint8 *data, *data_read;
- guint i;
- gint pipe_capacity;
+ gsize i;
+ int retval;
+ gsize pipe_capacity;
gsize bytes_written = 0, bytes_read = 0;
g_assert_cmpint (pipe (fd), ==, 0);
@@ -685,7 +692,9 @@ test_write_async_wouldblock (void)
g_unix_set_fd_nonblocking (fd[1], TRUE, NULL);
g_assert_cmpint (fcntl (fd[0], F_SETPIPE_SZ, 4096, NULL), !=, 0);
- pipe_capacity = fcntl (fd[0], F_GETPIPE_SZ, &pipe_capacity, NULL);
+ retval = fcntl (fd[0], F_GETPIPE_SZ);
+ g_assert_cmpint (retval, >=, 0);
+ pipe_capacity = (gsize) retval;
g_assert_cmpint (pipe_capacity, >=, 4096);
data = g_new (guint8, 4 * pipe_capacity);
@@ -754,8 +763,9 @@ test_writev_async_wouldblock (void)
GUnixOutputStream *os;
gint fd[2];
guint8 *data, *data_read;
- guint i;
- gint pipe_capacity;
+ gsize i;
+ int retval;
+ gsize pipe_capacity;
gsize bytes_written = 0, bytes_read = 0;
GOutputVector vectors[4];
@@ -773,7 +783,9 @@ test_writev_async_wouldblock (void)
g_unix_set_fd_nonblocking (fd[1], TRUE, NULL);
g_assert_cmpint (fcntl (fd[0], F_SETPIPE_SZ, 4096, NULL), !=, 0);
- pipe_capacity = fcntl (fd[0], F_GETPIPE_SZ, &pipe_capacity, NULL);
+ retval = fcntl (fd[0], F_GETPIPE_SZ);
+ g_assert_cmpint (retval, >=, 0);
+ pipe_capacity = (gsize) retval;
g_assert_cmpint (pipe_capacity, >=, 4096);
data = g_new (guint8, 4 * pipe_capacity);
diff --git a/tests/gobject/defaultiface.c b/tests/gobject/defaultiface.c
index eccb79ced..92e45cefb 100644
--- a/tests/gobject/defaultiface.c
+++ b/tests/gobject/defaultiface.c
@@ -122,7 +122,12 @@ test_dynamic_iface_register (GTypeModule *module)
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) test_dynamic_iface_default_init,
- (GClassFinalizeFunc) test_dynamic_iface_default_finalize
+ (GClassFinalizeFunc) test_dynamic_iface_default_finalize,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ NULL
};
test_dynamic_iface_type = g_type_module_register_type (module, G_TYPE_INTERFACE,
diff --git a/tests/gobject/testcommon.h b/tests/gobject/testcommon.h
index a5b59b3d3..3e40cca67 100644
--- a/tests/gobject/testcommon.h
+++ b/tests/gobject/testcommon.h
@@ -40,7 +40,8 @@ prefix ## _get_type (void) \
NULL, /* class_data */ \
sizeof (name), \
0, /* n_prelocs */ \
- (GInstanceInitFunc) instance_init \
+ (GInstanceInitFunc) instance_init, \
+ (const GTypeValueTable *) NULL, \
}; \
\
object_type = g_type_register_static (parent_type, \
@@ -72,6 +73,12 @@ prefix ## _get_type (void) \
(GBaseInitFunc) base_init, \
(GBaseFinalizeFunc) NULL, \
(GClassInitFunc) dflt_init, \
+ (GClassFinalizeFunc) NULL, \
+ (gconstpointer) NULL, \
+ (guint16) 0, \
+ (guint16) 0, \
+ (GInstanceInitFunc) NULL, \
+ (const GTypeValueTable*) NULL, \
}; \
\
iface_type = g_type_register_static (G_TYPE_INTERFACE, \
diff --git a/tests/gobject/testgobject.c b/tests/gobject/testgobject.c
index df7d4c748..e467abcd4 100644
--- a/tests/gobject/testgobject.c
+++ b/tests/gobject/testgobject.c
@@ -50,6 +50,13 @@ test_iface_get_type (void)
sizeof (TestIfaceClass),
(GBaseInitFunc) iface_base_init, /* base_init */
(GBaseFinalizeFunc) iface_base_finalize, /* base_finalize */
+ NULL,
+ NULL,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ NULL
};
test_iface_type = g_type_register_static (G_TYPE_INTERFACE, "TestIface", &test_iface_info, 0);
@@ -178,7 +185,8 @@ test_object_get_type (void)
NULL, /* class_data */
sizeof (TestObject),
5, /* n_preallocs */
- (GInstanceInitFunc) test_object_init,
+ (GInstanceInitFunc) test_object_init,
+ NULL
};
GInterfaceInfo iface_info = { test_object_test_iface_init, NULL, GUINT_TO_POINTER (42) };
@@ -345,7 +353,8 @@ derived_object_get_type (void)
NULL, /* class_data */
sizeof (DerivedObject),
5, /* n_preallocs */
- (GInstanceInitFunc) derived_object_init,
+ (GInstanceInitFunc) derived_object_init,
+ NULL
};
GInterfaceInfo iface_info = { derived_object_test_iface_init, NULL, GUINT_TO_POINTER (87) };
diff --git a/tests/onceinit.c b/tests/onceinit.c
index 9788efcbd..4f30739ca 100644
--- a/tests/onceinit.c
+++ b/tests/onceinit.c
@@ -259,7 +259,7 @@ stress_concurrent_initializers (void *user_data)
LIST_256_TEST_INITIALIZERS (stress3),
LIST_256_TEST_INITIALIZERS (stress4),
};
- int i;
+ gsize i;
/* sync to main thread */
g_mutex_lock (&tmutex);
g_mutex_unlock (&tmutex);