Merge branch 'fix_more_warnings' into 'master'

Fix more warnings

See merge request GNOME/glib!2063
This commit is contained in:
Sebastian Dröge 2021-04-29 10:58:34 +00:00
commit 8312f0b7cf
8 changed files with 62 additions and 27 deletions

View File

@ -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),

View File

@ -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

View File

@ -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),

View File

@ -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);

View File

@ -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,

View File

@ -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, \

View File

@ -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) };

View File

@ -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);