diff --git a/glib/guri.c b/glib/guri.c index 5c2b35b8a..069060809 100644 --- a/glib/guri.c +++ b/glib/guri.c @@ -422,7 +422,7 @@ _uri_encoder (GString *out, const gchar *reserved_chars_allowed, gboolean allow_utf8) { - static const gchar hex[16] = "0123456789ABCDEF"; + static const gchar hex[] = "0123456789ABCDEF"; const guchar *p = start; const guchar *end = p + length; diff --git a/glib/gutils.c b/glib/gutils.c index c6aec9e6f..457ae0955 100644 --- a/glib/gutils.c +++ b/glib/gutils.c @@ -957,7 +957,7 @@ g_get_host_name (void) if (g_once_init_enter (&hostname)) { gboolean failed; - gchar *utmp; + gchar *utmp = NULL; #ifndef G_OS_WIN32 gsize size; diff --git a/glib/gvariant-parser.c b/glib/gvariant-parser.c index bb5238bea..1b89259d3 100644 --- a/glib/gvariant-parser.c +++ b/glib/gvariant-parser.c @@ -1564,7 +1564,7 @@ unicode_unescape (const gchar *src, { gchar buffer[9]; guint64 value = 0; - gchar *end; + gchar *end = NULL; gsize n_valid_chars; (*src_ofs)++; diff --git a/glib/gwin32-private.c b/glib/gwin32-private.c index c28e92baa..68d4703b5 100644 --- a/glib/gwin32-private.c +++ b/glib/gwin32-private.c @@ -23,7 +23,7 @@ * than `e` or `p`. */ 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, const wchar_t *cmdline, DWORD pid, @@ -51,26 +51,26 @@ _g_win32_subst_pid_and_event_w (wchar_t *debugger, while (cmdline[i] != 0 && dbg_i < debugger_size) { if (cmdline[i] != L'%') - debugger[dbg_i++] = cmdline[i++]; + local_debugger[dbg_i++] = cmdline[i++]; else if (cmdline[i + 1] == L'p') { gsize j = 0; while (j < pid_str_len && dbg_i < debugger_size) - debugger[dbg_i++] = pid_str[j++]; + local_debugger[dbg_i++] = pid_str[j++]; i += 2; } else if (cmdline[i + 1] == L'e') { gsize j = 0; while (j < event_str_len && dbg_i < debugger_size) - debugger[dbg_i++] = event_str[j++]; + local_debugger[dbg_i++] = event_str[j++]; i += 2; } else return FALSE; } if (dbg_i < debugger_size) - debugger[dbg_i] = 0; + local_debugger[dbg_i] = 0; else return FALSE; diff --git a/gobject/gsignal.c b/gobject/gsignal.c index df6c3e39f..7fd4ee92f 100644 --- a/gobject/gsignal.c +++ b/gobject/gsignal.c @@ -2219,7 +2219,7 @@ g_signal_chain_from_overridden_handler (gpointer instance, GType chain_type = 0, restore_type = 0; Emission *emission = NULL; GClosure *closure = NULL; - SignalNode *node; + SignalNode *node = NULL; guint n_params = 0; g_return_if_fail (G_TYPE_CHECK_INSTANCE (instance)); @@ -3365,7 +3365,6 @@ g_signal_emit_valist (gpointer instance, SignalAccumulator *accumulator; Emission emission; GValue *return_accu, accu = G_VALUE_INIT; - guint signal_id; GType instance_type = G_TYPE_FROM_INSTANCE (instance); GValue emission_return = G_VALUE_INIT; 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) { - Emission *node = emission_find (signal_id, detail, instance); - - if (node) - { - node->state = EMISSION_RESTART; - SIGNAL_UNLOCK (); - return return_value_altered; - } + Emission *emission_node = emission_find (signal_id, detail, instance); + + if (emission_node) + { + emission_node->state = EMISSION_RESTART; + SIGNAL_UNLOCK (); + return return_value_altered; + } } accumulator = node->accumulator; if (accumulator) diff --git a/gobject/gtype.c b/gobject/gtype.c index 071429934..b19a306d9 100644 --- a/gobject/gtype.c +++ b/gobject/gtype.c @@ -2199,8 +2199,8 @@ type_class_init_Wm (TypeNode *node, 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 (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); diff --git a/gobject/tests/reference.c b/gobject/tests/reference.c index 7b12ac547..c7afc8abd 100644 --- a/gobject/tests/reference.c +++ b/gobject/tests/reference.c @@ -765,15 +765,15 @@ test_toggle_ref (void) g_object_remove_toggle_ref (obj, toggle_notify, &c); } -static gboolean destroyed; -static gint value; +static gboolean global_destroyed; +static gint global_value; static void 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 @@ -785,39 +785,39 @@ test_object_qdata (void) obj = g_object_new (G_TYPE_OBJECT, NULL); - value = 1; - destroyed = FALSE; + global_value = 1; + global_destroyed = FALSE; g_object_set_data_full (obj, "test", GINT_TO_POINTER (1), data_destroy); v = g_object_get_data (obj, "test"); g_assert_cmpint (GPOINTER_TO_INT (v), ==, 1); g_object_set_data_full (obj, "test", GINT_TO_POINTER (2), data_destroy); - g_assert (destroyed); - value = 2; - destroyed = FALSE; + g_assert (global_destroyed); + global_value = 2; + global_destroyed = FALSE; v = g_object_steal_data (obj, "test"); g_assert_cmpint (GPOINTER_TO_INT (v), ==, 2); - g_assert (!destroyed); + g_assert (!global_destroyed); - value = 1; - destroyed = FALSE; + global_value = 1; + global_destroyed = FALSE; quark = g_quark_from_string ("test"); g_object_set_qdata_full (obj, quark, GINT_TO_POINTER (1), data_destroy); v = g_object_get_qdata (obj, quark); g_assert_cmpint (GPOINTER_TO_INT (v), ==, 1); g_object_set_qdata_full (obj, quark, GINT_TO_POINTER (2), data_destroy); - g_assert (destroyed); - value = 2; - destroyed = FALSE; + g_assert (global_destroyed); + global_value = 2; + global_destroyed = FALSE; v = g_object_steal_qdata (obj, quark); 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); - value = 3; - destroyed = FALSE; + global_value = 3; + global_destroyed = FALSE; g_object_unref (obj); - g_assert (destroyed); + g_assert (global_destroyed); } typedef struct { diff --git a/tests/gio-test.c b/tests/gio-test.c index 6c40632b3..d203d0b27 100644 --- a/tests/gio-test.c +++ b/tests/gio-test.c @@ -128,7 +128,7 @@ recv_message (GIOChannel *channel, if (cond & G_IO_IN) { char buf[BUFSIZE]; - guint nbytes; + guint nbytes = 0; guint nb; guint j; int i, seq; @@ -297,7 +297,7 @@ main (int argc, 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); #endif diff --git a/tests/mapping-test.c b/tests/mapping-test.c index ad776fad1..d4547deba 100644 --- a/tests/mapping-test.c +++ b/tests/mapping-test.c @@ -29,7 +29,7 @@ #include #endif -static gchar *dir, *filename, *displayname, *childname; +static gchar *dir, *global_filename, *global_displayname, *childname; static gboolean stop = FALSE; @@ -113,7 +113,7 @@ child_main (int argc, char *argv[]) GMainLoop *loop; parent_pid = atoi (argv[2]); - map = map_or_die (filename, FALSE); + map = map_or_die (global_filename, FALSE); #ifndef G_OS_WIN32 signal (SIGUSR1, handle_usr1); @@ -139,13 +139,13 @@ test_mapping (void) { 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_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_mapped_file_free (map); g_message ("test_mapping: ok"); @@ -159,8 +159,8 @@ test_private (void) gchar *buffer; gsize len; - write_or_die (filename, "ABC", -1); - map = map_or_die (filename, TRUE); + write_or_die (global_filename, "ABC", -1); + map = map_or_die (global_filename, TRUE); buffer = (gchar *)g_mapped_file_get_contents (map); buffer[0] = '1'; @@ -168,10 +168,10 @@ test_private (void) buffer[2] = '3'; 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", - displayname, error->message); + g_print ("failed to read '%s': %s\n", + global_displayname, error->message); exit (1); } @@ -201,8 +201,8 @@ test_child_private (gchar *argv0) g_assert (!g_file_test ("STOP", G_FILE_TEST_EXISTS)); #endif - write_or_die (filename, "ABC", -1); - map = map_or_die (filename, TRUE); + write_or_die (global_filename, "ABC", -1); + map = map_or_die (global_filename, TRUE); #ifndef G_OS_WIN32 signal (SIGUSR1, handle_usr1); @@ -303,8 +303,8 @@ main (int argc, #endif dir = g_get_current_dir (); - filename = g_build_filename (dir, "maptest", NULL); - displayname = g_filename_display_name (filename); + global_filename = g_build_filename (dir, "maptest", NULL); + global_displayname = g_filename_display_name (global_filename); childname = g_build_filename (dir, "mapchild", NULL); if (argc > 1) @@ -313,8 +313,8 @@ main (int argc, ret = parent_main (argc, argv); g_free (childname); - g_free (filename); - g_free (displayname); + g_free (global_filename); + g_free (global_displayname); g_free (dir); return ret;