Merge branch 'cleanup-warnings-split-2' into 'main'

Cleanup warnings split 2

See merge request GNOME/glib!2491
This commit is contained in:
Philip Withnall 2022-02-18 13:39:25 +00:00
commit 5ac86e21b3
9 changed files with 56 additions and 57 deletions

View File

@ -422,7 +422,7 @@ _uri_encoder (GString *out,
const gchar *reserved_chars_allowed, const gchar *reserved_chars_allowed,
gboolean allow_utf8) gboolean allow_utf8)
{ {
static const gchar hex[16] = "0123456789ABCDEF"; static const gchar hex[] = "0123456789ABCDEF";
const guchar *p = start; const guchar *p = start;
const guchar *end = p + length; const guchar *end = p + length;

View File

@ -957,7 +957,7 @@ g_get_host_name (void)
if (g_once_init_enter (&hostname)) if (g_once_init_enter (&hostname))
{ {
gboolean failed; gboolean failed;
gchar *utmp; gchar *utmp = NULL;
#ifndef G_OS_WIN32 #ifndef G_OS_WIN32
gsize size; gsize size;

View File

@ -1564,7 +1564,7 @@ unicode_unescape (const gchar *src,
{ {
gchar buffer[9]; gchar buffer[9];
guint64 value = 0; guint64 value = 0;
gchar *end; gchar *end = NULL;
gsize n_valid_chars; gsize n_valid_chars;
(*src_ofs)++; (*src_ofs)++;

View File

@ -23,7 +23,7 @@
* than `e` or `p`. * than `e` or `p`.
*/ */
static gboolean static gboolean
_g_win32_subst_pid_and_event_w (wchar_t *debugger, _g_win32_subst_pid_and_event_w (wchar_t *local_debugger,
gsize debugger_size, gsize debugger_size,
const wchar_t *cmdline, const wchar_t *cmdline,
DWORD pid, DWORD pid,
@ -51,26 +51,26 @@ _g_win32_subst_pid_and_event_w (wchar_t *debugger,
while (cmdline[i] != 0 && dbg_i < debugger_size) while (cmdline[i] != 0 && dbg_i < debugger_size)
{ {
if (cmdline[i] != L'%') if (cmdline[i] != L'%')
debugger[dbg_i++] = cmdline[i++]; local_debugger[dbg_i++] = cmdline[i++];
else if (cmdline[i + 1] == L'p') else if (cmdline[i + 1] == L'p')
{ {
gsize j = 0; gsize j = 0;
while (j < pid_str_len && dbg_i < debugger_size) while (j < pid_str_len && dbg_i < debugger_size)
debugger[dbg_i++] = pid_str[j++]; local_debugger[dbg_i++] = pid_str[j++];
i += 2; i += 2;
} }
else if (cmdline[i + 1] == L'e') else if (cmdline[i + 1] == L'e')
{ {
gsize j = 0; gsize j = 0;
while (j < event_str_len && dbg_i < debugger_size) while (j < event_str_len && dbg_i < debugger_size)
debugger[dbg_i++] = event_str[j++]; local_debugger[dbg_i++] = event_str[j++];
i += 2; i += 2;
} }
else else
return FALSE; return FALSE;
} }
if (dbg_i < debugger_size) if (dbg_i < debugger_size)
debugger[dbg_i] = 0; local_debugger[dbg_i] = 0;
else else
return FALSE; return FALSE;

View File

@ -2219,7 +2219,7 @@ g_signal_chain_from_overridden_handler (gpointer instance,
GType chain_type = 0, restore_type = 0; GType chain_type = 0, restore_type = 0;
Emission *emission = NULL; Emission *emission = NULL;
GClosure *closure = NULL; GClosure *closure = NULL;
SignalNode *node; SignalNode *node = NULL;
guint n_params = 0; guint n_params = 0;
g_return_if_fail (G_TYPE_CHECK_INSTANCE (instance)); g_return_if_fail (G_TYPE_CHECK_INSTANCE (instance));
@ -3365,7 +3365,6 @@ g_signal_emit_valist (gpointer instance,
SignalAccumulator *accumulator; SignalAccumulator *accumulator;
Emission emission; Emission emission;
GValue *return_accu, accu = G_VALUE_INIT; GValue *return_accu, accu = G_VALUE_INIT;
guint signal_id;
GType instance_type = G_TYPE_FROM_INSTANCE (instance); GType instance_type = G_TYPE_FROM_INSTANCE (instance);
GValue emission_return = G_VALUE_INIT; GValue emission_return = G_VALUE_INIT;
GType rtype = node->return_type & ~G_SIGNAL_TYPE_STATIC_SCOPE; GType rtype = node->return_type & ~G_SIGNAL_TYPE_STATIC_SCOPE;
@ -3625,14 +3624,14 @@ signal_emit_unlocked_R (SignalNode *node,
if (node->flags & G_SIGNAL_NO_RECURSE) if (node->flags & G_SIGNAL_NO_RECURSE)
{ {
Emission *node = emission_find (signal_id, detail, instance); Emission *emission_node = emission_find (signal_id, detail, instance);
if (node) if (emission_node)
{ {
node->state = EMISSION_RESTART; emission_node->state = EMISSION_RESTART;
SIGNAL_UNLOCK (); SIGNAL_UNLOCK ();
return return_value_altered; return return_value_altered;
} }
} }
accumulator = node->accumulator; accumulator = node->accumulator;
if (accumulator) if (accumulator)

View File

@ -2199,8 +2199,8 @@ type_class_init_Wm (TypeNode *node,
if (pclass) if (pclass)
{ {
TypeNode *pnode = lookup_type_node_I (pclass->g_type); pnode = lookup_type_node_I (pclass->g_type);
memcpy (class, pclass, pnode->data->class.class_size); memcpy (class, pclass, pnode->data->class.class_size);
memcpy (G_STRUCT_MEMBER_P (class, ALIGN_STRUCT (node->data->class.class_size)), G_STRUCT_MEMBER_P (pclass, ALIGN_STRUCT (pnode->data->class.class_size)), pnode->data->class.class_private_size); memcpy (G_STRUCT_MEMBER_P (class, ALIGN_STRUCT (node->data->class.class_size)), G_STRUCT_MEMBER_P (pclass, ALIGN_STRUCT (pnode->data->class.class_size)), pnode->data->class.class_private_size);

View File

@ -765,15 +765,15 @@ test_toggle_ref (void)
g_object_remove_toggle_ref (obj, toggle_notify, &c); g_object_remove_toggle_ref (obj, toggle_notify, &c);
} }
static gboolean destroyed; static gboolean global_destroyed;
static gint value; static gint global_value;
static void static void
data_destroy (gpointer data) data_destroy (gpointer data)
{ {
g_assert_cmpint (GPOINTER_TO_INT (data), ==, value); g_assert_cmpint (GPOINTER_TO_INT (data), ==, global_value);
destroyed = TRUE; global_destroyed = TRUE;
} }
static void static void
@ -785,39 +785,39 @@ test_object_qdata (void)
obj = g_object_new (G_TYPE_OBJECT, NULL); obj = g_object_new (G_TYPE_OBJECT, NULL);
value = 1; global_value = 1;
destroyed = FALSE; global_destroyed = FALSE;
g_object_set_data_full (obj, "test", GINT_TO_POINTER (1), data_destroy); g_object_set_data_full (obj, "test", GINT_TO_POINTER (1), data_destroy);
v = g_object_get_data (obj, "test"); v = g_object_get_data (obj, "test");
g_assert_cmpint (GPOINTER_TO_INT (v), ==, 1); g_assert_cmpint (GPOINTER_TO_INT (v), ==, 1);
g_object_set_data_full (obj, "test", GINT_TO_POINTER (2), data_destroy); g_object_set_data_full (obj, "test", GINT_TO_POINTER (2), data_destroy);
g_assert (destroyed); g_assert (global_destroyed);
value = 2; global_value = 2;
destroyed = FALSE; global_destroyed = FALSE;
v = g_object_steal_data (obj, "test"); v = g_object_steal_data (obj, "test");
g_assert_cmpint (GPOINTER_TO_INT (v), ==, 2); g_assert_cmpint (GPOINTER_TO_INT (v), ==, 2);
g_assert (!destroyed); g_assert (!global_destroyed);
value = 1; global_value = 1;
destroyed = FALSE; global_destroyed = FALSE;
quark = g_quark_from_string ("test"); quark = g_quark_from_string ("test");
g_object_set_qdata_full (obj, quark, GINT_TO_POINTER (1), data_destroy); g_object_set_qdata_full (obj, quark, GINT_TO_POINTER (1), data_destroy);
v = g_object_get_qdata (obj, quark); v = g_object_get_qdata (obj, quark);
g_assert_cmpint (GPOINTER_TO_INT (v), ==, 1); g_assert_cmpint (GPOINTER_TO_INT (v), ==, 1);
g_object_set_qdata_full (obj, quark, GINT_TO_POINTER (2), data_destroy); g_object_set_qdata_full (obj, quark, GINT_TO_POINTER (2), data_destroy);
g_assert (destroyed); g_assert (global_destroyed);
value = 2; global_value = 2;
destroyed = FALSE; global_destroyed = FALSE;
v = g_object_steal_qdata (obj, quark); v = g_object_steal_qdata (obj, quark);
g_assert_cmpint (GPOINTER_TO_INT (v), ==, 2); g_assert_cmpint (GPOINTER_TO_INT (v), ==, 2);
g_assert (!destroyed); g_assert (!global_destroyed);
g_object_set_qdata_full (obj, quark, GINT_TO_POINTER (3), data_destroy); g_object_set_qdata_full (obj, quark, GINT_TO_POINTER (3), data_destroy);
value = 3; global_value = 3;
destroyed = FALSE; global_destroyed = FALSE;
g_object_unref (obj); g_object_unref (obj);
g_assert (destroyed); g_assert (global_destroyed);
} }
typedef struct { typedef struct {

View File

@ -128,7 +128,7 @@ recv_message (GIOChannel *channel,
if (cond & G_IO_IN) if (cond & G_IO_IN)
{ {
char buf[BUFSIZE]; char buf[BUFSIZE];
guint nbytes; guint nbytes = 0;
guint nb; guint nb;
guint j; guint j;
int i, seq; int i, seq;
@ -297,7 +297,7 @@ main (int argc,
exit (1); exit (1);
} }
windows_messages_channel = g_io_channel_win32_new_messages ((guint)hwnd); windows_messages_channel = g_io_channel_win32_new_messages ((guint) (guintptr) hwnd);
g_io_add_watch (windows_messages_channel, G_IO_IN, recv_windows_message, 0); g_io_add_watch (windows_messages_channel, G_IO_IN, recv_windows_message, 0);
#endif #endif

View File

@ -29,7 +29,7 @@
#include <process.h> #include <process.h>
#endif #endif
static gchar *dir, *filename, *displayname, *childname; static gchar *dir, *global_filename, *global_displayname, *childname;
static gboolean stop = FALSE; static gboolean stop = FALSE;
@ -113,7 +113,7 @@ child_main (int argc, char *argv[])
GMainLoop *loop; GMainLoop *loop;
parent_pid = atoi (argv[2]); parent_pid = atoi (argv[2]);
map = map_or_die (filename, FALSE); map = map_or_die (global_filename, FALSE);
#ifndef G_OS_WIN32 #ifndef G_OS_WIN32
signal (SIGUSR1, handle_usr1); signal (SIGUSR1, handle_usr1);
@ -139,13 +139,13 @@ test_mapping (void)
{ {
GMappedFile *map; GMappedFile *map;
write_or_die (filename, "ABC", -1); write_or_die (global_filename, "ABC", -1);
map = map_or_die (filename, FALSE); map = map_or_die (global_filename, FALSE);
g_assert (g_mapped_file_get_length (map) == 3); g_assert (g_mapped_file_get_length (map) == 3);
g_mapped_file_free (map); g_mapped_file_free (map);
map = map_or_die (filename, TRUE); map = map_or_die (global_filename, TRUE);
g_assert (g_mapped_file_get_length (map) == 3); g_assert (g_mapped_file_get_length (map) == 3);
g_mapped_file_free (map); g_mapped_file_free (map);
g_message ("test_mapping: ok"); g_message ("test_mapping: ok");
@ -159,8 +159,8 @@ test_private (void)
gchar *buffer; gchar *buffer;
gsize len; gsize len;
write_or_die (filename, "ABC", -1); write_or_die (global_filename, "ABC", -1);
map = map_or_die (filename, TRUE); map = map_or_die (global_filename, TRUE);
buffer = (gchar *)g_mapped_file_get_contents (map); buffer = (gchar *)g_mapped_file_get_contents (map);
buffer[0] = '1'; buffer[0] = '1';
@ -168,10 +168,10 @@ test_private (void)
buffer[2] = '3'; buffer[2] = '3';
g_mapped_file_free (map); g_mapped_file_free (map);
if (!g_file_get_contents (filename, &buffer, &len, &error)) if (!g_file_get_contents (global_filename, &buffer, &len, &error))
{ {
g_print ("failed to read '%s': %s\n", g_print ("failed to read '%s': %s\n",
displayname, error->message); global_displayname, error->message);
exit (1); exit (1);
} }
@ -201,8 +201,8 @@ test_child_private (gchar *argv0)
g_assert (!g_file_test ("STOP", G_FILE_TEST_EXISTS)); g_assert (!g_file_test ("STOP", G_FILE_TEST_EXISTS));
#endif #endif
write_or_die (filename, "ABC", -1); write_or_die (global_filename, "ABC", -1);
map = map_or_die (filename, TRUE); map = map_or_die (global_filename, TRUE);
#ifndef G_OS_WIN32 #ifndef G_OS_WIN32
signal (SIGUSR1, handle_usr1); signal (SIGUSR1, handle_usr1);
@ -303,8 +303,8 @@ main (int argc,
#endif #endif
dir = g_get_current_dir (); dir = g_get_current_dir ();
filename = g_build_filename (dir, "maptest", NULL); global_filename = g_build_filename (dir, "maptest", NULL);
displayname = g_filename_display_name (filename); global_displayname = g_filename_display_name (global_filename);
childname = g_build_filename (dir, "mapchild", NULL); childname = g_build_filename (dir, "mapchild", NULL);
if (argc > 1) if (argc > 1)
@ -313,8 +313,8 @@ main (int argc,
ret = parent_main (argc, argv); ret = parent_main (argc, argv);
g_free (childname); g_free (childname);
g_free (filename); g_free (global_filename);
g_free (displayname); g_free (global_displayname);
g_free (dir); g_free (dir);
return ret; return ret;