[pan] Fix all the 'order of initialisation is not what you think' warnings



commit d2fc86df978020d94ee8a00ce8d48c6651dc5ead
Author: Thomas Tanner <thosrtanner googlemail com>
Date:   Sun Jun 26 18:45:12 2022 +0100

    Fix all the 'order of initialisation is not what you think' warnings

 pan/data-impl/data-impl.cc       | 11 ++++++-----
 pan/data/data.h                  |  2 +-
 pan/general/log.h                |  2 +-
 pan/gui/body-pane.cc             | 22 +++++++++++-----------
 pan/gui/gui.cc                   |  8 ++++----
 pan/gui/header-pane.cc           |  6 +++---
 pan/gui/pan.cc                   |  4 ++--
 pan/gui/progress-view.cc         |  4 ++--
 pan/tasks/decoder.cc             |  4 ++--
 pan/tasks/encoder.cc             |  4 ++--
 pan/tasks/nntp-pool.cc           |  6 +++---
 pan/tasks/queue.cc               |  6 +++---
 pan/tasks/socket-impl-openssl.cc |  4 ++--
 pan/tasks/task-article.cc        |  4 ++--
 pan/tasks/task-upload.cc         | 16 ++++++++--------
 15 files changed, 52 insertions(+), 51 deletions(-)
---
diff --git a/pan/data-impl/data-impl.cc b/pan/data-impl/data-impl.cc
index ca7c9be..b8dace5 100644
--- a/pan/data-impl/data-impl.cc
+++ b/pan/data-impl/data-impl.cc
@@ -75,18 +75,19 @@ namespace
 DataImpl :: DataImpl (const StringView& cache_ext, Prefs& prefs, bool unit_test, int cache_megs, DataIO * 
io):
   ProfilesImpl (*io),
   _cache (get_cache_path(), cache_ext, cache_megs),
-  _prefs(prefs),
   _encode_cache (get_encode_cache_path(), cache_megs),
   _certstore(*this),
+  _queue(nullptr),
   _unit_test (unit_test),
   _data_io (io),
+  _prefs(prefs),
   _descriptions_loaded (false),
-  newsrc_autosave_id (0),
-  newsrc_autosave_timeout (0),
+  _cached_xover_entry(nullptr),
   _rules_filter (prefs.get_flag("rules-autocache-mark-read", false),
                  prefs.get_flag("rules-auto-dl-mark-read", false),
-                 prefs.get_flag("rules-autocache-mark-read", false))
-
+                 prefs.get_flag("rules-autocache-mark-read", false)),
+  newsrc_autosave_id (0),
+  newsrc_autosave_timeout (0)
 {
   rebuild_backend ();
 }
diff --git a/pan/data/data.h b/pan/data/data.h
index 33749c8..8c250a6 100644
--- a/pan/data/data.h
+++ b/pan/data/data.h
@@ -207,7 +207,7 @@ namespace pan
          gchar* gkr_pw;
 
          Server(): port(STD_NNTP_PORT), article_expiration_age(31), max_connections(2),
-                    rank(1), ssl_support(0), trust(0), gkr_pw(NULL), compression_type(0) /* NONE */ {}
+                    rank(1), ssl_support(0), trust(0), compression_type(0) /* NONE */, gkr_pw(NULL) {}
       };
 
     protected:
diff --git a/pan/general/log.h b/pan/general/log.h
index 6388be2..fe438d5 100644
--- a/pan/general/log.h
+++ b/pan/general/log.h
@@ -54,7 +54,7 @@ namespace pan
         std::deque<Entry*> messages;
         std::string message;
         bool is_child;
-        Entry() : is_child(false), severity(PAN_SEVERITY_INFO), date(0) { }
+        Entry() : date(0), severity(PAN_SEVERITY_INFO), is_child(false) { }
         virtual ~Entry () { foreach (std::deque<Entry*>, messages, it) delete *it; }
       };
 
