diff --git a/gio/glib-compile-schemas.c b/gio/glib-compile-schemas.c index 7e1152f6b..83184e1e8 100644 --- a/gio/glib-compile-schemas.c +++ b/gio/glib-compile-schemas.c @@ -1038,7 +1038,7 @@ schema_state_add_override (SchemaState *state, GError **error) { SchemaState *parent; - KeyState *original; + KeyState *original = NULL; if (state->extends == NULL) { @@ -1386,14 +1386,14 @@ start_element (GMarkupParseContext *context, } else if (strcmp (element_name, "override") == 0) { - const gchar *name, *l10n, *context; + const gchar *name, *l10n, *str_context; - if (COLLECT (STRING, "name", &name, - OPTIONAL | STRING, "l10n", &l10n, - OPTIONAL | STRING, "context", &context)) + if (COLLECT (STRING, "name", &name, + OPTIONAL | STRING, "l10n", &l10n, + OPTIONAL | STRING, "context", &str_context)) schema_state_add_override (state->schema_state, &state->key_state, &state->string, - name, l10n, context, error); + name, l10n, str_context, error); return; } } @@ -1403,11 +1403,11 @@ start_element (GMarkupParseContext *context, { if (strcmp (element_name, "default") == 0) { - const gchar *l10n, *context; - if (COLLECT (STRING | OPTIONAL, "l10n", &l10n, - STRING | OPTIONAL, "context", &context)) + const gchar *l10n, *str_context; + if (COLLECT (STRING | OPTIONAL, "l10n", &l10n, + STRING | OPTIONAL, "context", &str_context)) state->string = key_state_start_default (state->key_state, - l10n, context, error); + l10n, str_context, error); return; } diff --git a/gio/glocalfilemonitor.c b/gio/glocalfilemonitor.c index 7e922561a..4f85fea52 100644 --- a/gio/glocalfilemonitor.c +++ b/gio/glocalfilemonitor.c @@ -406,7 +406,7 @@ g_file_monitor_source_handle_event (GFileMonitorSource *fms, g_assert (!other && rename_to); if (fms->flags & (G_FILE_MONITOR_WATCH_MOVES | G_FILE_MONITOR_SEND_MOVED)) { - GFile *other; + GFile *other_file; const gchar *dirname; gchar *allocated_dirname = NULL; GFileMonitorEvent event; @@ -421,11 +421,11 @@ g_file_monitor_source_handle_event (GFileMonitorSource *fms, dirname = allocated_dirname; } - other = g_local_file_new_from_dirname_and_basename (dirname, rename_to); + other_file = g_local_file_new_from_dirname_and_basename (dirname, rename_to); g_file_monitor_source_file_changes_done (fms, rename_to); - g_file_monitor_source_send_event (fms, event, child, other); + g_file_monitor_source_send_event (fms, event, child, other_file); - g_object_unref (other); + g_object_unref (other_file); g_free (allocated_dirname); } else diff --git a/gio/glocalfileoutputstream.c b/gio/glocalfileoutputstream.c index 71a992668..5d6a48840 100644 --- a/gio/glocalfileoutputstream.c +++ b/gio/glocalfileoutputstream.c @@ -855,7 +855,7 @@ handle_overwrite_open (const char *filename, int open_flags; int res; int mode; - int errsv; + int errsv = 0; gboolean replace_destination_set = (flags & G_FILE_CREATE_REPLACE_DESTINATION); mode = mode_from_flags_or_info (flags, reference_info); @@ -1179,7 +1179,7 @@ handle_overwrite_open (const char *filename, /* Seek back to the start of the file after the backup copy */ if (lseek (fd, 0, SEEK_SET) == -1) { - int errsv = errno; + errsv = errno; g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errsv), @@ -1195,7 +1195,7 @@ handle_overwrite_open (const char *filename, if (g_unlink (filename) != 0) { - int errsv = errno; + errsv = errno; g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errsv), @@ -1211,8 +1211,10 @@ handle_overwrite_open (const char *filename, fd = g_open (filename, open_flags, mode); if (fd == -1) { - int errsv = errno; - char *display_name = g_filename_display_name (filename); + char *display_name; + errsv = errno; + display_name = g_filename_display_name (filename); + g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errsv), _("Error opening file ā€œ%sā€: %s"), @@ -1230,7 +1232,7 @@ handle_overwrite_open (const char *filename, if (ftruncate (fd, 0) == -1) #endif { - int errsv = errno; + errsv = errno; g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errsv), diff --git a/gio/gnetworkservice.c b/gio/gnetworkservice.c index 2b8571e9b..f5ba9d848 100644 --- a/gio/gnetworkservice.c +++ b/gio/gnetworkservice.c @@ -445,7 +445,7 @@ g_network_service_address_enumerator_next (GSocketAddressEnumerator *enumerator { if (srv_enum->addr_enum == NULL && srv_enum->t) { - GError *error = NULL; + GError *my_error = NULL; gchar *uri; gchar *hostname; GSocketConnectable *addr; @@ -477,15 +477,15 @@ g_network_service_address_enumerator_next (GSocketAddressEnumerator *enumerator addr = g_network_address_parse_uri (uri, g_srv_target_get_port (target), - &error); + &my_error); g_free (uri); if (addr == NULL) { if (srv_enum->error == NULL) - srv_enum->error = error; + srv_enum->error = my_error; else - g_error_free (error); + g_error_free (my_error); continue; } @@ -498,18 +498,18 @@ g_network_service_address_enumerator_next (GSocketAddressEnumerator *enumerator if (srv_enum->addr_enum) { - GError *error = NULL; + GError *my_error = NULL; ret = g_socket_address_enumerator_next (srv_enum->addr_enum, cancellable, - &error); + &my_error); - if (error) + if (my_error) { if (srv_enum->error == NULL) - srv_enum->error = error; + srv_enum->error = my_error; else - g_error_free (error); + g_error_free (my_error); } if (!ret) diff --git a/gio/gregistrysettingsbackend.c b/gio/gregistrysettingsbackend.c index bae066a0a..a7171a21f 100644 --- a/gio/gregistrysettingsbackend.c +++ b/gio/gregistrysettingsbackend.c @@ -1200,7 +1200,7 @@ g_registry_backend_get_writable (GSettingsBackend *backend, GRegistryBackend *self = G_REGISTRY_BACKEND (backend); gchar *path_name; gunichar2 *path_namew; - gchar *value_name; + gchar *value_name = NULL; HKEY hpath; LONG result; @@ -1495,14 +1495,14 @@ registry_cache_update (GRegistryBackend *self, child_item->readable = TRUE; if (changed && event != NULL) { - gchar *item; + gchar *item_path; if (partial_key_name == NULL) - item = g_strdup (buffer); + item_path = g_strdup (buffer); else - item = g_build_path ("/", partial_key_name, buffer, NULL); + item_path = g_build_path ("/", partial_key_name, buffer, NULL); - g_ptr_array_add (event->items, item); + g_ptr_array_add (event->items, item_path); } g_free (buffer); diff --git a/gio/gresource-tool.c b/gio/gresource-tool.c index 8d738c280..7ebdddaf0 100644 --- a/gio/gresource-tool.c +++ b/gio/gresource-tool.c @@ -477,8 +477,8 @@ static gint cmd_help (gboolean requested, const gchar *command) { - const gchar *description; - const gchar *synopsis; + const gchar *description = NULL; + const gchar *synopsis = NULL; gchar *option; GString *string; diff --git a/gio/gresource.c b/gio/gresource.c index 53933f9d2..45ca92b1f 100644 --- a/gio/gresource.c +++ b/gio/gresource.c @@ -346,7 +346,7 @@ g_resource_find_overlay (const gchar *path, if (envvar != NULL) { gchar **parts; - gint i, j; + gint j; parts = g_strsplit (envvar, G_SEARCHPATH_SEPARATOR_S, 0); @@ -414,7 +414,7 @@ g_resource_find_overlay (const gchar *path, /* We go out of the way to avoid malloc() in the normal case * where the environment variable is not set. */ - static const gchar * const empty_strv[0 + 1]; + static const gchar *const empty_strv[0 + 1] = { 0 }; result = empty_strv; } diff --git a/gio/gresourcefile.c b/gio/gresourcefile.c index 429e9ef49..35dffebe9 100644 --- a/gio/gresourcefile.c +++ b/gio/gresourcefile.c @@ -447,8 +447,8 @@ g_resource_file_query_info (GFile *file, GFileInfo *info; GFileAttributeMatcher *matcher; gboolean res; - gsize size; - guint32 resource_flags; + gsize size = 0; + guint32 resource_flags = 0; char **children; gboolean is_dir; char *base; diff --git a/gio/gsettings-tool.c b/gio/gsettings-tool.c index 0c7763a39..9352b70f5 100644 --- a/gio/gsettings-tool.c +++ b/gio/gsettings-tool.c @@ -570,8 +570,8 @@ static int gsettings_help (gboolean requested, const gchar *command) { - const gchar *description; - const gchar *synopsis; + const gchar *description = NULL; + const gchar *synopsis = NULL; GString *string; string = g_string_new (NULL); diff --git a/gio/gsettings.c b/gio/gsettings.c index 00f8c16c8..21ae2ff10 100644 --- a/gio/gsettings.c +++ b/gio/gsettings.c @@ -406,12 +406,12 @@ g_settings_real_writable_change_event (GSettings *settings, for (i = 0; i < n_keys; i++) { - const gchar *key = g_quark_to_string (keys[i]); + const gchar *key_name = g_quark_to_string (keys[i]); - if (g_str_has_suffix (key, "/")) + if (g_str_has_suffix (key_name, "/")) continue; - g_signal_emit (settings, g_settings_signals[SIGNAL_WRITABLE_CHANGED], keys[i], key); + g_signal_emit (settings, g_settings_signals[SIGNAL_WRITABLE_CHANGED], keys[i], key_name); } return FALSE;