[file-roller/wip/jtojnar/engrampa-backports: 23/24] Missing initializer for struct field
- From: Jan Tojnar <jtojnar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [file-roller/wip/jtojnar/engrampa-backports: 23/24] Missing initializer for struct field
- Date: Wed, 27 Jul 2022 19:54:33 +0000 (UTC)
commit 32cf78edbdbb574d67110d24c02b939ebbd7c0dd
Author: Jan Tojnar <jtojnar gmail com>
Date: Sat Aug 31 15:53:11 2019 +0200
Missing initializer for struct field
Fix warnings caused by -Wmissing-field-initializers
Designated initializers will NULL all the other fields.
Inspired by https://github.com/mate-desktop/engrampa/commit/3022fd87f4360dcd8458be65e468e065cbc1e8a5
meson.build | 3 +-
nautilus/nautilus-fileroller.c | 18 ++---
src/commands/rpm2cpio.c | 5 +-
src/dlg-add.c | 15 +++-
src/fr-application-menu.c | 38 ++++++++--
src/fr-application.c | 10 ++-
src/fr-file-selector-dialog.c | 17 ++++-
src/fr-window-actions-entries.h | 160 ++++++++++++++++++++++++++++++++--------
8 files changed, 205 insertions(+), 61 deletions(-)
---
diff --git a/meson.build b/meson.build
index 5d977307..d6b95f61 100644
--- a/meson.build
+++ b/meson.build
@@ -121,7 +121,8 @@ if get_option('buildtype').contains('debug')
'-Wnested-externs',
'-Wpointer-arith',
'-Wsign-compare',
- '-Wformat-security'
+ '-Wformat-security',
+ '-Wmissing-field-initializers',
]
else
c_args += [ '-Wno-deprecated-declarations' ]
diff --git a/nautilus/nautilus-fileroller.c b/nautilus/nautilus-fileroller.c
index bed8fc72..18d7d151 100644
--- a/nautilus/nautilus-fileroller.c
+++ b/nautilus/nautilus-fileroller.c
@@ -326,15 +326,15 @@ void
nautilus_fr_register_type (GTypeModule *module)
{
static const GTypeInfo info = {
- sizeof (NautilusFrClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) nautilus_fr_class_init,
- NULL,
- NULL,
- sizeof (NautilusFr),
- 0,
- (GInstanceInitFunc) nautilus_fr_instance_init,
+ .class_size = sizeof (NautilusFrClass),
+ .base_init = (GBaseInitFunc) NULL,
+ .base_finalize = (GBaseFinalizeFunc) NULL,
+ .class_init = (GClassInitFunc) nautilus_fr_class_init,
+ .class_finalize = NULL,
+ .class_data = NULL,
+ .instance_size = sizeof (NautilusFr),
+ .n_preallocs = 0,
+ .instance_init = (GInstanceInitFunc) nautilus_fr_instance_init,
};
static const GInterfaceInfo menu_provider_interface_info = {
diff --git a/src/commands/rpm2cpio.c b/src/commands/rpm2cpio.c
index f52406c1..930eb6be 100644
--- a/src/commands/rpm2cpio.c
+++ b/src/commands/rpm2cpio.c
@@ -38,17 +38,16 @@ get_mime_type_from_magic_numbers (char *buffer)
{ "application/x-bzip2", "BZh", 0, 3 },
{ "application/x-gzip", "\037\213", 0, 2 },
{ "application/x-xz", "\3757zXZ\000", 0, 6 },
- { NULL, NULL, 0 }
};
- int i;
- for (i = 0; sniffer_data[i].mime_type != NULL; i++)
+ for (size_t i = 0; i < G_N_ELEMENTS (sniffer_data); i++) {
if (memcmp (sniffer_data[i].first_bytes,
buffer + sniffer_data[i].offset,
sniffer_data[i].len) == 0)
{
return sniffer_data[i].mime_type;
}
+ }
return NULL;
}
diff --git a/src/dlg-add.c b/src/dlg-add.c
index 1c54d96c..dff13b0e 100644
--- a/src/dlg-add.c
+++ b/src/dlg-add.c
@@ -154,9 +154,18 @@ static void dlg_add_folder_load_last_options (DialogData *data);
static GActionEntry dlg_entries[] = {
- { "load-options", load_options_activate_cb, NULL, NULL, NULL },
- { "save-options", save_options_activate_cb, NULL, NULL, NULL },
- { "clear-options", clear_options_activate_cb, NULL, NULL, NULL }
+ {
+ .name = "load-options",
+ .activate = load_options_activate_cb,
+ },
+ {
+ .name = "save-options",
+ .activate = save_options_activate_cb,
+ },
+ {
+ .name = "clear-options",
+ .activate = clear_options_activate_cb,
+ },
};
diff --git a/src/fr-application-menu.c b/src/fr-application-menu.c
index a2756d5b..d7a61593 100644
--- a/src/fr-application-menu.c
+++ b/src/fr-application-menu.c
@@ -150,13 +150,37 @@ fr_application_activate_quit (GSimpleAction *action,
static const GActionEntry app_menu_entries[] = {
- { "new", fr_application_activate_new },
- { "open", fr_application_activate_open },
- { PREF_UI_VIEW_SIDEBAR, toggle_action_activated, NULL, "true", fr_application_activate_view_sidebar },
- { PREF_LISTING_LIST_MODE, fr_application_activate_list_mode, "s", "'as-dir'", NULL },
- { "help", fr_application_activate_help },
- { "about", fr_application_activate_about },
- { "quit", fr_application_activate_quit }
+ {
+ .name = "new",
+ .activate = fr_application_activate_new,
+ },
+ {
+ .name = "open",
+ .activate = fr_application_activate_open,
+ },
+ {
+ .name = PREF_UI_VIEW_SIDEBAR,
+ .activate = toggle_action_activated,
+ .state = "true",
+ .change_state = fr_application_activate_view_sidebar },
+ {
+ .name = PREF_LISTING_LIST_MODE,
+ .activate = fr_application_activate_list_mode,
+ .parameter_type = "s",
+ .state = "'as-dir'",
+ },
+ {
+ .name = "help",
+ .activate = fr_application_activate_help,
+ },
+ {
+ .name = "about",
+ .activate = fr_application_activate_about,
+ },
+ {
+ .name = "quit",
+ .activate = fr_application_activate_quit,
+ },
};
diff --git a/src/fr-application.c b/src/fr-application.c
index 708684ba..f151fedc 100644
--- a/src/fr-application.c
+++ b/src/fr-application.c
@@ -118,7 +118,11 @@ action_open_archive (GSimpleAction *action,
static GActionEntry entries[] = {
- { "open-archive", action_open_archive, "s", NULL, NULL },
+ {
+ .name = "open-archive",
+ .activate = action_open_archive,
+ .parameter_type = "s",
+ },
};
@@ -353,9 +357,7 @@ handle_method_call (GDBusConnection *connection,
static const GDBusInterfaceVTable interface_vtable = {
- handle_method_call,
- NULL, /* handle_get_property */
- NULL /* handle_set_property */
+ .method_call = handle_method_call,
};
diff --git a/src/fr-file-selector-dialog.c b/src/fr-file-selector-dialog.c
index 8e3a2509..e519ceab 100644
--- a/src/fr-file-selector-dialog.c
+++ b/src/fr-file-selector-dialog.c
@@ -672,9 +672,20 @@ activate_toggle (GSimpleAction *action,
static GActionEntry dlg_entries[] = {
- { "select-all", select_all_activate_cb, NULL, NULL, NULL },
- { "deselect-all", unselect_all_activate_cb, NULL, NULL, NULL },
- { "show-hidden", activate_toggle, NULL, "false", show_hidden_files_toggled_cb }
+ {
+ .name = "select-all",
+ .activate = select_all_activate_cb,
+ },
+ {
+ .name = "deselect-all",
+ .activate = unselect_all_activate_cb,
+ },
+ {
+ .name = "show-hidden",
+ .activate = activate_toggle,
+ .state = "false",
+ .change_state = show_hidden_files_toggled_cb,
+ },
};
diff --git a/src/fr-window-actions-entries.h b/src/fr-window-actions-entries.h
index 08c8f3b0..d777a319 100644
--- a/src/fr-window-actions-entries.h
+++ b/src/fr-window-actions-entries.h
@@ -28,37 +28,135 @@
#include "fr-window-actions-callbacks.h"
static const GActionEntry fr_window_actions[] = {
- { "add-files", fr_window_activate_add_files },
- { "close", fr_window_activate_close },
- { "delete", fr_window_activate_delete },
- { "deselect-all", fr_window_activate_deselect_all },
- { "edit-copy", fr_window_activate_edit_copy },
- { "edit-cut", fr_window_activate_edit_cut },
- { "edit-password", fr_window_activate_edit_password },
- { "edit-paste", fr_window_activate_edit_paste },
- { "extract-files", fr_window_activate_extract_files },
- { "find", toggle_action_activated, NULL, "false", fr_window_activate_find },
- { "go-back", fr_window_activate_go_back },
- { "go-forward", fr_window_activate_go_forward },
- { "go-home", fr_window_activate_go_home },
- { "open-folder", fr_window_activate_open_folder },
- { "open-with", fr_window_activate_open_with },
- { "reload", fr_window_activate_reload },
- { "rename", fr_window_activate_rename },
- { "save-as", fr_window_activate_save_as },
- { "select-all", fr_window_activate_select_all },
- { "sidebar-delete", fr_window_activate_sidebar_delete },
- { "sidebar-edit-copy", fr_window_activate_sidebar_edit_copy },
- { "sidebar-edit-cut", fr_window_activate_sidebar_edit_cut },
- { "sidebar-edit-paste", fr_window_activate_sidebar_edit_paste },
- { "sidebar-extract-files", fr_window_activate_sidebar_extract_files },
- { "sidebar-open-folder", fr_window_activate_sidebar_open_folder },
- { "sidebar-rename", fr_window_activate_sidebar_rename },
- { "stop", fr_window_activate_stop },
- { "test-archive", fr_window_activate_test_archive },
- { "view-properties", fr_window_activate_view_properties },
- { "view-selection", fr_window_activate_view_selection },
- { "view-sidebar", toggle_action_activated, NULL, "false", fr_window_activate_view_sidebar }
+ {
+ .name = "add-files",
+ .activate = fr_window_activate_add_files,
+ },
+ {
+ .name = "close",
+ .activate = fr_window_activate_close,
+ },
+ {
+ .name = "delete",
+ .activate = fr_window_activate_delete,
+ },
+ {
+ .name = "deselect-all",
+ .activate = fr_window_activate_deselect_all,
+ },
+ {
+ .name = "edit-copy",
+ .activate = fr_window_activate_edit_copy,
+ },
+ {
+ .name = "edit-cut",
+ .activate = fr_window_activate_edit_cut,
+ },
+ {
+ .name = "edit-password",
+ .activate = fr_window_activate_edit_password,
+ },
+ {
+ .name = "edit-paste",
+ .activate = fr_window_activate_edit_paste,
+ },
+ {
+ .name = "extract-files",
+ .activate = fr_window_activate_extract_files,
+ },
+ {
+ .name = "find",
+ .activate = toggle_action_activated,
+ .state = "false",
+ .change_state = fr_window_activate_find,
+ },
+ {
+ .name = "go-back",
+ .activate = fr_window_activate_go_back,
+ },
+ {
+ .name = "go-forward",
+ .activate = fr_window_activate_go_forward,
+ },
+ {
+ .name = "go-home",
+ .activate = fr_window_activate_go_home,
+ },
+ {
+ .name = "open-folder",
+ .activate = fr_window_activate_open_folder,
+ },
+ {
+ .name = "open-with",
+ .activate = fr_window_activate_open_with,
+ },
+ {
+ .name = "reload",
+ .activate = fr_window_activate_reload,
+ },
+ {
+ .name = "rename",
+ .activate = fr_window_activate_rename,
+ },
+ {
+ .name = "save-as",
+ .activate = fr_window_activate_save_as,
+ },
+ {
+ .name = "select-all",
+ .activate = fr_window_activate_select_all,
+ },
+ {
+ .name = "sidebar-delete",
+ .activate = fr_window_activate_sidebar_delete,
+ },
+ {
+ .name = "sidebar-edit-copy",
+ .activate = fr_window_activate_sidebar_edit_copy,
+ },
+ {
+ .name = "sidebar-edit-cut",
+ .activate = fr_window_activate_sidebar_edit_cut,
+ },
+ {
+ .name = "sidebar-edit-paste",
+ .activate = fr_window_activate_sidebar_edit_paste,
+ },
+ {
+ .name = "sidebar-extract-files",
+ .activate = fr_window_activate_sidebar_extract_files,
+ },
+ {
+ .name = "sidebar-open-folder",
+ .activate = fr_window_activate_sidebar_open_folder,
+ },
+ {
+ .name = "sidebar-rename",
+ .activate = fr_window_activate_sidebar_rename,
+ },
+ {
+ .name = "stop",
+ .activate = fr_window_activate_stop,
+ },
+ {
+ .name = "test-archive",
+ .activate = fr_window_activate_test_archive,
+ },
+ {
+ .name = "view-properties",
+ .activate = fr_window_activate_view_properties,
+ },
+ {
+ .name = "view-selection",
+ .activate = fr_window_activate_view_selection,
+ },
+ {
+ .name = "view-sidebar",
+ .activate = toggle_action_activated,
+ .parameter_type = NULL,
+ .state = "false",
+ .change_state = fr_window_activate_view_sidebar,
+ },
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]