diff --git a/pan/gui/body-pane.cc b/pan/gui/body-pane.cc
index 4f03a87..3cc18c3 100644
--- a/pan/gui/body-pane.cc
+++ b/pan/gui/body-pane.cc
@@ -1731,6 +1731,9 @@ BodyPane :: BodyPane (Data& data, ArticleCache& cache, Prefs& prefs, GroupPrefs
   _header_pane(hp),
   _data (data),
   _cache (cache),
+#ifdef HAVE_WEBKIT
+  _web_view (webkit_web_view_new ()),
+#endif
   _hscroll_visible (false),
   _vscroll_visible (false),
   _message (0),
@@ -1738,11 +1741,8 @@ BodyPane :: BodyPane (Data& data, ArticleCache& cache, Prefs& prefs, GroupPrefs
 //  _gpgerr(GPG_DECODE),
 #endif
   _attachments(0),
-  _current_attachment(0),
-  _cleared (true)
-#ifdef HAVE_WEBKIT
-  ,_web_view (webkit_web_view_new ())
-#endif
+  _cleared (true),
+  _current_attachment(0)
 {
 
   GtkWidget * w, * l, * hbox;
@@ -2202,12 +2202,12 @@ BodyPane :: on_prefs_string_changed (const StringView& key, const StringView& va
 
 void
 BodyPane :: on_prefs_color_changed (const StringView& key, const GdkColor& color G_GNUC_UNUSED)
-{              
-  if ((key == "text-color-fg")              || (key == "text-color-bg")              || 
-      (key == "body-pane-color-url")        || (key == "body-pane-color-url-bg")     || 
-      (key == "body-pane-color-quote-1")    || (key == "body-pane-color-quote-2")    || 
-      (key == "body-pane-color-quote-3")    || (key == "body-pane-color-quote-1-bg") || 
-      (key == "body-pane-color-quote-2-bg") || (key == "body-pane-color-quote-3-bg") || 
+{
+  if ((key == "text-color-fg")              || (key == "text-color-bg")              ||
+      (key == "body-pane-color-url")        || (key == "body-pane-color-url-bg")     ||
+      (key == "body-pane-color-quote-1")    || (key == "body-pane-color-quote-2")    ||
+      (key == "body-pane-color-quote-3")    || (key == "body-pane-color-quote-1-bg") ||
+      (key == "body-pane-color-quote-2-bg") || (key == "body-pane-color-quote-3-bg") ||
       (key == "body-pane-color-signature")  || (key == "body-pane-color-signature-bg"))
   {
     refresh_colors ();
diff --git a/pan/gui/gui.cc b/pan/gui/gui.cc
index 0a10d7d..b897379 100644
--- a/pan/gui/gui.cc
+++ b/pan/gui/gui.cc
@@ -212,10 +212,11 @@ GUI :: root_realized_cb (GtkWidget*, gpointer self_gpointer)
 GUI :: GUI (Data& data, Queue& queue, Prefs& prefs, GroupPrefs& group_prefs):
   _data (data),
   _queue (queue),
-  _prefs (prefs),
-  _group_prefs (group_prefs),
   _cache (data.get_cache()),
   _encode_cache (data.get_encode_cache()),
+  _prefs (prefs),
+  _group_prefs (group_prefs),
+  _certstore(data.get_certstore()),
   _root (gtk_box_new (GTK_ORIENTATION_VERTICAL, 0)),
   _menu_vbox (gtk_box_new (GTK_ORIENTATION_VERTICAL, 0)),
   _group_pane (0),
@@ -228,8 +229,7 @@ GUI :: GUI (Data& data, Queue& queue, Prefs& prefs, GroupPrefs& group_prefs):
   _connection_size_label (0),
   _queue_size_label (0),
   _queue_size_button (0),
-  _taskbar (0),
-  _certstore(data.get_certstore())
+  _taskbar (0)
 {
 
   char * filename = g_build_filename (file::get_pan_home().c_str(), "pan.ui", NULL);
diff --git a/pan/gui/header-pane.cc b/pan/gui/header-pane.cc
index 11e13d8..1195e16 100644
--- a/pan/gui/header-pane.cc
+++ b/pan/gui/header-pane.cc
@@ -1985,11 +1985,11 @@ HeaderPane :: HeaderPane (ActionManager       & action_manager,
   _tree_view (0),
   _tree_store (0),
   _selection_changed_idle_tag (0),
+  _fg(prefs.get_color_str_wo_fallback ("text-color-fg")),
+  _bg(prefs.get_color_str_wo_fallback ("text-color-bg")),
   _cache (cache),
   _gui (gui),
-  _cleared (true),
-  _fg(prefs.get_color_str_wo_fallback ("text-color-fg")),
-  _bg(prefs.get_color_str_wo_fallback ("text-color-bg"))
+  _cleared (true)
 {
 
   // init the icons
diff --git a/pan/gui/pan.cc b/pan/gui/pan.cc
index 35d2816..d240948 100644
--- a/pan/gui/pan.cc
+++ b/pan/gui/pan.cc
@@ -272,8 +272,8 @@ namespace
     bool n() { return notif_shown; }
 
     StatusIconListener(GtkStatusIcon * i, GtkWidget* r, Prefs& p, Queue& q, Data& d, bool v) :
-      icon(i), root(r), prefs(p), queue(q), data(d), minimized(v),
-      tasks_active(0), tasks_total(0), notif_shown(false)
+      queue(q), data(d), tasks_active(0), tasks_total(0),
+      minimized(v), notif_shown(false), prefs(p), icon(i), root(r)
     {
       prefs.add_listener(this);
       queue.add_listener(this);
diff --git a/pan/gui/progress-view.cc b/pan/gui/progress-view.cc
index 43ef4f2..6ee3a3e 100644
--- a/pan/gui/progress-view.cc
+++ b/pan/gui/progress-view.cc
@@ -30,8 +30,8 @@ ProgressView :: ProgressView ():
   _progress_status_idle_tag (0),
   _root (gtk_event_box_new ()),
   _progressbar (gtk_progress_bar_new ()),
-  _progress (0),
-  _style (gtk_widget_get_style (_progressbar))
+  _style (gtk_widget_get_style (_progressbar)),
+  _progress (0)
 {
   gtk_progress_bar_set_ellipsize (GTK_PROGRESS_BAR(_progressbar), PANGO_ELLIPSIZE_MIDDLE);
   gtk_container_add (GTK_CONTAINER(_root), _progressbar);
diff --git a/pan/tasks/decoder.cc b/pan/tasks/decoder.cc
index 0e6f62a..7b3eb8a 100644
--- a/pan/tasks/decoder.cc
+++ b/pan/tasks/decoder.cc
@@ -38,9 +38,9 @@
 using namespace pan;
 
 Decoder :: Decoder (WorkerPool& pool):
+  health(OK),
   _worker_pool (pool),
-  _gsourceid (-1),
-  health(OK)
+  _gsourceid (-1)
 {
 }
 
diff --git a/pan/tasks/encoder.cc b/pan/tasks/encoder.cc
index 9b2bb7f..c77ae6c 100644
--- a/pan/tasks/encoder.cc
+++ b/pan/tasks/encoder.cc
@@ -47,9 +47,9 @@ using namespace pan;
 
 
 Encoder :: Encoder (WorkerPool& pool):
+  health(OK),
   _worker_pool (pool),
-  _gsourceid (-1),
-  health(OK)
+  _gsourceid (-1)
 {}
 
 
diff --git a/pan/tasks/nntp-pool.cc b/pan/tasks/nntp-pool.cc
index 7520dff..d693b82 100644
--- a/pan/tasks/nntp-pool.cc
+++ b/pan/tasks/nntp-pool.cc
@@ -44,13 +44,13 @@ NNTP_Pool :: NNTP_Pool (const Quark        & server,
                         CertStore          & store):
 
   _server_info (server_info),
-  _prefs (prefs),
   _server (server),
   _socket_creator (creator),
   _pending_connections (0),
+  _certstore(store),
+  _prefs (prefs),
   _active_count (0),
-  _time_to_allow_new_connections (0),
-  _certstore(store)
+  _time_to_allow_new_connections (0)
 {
 }
 
diff --git a/pan/tasks/queue.cc b/pan/tasks/queue.cc
index 123f011..d485e95 100644
--- a/pan/tasks/queue.cc
+++ b/pan/tasks/queue.cc
@@ -49,7 +49,6 @@ Queue :: Queue (ServerInfo         & server_info,
                 bool                 online,
                 int                  save_delay_secs):
   _server_info (server_info),
-  _prefs (prefs),
   _is_online (online),
   _socket_creator (socket_creator),
   _worker_pool (pool),
@@ -61,9 +60,10 @@ Queue :: Queue (ServerInfo         & server_info,
   _needs_saving (false),
   _last_time_saved (0),
   _archive (archive),
-  _certstore(certstore),
   _uploads_total(0),
-  _downloads_total(0)
+  _downloads_total(0),
+  _certstore(certstore),
+  _prefs (prefs)
 {
 
   data.set_queue(this);
diff --git a/pan/tasks/socket-impl-openssl.cc b/pan/tasks/socket-impl-openssl.cc
index 72518d6..7b12556 100644
--- a/pan/tasks/socket-impl-openssl.cc
+++ b/pan/tasks/socket-impl-openssl.cc
@@ -124,6 +124,7 @@ namespace
 #ifdef HAVE_GNUTLS // without gnutls this class is just a stub....
 
 GIOChannelSocketGnuTLS :: GIOChannelSocketGnuTLS (ServerInfo& data, const Quark& server, CertStore& cs):
+   _data(data),
    _channel (0),
    _tag_watch (0),
    _tag_timeout (0),
@@ -133,8 +134,7 @@ GIOChannelSocketGnuTLS :: GIOChannelSocketGnuTLS (ServerInfo& data, const Quark&
    _io_performed (false),
    _certstore(cs),
    _server(server),
-   _done(false),
-   _data(data)
+   _done(false)
 {
 
   debug ("GIOChannelSocketGnuTLS ctor " << (void*)this);
diff --git a/pan/tasks/task-article.cc b/pan/tasks/task-article.cc
index 80dc69e..bcde086 100644
--- a/pan/tasks/task-article.cc
+++ b/pan/tasks/task-article.cc
@@ -96,14 +96,14 @@ TaskArticle :: TaskArticle (const ServerRank          & server_rank,
   _server_rank (server_rank),
   _cache (cache),
   _read (read),
-  _mark_read_action (mark_read_action),
   _article (article),
   _time_posted (article.time_posted),
+  _attachment(filename),
+  _mark_read_action (mark_read_action),
   _save_mode (save_mode),
   _decoder(0),
   _decoder_has_run (false),
   _groups(get_groups_str(article)),
-  _attachment(filename),
   _options(options),
   _paused(false)
 {
diff --git a/pan/tasks/task-upload.cc b/pan/tasks/task-upload.cc
index f8f3d60..5ae6245 100644
--- a/pan/tasks/task-upload.cc
+++ b/pan/tasks/task-upload.cc
@@ -93,20 +93,20 @@ TaskUpload :: TaskUpload (const std::string         & filename,
                           GMimeMessage *              msg,
                           Progress::Listener        * listener):
   Task ("UPLOAD", get_description(filename.c_str())),
+  _server(server),
+  _encoder(0),
+  _encoder_has_run (false),
   _filename(filename),
   _basename (g_get_basename(filename.c_str())),
-  _server(server),
-  _cache(cache),
-  _article(article),
   _subject (article.subject.to_string()),
   _author(article.author.to_string()),
-  _encoder(0),
-  _encoder_has_run (false),
-  _all_bytes(0),
-  _bpf(format.bpf),
-  _total_parts(format.total),
   _save_file(format.save_file),
+  _total_parts(format.total),
+  _cache(cache),
+  _article(article),
+  _all_bytes(0),
   _queue_pos(0),
+  _bpf(format.bpf),
   _msg (msg),
   _first(true),
   _groups(get_groups_str(article))


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