[gnome-commander/Implement_CppCheck_suggestions] Use C++11 initialization in SearchData class



commit e9b4016ebe26ea38dd57df8a08303e4e1b54be67
Author: Uwe Scholz <u scholz83 gmx de>
Date:   Tue Mar 12 23:16:13 2019 +0100

    Use C++11 initialization in SearchData class

 src/dialogs/gnome-cmd-search-dialog.cc | 36 ++++++++++++----------------------
 1 file changed, 12 insertions(+), 24 deletions(-)
---
diff --git a/src/dialogs/gnome-cmd-search-dialog.cc b/src/dialogs/gnome-cmd-search-dialog.cc
index 60c153ae..3b91a68a 100644
--- a/src/dialogs/gnome-cmd-search-dialog.cc
+++ b/src/dialogs/gnome-cmd-search-dialog.cc
@@ -83,19 +83,19 @@ struct SearchData
 
     GnomeCmdSearchDialog *dialog;
 
-    GnomeCmdDir *start_dir;                     /**< the directory to start searching from */
+    GnomeCmdDir *start_dir {nullptr};                     /**< the directory to start searching from */
 
-    Filter *name_filter;
-    regex_t *content_regex;
-    gint context_id;                            /**< the context id of the status bar */
-    GList *match_dirs;                          /**< the directories which we found matching files in */
-    GThread *thread;
+    Filter *name_filter {nullptr};
+    regex_t *content_regex {nullptr};
+    gint context_id {0};                            /**< the context id of the status bar */
+    GList *match_dirs {nullptr};                          /**< the directories which we found matching files 
in */
+    GThread *thread {nullptr};
     ProtectedData pdata;
-    gint update_gui_timeout_id;
+    gint update_gui_timeout_id {0};
 
-    gboolean search_done;
-    gboolean stopped;                           /**< stops the search routine if set to TRUE. This is done 
by the stop_button */
-    gboolean dialog_destroyed;                  /**< set when the search dialog is destroyed, also stops the 
search of course */
+    gboolean search_done {TRUE};
+    gboolean stopped {TRUE};                           /**< stops the search routine if set to TRUE. This is 
done by the stop_button */
+    gboolean dialog_destroyed {FALSE};                  /**< set when the search dialog is destroyed, also 
stops the search of course */
 
     explicit SearchData(GnomeCmdSearchDialog *dlg);
 
@@ -230,9 +230,9 @@ inline GtkWidget *GnomeCmdSearchDialog::Private::create_button_with_menu(gchar *
 
 void GnomeCmdSearchDialog::Private::manage_profiles(GnomeCmdSearchDialog::Private *priv, guint new_profile, 
GtkWidget *widget)
 {
-    GnomeCmdSearchDialog *dialog = (GnomeCmdSearchDialog *) gtk_widget_get_ancestor 
(priv->profile_menu_button, GNOME_CMD_TYPE_SEARCH_DIALOG);
+    auto *dialog = reinterpret_cast<GnomeCmdSearchDialog*> (gtk_widget_get_ancestor 
(priv->profile_menu_button, GNOME_CMD_TYPE_SEARCH_DIALOG));
 
-    g_return_if_fail (dialog!=NULL);
+    g_return_if_fail (dialog != nullptr);
 
     if (new_profile)
         priv->profile_component->copy();
@@ -265,18 +265,6 @@ void GnomeCmdSearchDialog::Private::load_profile(GnomeCmdSearchDialog::Private *
 
 inline SearchData::SearchData(GnomeCmdSearchDialog *dlg): dialog(dlg)
 {
-    start_dir = NULL;
-
-    name_filter = NULL;
-    content_regex = NULL;
-    context_id = 0;
-    match_dirs = NULL;
-    thread = NULL;
-    update_gui_timeout_id = 0;
-
-    search_done = TRUE;
-    stopped = TRUE;
-    dialog_destroyed = FALSE;
 }
 
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]