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

Cleanup warnings split 6

See merge request GNOME/glib!2495
This commit is contained in:
Philip Withnall 2022-03-17 15:13:14 +00:00
commit 96279325b7
10 changed files with 47 additions and 45 deletions

View File

@ -1038,7 +1038,7 @@ schema_state_add_override (SchemaState *state,
GError **error) GError **error)
{ {
SchemaState *parent; SchemaState *parent;
KeyState *original; KeyState *original = NULL;
if (state->extends == NULL) if (state->extends == NULL)
{ {
@ -1386,14 +1386,14 @@ start_element (GMarkupParseContext *context,
} }
else if (strcmp (element_name, "override") == 0) else if (strcmp (element_name, "override") == 0)
{ {
const gchar *name, *l10n, *context; const gchar *name, *l10n, *str_context;
if (COLLECT (STRING, "name", &name, if (COLLECT (STRING, "name", &name,
OPTIONAL | STRING, "l10n", &l10n, OPTIONAL | STRING, "l10n", &l10n,
OPTIONAL | STRING, "context", &context)) OPTIONAL | STRING, "context", &str_context))
schema_state_add_override (state->schema_state, schema_state_add_override (state->schema_state,
&state->key_state, &state->string, &state->key_state, &state->string,
name, l10n, context, error); name, l10n, str_context, error);
return; return;
} }
} }
@ -1403,11 +1403,11 @@ start_element (GMarkupParseContext *context,
{ {
if (strcmp (element_name, "default") == 0) if (strcmp (element_name, "default") == 0)
{ {
const gchar *l10n, *context; const gchar *l10n, *str_context;
if (COLLECT (STRING | OPTIONAL, "l10n", &l10n, if (COLLECT (STRING | OPTIONAL, "l10n", &l10n,
STRING | OPTIONAL, "context", &context)) STRING | OPTIONAL, "context", &str_context))
state->string = key_state_start_default (state->key_state, state->string = key_state_start_default (state->key_state,
l10n, context, error); l10n, str_context, error);
return; return;
} }

View File

@ -406,7 +406,7 @@ g_file_monitor_source_handle_event (GFileMonitorSource *fms,
g_assert (!other && rename_to); g_assert (!other && rename_to);
if (fms->flags & (G_FILE_MONITOR_WATCH_MOVES | G_FILE_MONITOR_SEND_MOVED)) if (fms->flags & (G_FILE_MONITOR_WATCH_MOVES | G_FILE_MONITOR_SEND_MOVED))
{ {
GFile *other; GFile *other_file;
const gchar *dirname; const gchar *dirname;
gchar *allocated_dirname = NULL; gchar *allocated_dirname = NULL;
GFileMonitorEvent event; GFileMonitorEvent event;
@ -421,11 +421,11 @@ g_file_monitor_source_handle_event (GFileMonitorSource *fms,
dirname = allocated_dirname; 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_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); g_free (allocated_dirname);
} }
else else

View File

@ -855,7 +855,7 @@ handle_overwrite_open (const char *filename,
int open_flags; int open_flags;
int res; int res;
int mode; int mode;
int errsv; int errsv = 0;
gboolean replace_destination_set = (flags & G_FILE_CREATE_REPLACE_DESTINATION); gboolean replace_destination_set = (flags & G_FILE_CREATE_REPLACE_DESTINATION);
mode = mode_from_flags_or_info (flags, reference_info); 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 */ /* Seek back to the start of the file after the backup copy */
if (lseek (fd, 0, SEEK_SET) == -1) if (lseek (fd, 0, SEEK_SET) == -1)
{ {
int errsv = errno; errsv = errno;
g_set_error (error, G_IO_ERROR, g_set_error (error, G_IO_ERROR,
g_io_error_from_errno (errsv), g_io_error_from_errno (errsv),
@ -1195,7 +1195,7 @@ handle_overwrite_open (const char *filename,
if (g_unlink (filename) != 0) if (g_unlink (filename) != 0)
{ {
int errsv = errno; errsv = errno;
g_set_error (error, G_IO_ERROR, g_set_error (error, G_IO_ERROR,
g_io_error_from_errno (errsv), g_io_error_from_errno (errsv),
@ -1211,8 +1211,10 @@ handle_overwrite_open (const char *filename,
fd = g_open (filename, open_flags, mode); fd = g_open (filename, open_flags, mode);
if (fd == -1) if (fd == -1)
{ {
int errsv = errno; char *display_name;
char *display_name = g_filename_display_name (filename); errsv = errno;
display_name = g_filename_display_name (filename);
g_set_error (error, G_IO_ERROR, g_set_error (error, G_IO_ERROR,
g_io_error_from_errno (errsv), g_io_error_from_errno (errsv),
_("Error opening file “%s”: %s"), _("Error opening file “%s”: %s"),
@ -1230,7 +1232,7 @@ handle_overwrite_open (const char *filename,
if (ftruncate (fd, 0) == -1) if (ftruncate (fd, 0) == -1)
#endif #endif
{ {
int errsv = errno; errsv = errno;
g_set_error (error, G_IO_ERROR, g_set_error (error, G_IO_ERROR,
g_io_error_from_errno (errsv), g_io_error_from_errno (errsv),

View File

@ -445,7 +445,7 @@ g_network_service_address_enumerator_next (GSocketAddressEnumerator *enumerator
{ {
if (srv_enum->addr_enum == NULL && srv_enum->t) if (srv_enum->addr_enum == NULL && srv_enum->t)
{ {
GError *error = NULL; GError *my_error = NULL;
gchar *uri; gchar *uri;
gchar *hostname; gchar *hostname;
GSocketConnectable *addr; GSocketConnectable *addr;
@ -477,15 +477,15 @@ g_network_service_address_enumerator_next (GSocketAddressEnumerator *enumerator
addr = g_network_address_parse_uri (uri, addr = g_network_address_parse_uri (uri,
g_srv_target_get_port (target), g_srv_target_get_port (target),
&error); &my_error);
g_free (uri); g_free (uri);
if (addr == NULL) if (addr == NULL)
{ {
if (srv_enum->error == NULL) if (srv_enum->error == NULL)
srv_enum->error = error; srv_enum->error = my_error;
else else
g_error_free (error); g_error_free (my_error);
continue; continue;
} }
@ -498,18 +498,18 @@ g_network_service_address_enumerator_next (GSocketAddressEnumerator *enumerator
if (srv_enum->addr_enum) if (srv_enum->addr_enum)
{ {
GError *error = NULL; GError *my_error = NULL;
ret = g_socket_address_enumerator_next (srv_enum->addr_enum, ret = g_socket_address_enumerator_next (srv_enum->addr_enum,
cancellable, cancellable,
&error); &my_error);
if (error) if (my_error)
{ {
if (srv_enum->error == NULL) if (srv_enum->error == NULL)
srv_enum->error = error; srv_enum->error = my_error;
else else
g_error_free (error); g_error_free (my_error);
} }
if (!ret) if (!ret)

View File

@ -1200,7 +1200,7 @@ g_registry_backend_get_writable (GSettingsBackend *backend,
GRegistryBackend *self = G_REGISTRY_BACKEND (backend); GRegistryBackend *self = G_REGISTRY_BACKEND (backend);
gchar *path_name; gchar *path_name;
gunichar2 *path_namew; gunichar2 *path_namew;
gchar *value_name; gchar *value_name = NULL;
HKEY hpath; HKEY hpath;
LONG result; LONG result;
@ -1495,14 +1495,14 @@ registry_cache_update (GRegistryBackend *self,
child_item->readable = TRUE; child_item->readable = TRUE;
if (changed && event != NULL) if (changed && event != NULL)
{ {
gchar *item; gchar *item_path;
if (partial_key_name == NULL) if (partial_key_name == NULL)
item = g_strdup (buffer); item_path = g_strdup (buffer);
else 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); g_free (buffer);

View File

@ -477,8 +477,8 @@ static gint
cmd_help (gboolean requested, cmd_help (gboolean requested,
const gchar *command) const gchar *command)
{ {
const gchar *description; const gchar *description = NULL;
const gchar *synopsis; const gchar *synopsis = NULL;
gchar *option; gchar *option;
GString *string; GString *string;

View File

@ -346,7 +346,7 @@ g_resource_find_overlay (const gchar *path,
if (envvar != NULL) if (envvar != NULL)
{ {
gchar **parts; gchar **parts;
gint i, j; gint j;
parts = g_strsplit (envvar, G_SEARCHPATH_SEPARATOR_S, 0); 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 /* We go out of the way to avoid malloc() in the normal case
* where the environment variable is not set. * 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; result = empty_strv;
} }

View File

@ -447,8 +447,8 @@ g_resource_file_query_info (GFile *file,
GFileInfo *info; GFileInfo *info;
GFileAttributeMatcher *matcher; GFileAttributeMatcher *matcher;
gboolean res; gboolean res;
gsize size; gsize size = 0;
guint32 resource_flags; guint32 resource_flags = 0;
char **children; char **children;
gboolean is_dir; gboolean is_dir;
char *base; char *base;

View File

@ -570,8 +570,8 @@ static int
gsettings_help (gboolean requested, gsettings_help (gboolean requested,
const gchar *command) const gchar *command)
{ {
const gchar *description; const gchar *description = NULL;
const gchar *synopsis; const gchar *synopsis = NULL;
GString *string; GString *string;
string = g_string_new (NULL); string = g_string_new (NULL);

View File

@ -406,12 +406,12 @@ g_settings_real_writable_change_event (GSettings *settings,
for (i = 0; i < n_keys; i++) 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; 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; return FALSE;