Use default member init when applicable
authorKevin Ottens <kevin.ottens@nextcloud.com>
Thu, 28 May 2020 14:59:24 +0000 (16:59 +0200)
committerCamila <smayres@gmail.com>
Wed, 3 Jun 2020 14:10:39 +0000 (16:10 +0200)
This also fixes a couple of warnings at places (out of order init for
instance) and a potential bug in the webflow credentials / qtkeychain
integration.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
56 files changed:
.clang-tidy
src/3rdparty/QProgressIndicator/QProgressIndicator.cpp
src/3rdparty/QProgressIndicator/QProgressIndicator.h
src/3rdparty/qtokenizer/qtokenizer.h
src/common/ownsql.cpp
src/common/ownsql.h
src/common/syncjournalfilerecord.cpp
src/common/syncjournalfilerecord.h
src/csync/csync.h
src/gui/creds/shibbolethcredentials.cpp
src/gui/creds/shibbolethcredentials.h
src/gui/creds/webflowcredentials.cpp
src/gui/creds/webflowcredentials.h
src/gui/elidedlabel.cpp
src/gui/elidedlabel.h
src/gui/folderman.cpp
src/gui/folderman.h
src/gui/folderstatusmodel.cpp
src/gui/folderstatusmodel.h
src/gui/generalsettings.cpp
src/gui/generalsettings.h
src/gui/proxyauthhandler.cpp
src/gui/proxyauthhandler.h
src/gui/systray.cpp
src/gui/systray.h
src/gui/tray/UserModel.cpp
src/gui/tray/UserModel.h
src/gui/wizard/flow2authcredspage.cpp
src/gui/wizard/flow2authcredspage.h
src/gui/wizard/flow2authwidget.cpp
src/gui/wizard/flow2authwidget.h
src/gui/wizard/owncloudadvancedsetuppage.cpp
src/gui/wizard/owncloudadvancedsetuppage.h
src/gui/wizard/owncloudsetuppage.cpp
src/gui/wizard/owncloudsetuppage.h
src/gui/wizard/owncloudshibbolethcredspage.cpp
src/gui/wizard/owncloudshibbolethcredspage.h
src/gui/wizard/owncloudwizard.cpp
src/gui/wizard/owncloudwizard.h
src/gui/wizard/owncloudwizardresultpage.cpp
src/gui/wizard/owncloudwizardresultpage.h
src/libsync/creds/abstractcredentials.cpp
src/libsync/creds/abstractcredentials.h
src/libsync/creds/httpcredentials.cpp
src/libsync/creds/httpcredentials.h
src/libsync/discoveryphase.h
src/libsync/logger.cpp
src/libsync/logger.h
src/libsync/progressdispatcher.h
src/libsync/syncfileitem.h
src/libsync/syncfilestatus.cpp
src/libsync/syncfilestatus.h
src/libsync/syncresult.cpp
src/libsync/syncresult.h
src/libsync/theme.cpp
src/libsync/theme.h

index 071f522fd77441a6335209883f75fbc04ad852eb..9c41a78db1440cef5e42b89cc35b32751fe7f9ef 100644 (file)
@@ -6,6 +6,7 @@ Checks: '-*,
     modernize-shrink-to-fit,
     modernize-use-auto,
     modernize-use-bool-literals,
+    modernize-use-default-member-init,
     modernize-use-emplace,
     modernize-use-noexcept,
     modernize-use-transparent-functors,
@@ -15,3 +16,6 @@ WarningsAsErrors: '*'
 HeaderFilterRegex: '.*'
 AnalyzeTemporaryDtors: false
 FormatStyle:     none
+CheckOptions:
+  - key: modernize-use-default-member-init.UseAssignment
+    value: 1
index 3d536f243f1609c06cc7a2dcf78e63d7e4301d38..f32eb6e2ffe34876a2fade21eb4569886c3657b6 100644 (file)
 #include <QPainter>
 
 QProgressIndicator::QProgressIndicator(QWidget* parent)
-    : QWidget(parent),
-      m_angle(0),
-      m_timerId(-1),
-      m_delay(40),
-      m_displayedWhenStopped(false),
-      m_color(Qt::black)
+    : QWidget(parent)
 {
     setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
     setFocusPolicy(Qt::NoFocus);
index a6178080e1960d216da74d797327739d1fcd0baa..727866009ac2ab0527aa622d38dbf72f670ca0e6 100644 (file)
@@ -101,11 +101,11 @@ protected:
     virtual void timerEvent(QTimerEvent * event); 
     virtual void paintEvent(QPaintEvent * event);
 private:
-    int m_angle;
-    int m_timerId;
-    int m_delay;
-    bool m_displayedWhenStopped;
-    QColor m_color;
+    int m_angle = 0;
+    int m_timerId = -1;
+    int m_delay = 40;
+    bool m_displayedWhenStopped = false;
+    QColor m_color = Qt::black;
 };
 
 #endif // QPROGRESSINDICATOR_H
index 2c4b082b444eecdd0b3a433e1d3b641381b89499..95f1e3212b13c7ae6c9690aefc53bc9632c6737f 100644 (file)
@@ -53,10 +53,9 @@ struct QTokenizerPrivate {
     typedef typename T::value_type char_type;
 
     struct State {
-        bool inQuote;
-        bool inEscape;
-        char_type quoteChar;
-        State() : inQuote(false), inEscape(false), quoteChar('\0') {}
+        bool inQuote = false;
+        bool inEscape = false;
+        char_type quoteChar = '\0';
     };
 
     QTokenizerPrivate(const T& _string, const T& _delims) :
index f7151321a8bb02ab25f6cd419dce2b3abbfad930..5646e0ab44f1df242752a49d76e1764e177a6ec7 100644 (file)
@@ -44,8 +44,6 @@ namespace OCC {
 Q_LOGGING_CATEGORY(lcSql, "nextcloud.sync.database.sql", QtInfoMsg)
 
 SqlDatabase::SqlDatabase()
-    : _db(nullptr)
-    , _errId(0)
 {
 }
 
index 250fa109b3635ef84f41b8a49ee00b6f06284adb..a45734a4162da1b7e05dc4f7aa0cc28fc0907c98 100644 (file)
@@ -62,9 +62,9 @@ private:
     bool openHelper(const QString &filename, int sqliteFlags);
     CheckDbResult checkDb();
 
-    sqlite3 *_db;
+    sqlite3 *_db = nullptr;
     QString _error; // last error string
-    int _errId;
+    int _errId = 0;
 
     friend class SqlQuery;
     QSet<SqlQuery *> _queries;
index 607d2e6db1b9a2855ffcecfb4b4a28c44e7cf4f3..082b52b6d246c0b55f5ca653f330b3a1eb2c6a51 100644 (file)
 namespace OCC {
 
 SyncJournalFileRecord::SyncJournalFileRecord()
-    : _inode(0)
-    , _type(ItemTypeSkip)
-    , _fileSize(0)
-    , _serverHasIgnoredFiles(false)
 {
 }
 
index 0e02f12533ba6dc5e62f79c2eebbdf5320061292..3124f78206ce9db7e4701c93e04fa9ed700a2cf5 100644 (file)
@@ -55,14 +55,14 @@ public:
     QDateTime modDateTime() const { return Utility::qDateTimeFromTime_t(_modtime); }
 
     QByteArray _path;
-    quint64 _inode;
-    qint64 _modtime;
-    ItemType _type;
+    quint64 _inode = 0;
+    qint64 _modtime = 0;
+    ItemType _type = ItemTypeSkip;
     QByteArray _etag;
     QByteArray _fileId;
-    qint64 _fileSize;
+    qint64 _fileSize = 0;
     RemotePermissions _remotePerm;
-    bool _serverHasIgnoredFiles;
+    bool _serverHasIgnoredFiles = false;
     QByteArray _checksumHeader;
     QByteArray _e2eMangledName;
 };
index fecf511bf0074801cc00ec78f145e92495c8d14c..408693205af0f6732e816993f90f1b21db34b692 100644 (file)
@@ -149,9 +149,9 @@ enum ItemType {
 typedef struct csync_file_stat_s csync_file_stat_t;
 
 struct OCSYNC_EXPORT csync_file_stat_s {
-  time_t modtime;
-  int64_t size;
-  uint64_t inode;
+  time_t modtime = 0;
+  int64_t size = 0;
+  uint64_t inode = 0;
 
   OCC::RemotePermissions remotePerm;
   ItemType type BITFIELD(4);
@@ -174,20 +174,15 @@ struct OCSYNC_EXPORT csync_file_stat_s {
   QByteArray checksumHeader;
   QByteArray e2eMangledName;
 
-  CSYNC_STATUS error_status;
+  CSYNC_STATUS error_status = CSYNC_STATUS_OK;
 
-  enum csync_instructions_e instruction; /* u32 */
+  enum csync_instructions_e instruction = CSYNC_INSTRUCTION_NONE; /* u32 */
 
   csync_file_stat_s()
-    : modtime(0)
-    , size(0)
-    , inode(0)
-    , type(ItemTypeSkip)
+    : type(ItemTypeSkip)
     , child_modified(false)
     , has_ignored_files(false)
     , is_hidden(false)
-    , error_status(CSYNC_STATUS_OK)
-    , instruction(CSYNC_INSTRUCTION_NONE)
   { }
 
   static std::unique_ptr<csync_file_stat_t> fromSyncJournalFileRecord(const OCC::SyncJournalFileRecord &rec);
index a09136a9789b0b1ae721e11083c98914669466c9..b19133785536d4efec959fda01e895def8c761ef 100644 (file)
@@ -51,11 +51,6 @@ namespace {
 
 ShibbolethCredentials::ShibbolethCredentials()
     : AbstractCredentials()
-    , _url()
-    , _ready(false)
-    , _stillValid(false)
-    , _browser(nullptr)
-    , _keychainMigration(false)
 {
 }
 
index a94b398a742f28e455bc4ad3d441e6e2d91e14bc..cc9df8506fa6f84bd08897b9a7b557b755c6a460 100644 (file)
@@ -91,12 +91,12 @@ private:
     QUrl _url;
     QByteArray prepareCookieData() const;
 
-    bool _ready;
-    bool _stillValid;
+    bool _ready = false;
+    bool _stillValid = false;
     QPointer<ShibbolethWebView> _browser;
     QNetworkCookie _shibCookie;
     QString _user;
-    bool _keychainMigration;
+    bool _keychainMigration = false;
 };
 
 } // namespace OCC
index 16d4ccd621b172bfde9603933e0337b2193c3c19..ce0d7b41f3b378c541da57f350cf07f715da870f 100644 (file)
@@ -87,10 +87,6 @@ static void addSettingsToJob(Account *account, QKeychain::Job *job)
 #endif
 
 WebFlowCredentials::WebFlowCredentials()
-    : _ready(false)
-    , _credentialsValid(false)
-    , _keychainMigration(false)
-    , _retryOnKeyChainError(false)
 {
 
 }
@@ -103,8 +99,6 @@ WebFlowCredentials::WebFlowCredentials(const QString &user, const QString &passw
     , _clientSslCaCertificates(caCertificates)
     , _ready(true)
     , _credentialsValid(true)
-    , _keychainMigration(false)
-    , _retryOnKeyChainError(false)
 {
 
 }
index 4b2414b016f754fac5bf8c18e91ba1e8a7abdf31..511ab542eadb49f7729a74ed1e7581d8309f1f38 100644 (file)
@@ -119,12 +119,12 @@ protected:
     QSslCertificate _clientSslCertificate;
     QList<QSslCertificate> _clientSslCaCertificates;
 
-    bool _ready;
-    bool _credentialsValid;
-    bool _keychainMigration;
+    bool _ready = false;
+    bool _credentialsValid = false;
+    bool _keychainMigration = false;
     bool _retryOnKeyChainError = true; // true if we haven't done yet any reading from keychain
 
-    WebFlowCredentialsDialog *_askDialog;
+    WebFlowCredentialsDialog *_askDialog = nullptr;
 };
 
 } // namespace OCC
index f397e7edd68db659b7db23e33dbc5dba56fdf0d0..6b3740663dc2004929fe15f2f0e8592974847911 100644 (file)
@@ -20,7 +20,6 @@ namespace OCC {
 
 ElidedLabel::ElidedLabel(QWidget *parent)
     : QLabel(parent)
-    , _elideMode(Qt::ElideNone)
 {
 }
 
index 968628c8f1cbc9c7c92696416e335f618b15cc55..e101a65dae4cfabafb8a2ecf2794d21bc7c2dac7 100644 (file)
@@ -38,7 +38,7 @@ protected:
 
 private:
     QString _text;
-    Qt::TextElideMode _elideMode;
+    Qt::TextElideMode _elideMode = Qt::ElideNone;
 };
 }
 
index 71f991c719d9477df5dcde567c3b5b676489ce0b..3ab24df781dba7d102112febe9436cf66ca4b98b 100644 (file)
@@ -47,11 +47,8 @@ FolderMan *FolderMan::_instance = nullptr;
 
 FolderMan::FolderMan(QObject *parent)
     : QObject(parent)
-    , _currentSyncFolder(nullptr)
-    , _syncEnabled(true)
     , _lockWatcher(new LockWatcher)
     , _navigationPaneHelper(this)
-    , _appRestartRequired(false)
 {
     ASSERT(!_instance);
     _instance = this;
index 97d4b8f45738cc88556db7dcd7cec5488169f09d..d4d311becdf312696ebba1262f9f3cf84ecb3b25 100644 (file)
@@ -304,9 +304,9 @@ private:
     QSet<Folder *> _disabledFolders;
     Folder::Map _folderMap;
     QString _folderConfigPath;
-    Folder *_currentSyncFolder;
+    Folder *_currentSyncFolder = nullptr;
     QPointer<Folder> _lastSyncFolder;
-    bool _syncEnabled;
+    bool _syncEnabled = true;
 
     /// Starts regular etag query jobs
     QTimer _etagPollTimer;
@@ -328,7 +328,7 @@ private:
     QScopedPointer<SocketApi> _socketApi;
     NavigationPaneHelper _navigationPaneHelper;
 
-    bool _appRestartRequired;
+    bool _appRestartRequired = false;
 
     static FolderMan *_instance;
     explicit FolderMan(QObject *parent = nullptr);
index 59299a999545a59affcdaa11060da2944e6b3828..35bcd85e1633349186899274308de0e5f58154d2 100644 (file)
@@ -43,8 +43,6 @@ static QString removeTrailingSlash(const QString &s)
 
 FolderStatusModel::FolderStatusModel(QObject *parent)
     : QAbstractItemModel(parent)
-    , _accountState(nullptr)
-    , _dirty(false)
 {
 
 }
index 457e337d1c21c9cbeb4af6f51e639d951ae4f8d5..8c9a5647812f51fd349a65211af341ebbfbedb95 100644 (file)
@@ -140,8 +140,8 @@ private slots:
 private:
     QStringList createBlackList(OCC::FolderStatusModel::SubFolderInfo *root,
         const QStringList &oldBlackList) const;
-    const AccountState *_accountState;
-    bool _dirty; // If the selective sync checkboxes were changed
+    const AccountState *_accountState = nullptr;
+    bool _dirty = false; // If the selective sync checkboxes were changed
 
     /**
      * Keeps track of items that are fetching data from the server.
index 34672aae7645ca4a5f77bed7a634f247f2176b12..fff5c9076bf1a13dbf5ad5eedd2fb139222dc406 100644 (file)
@@ -50,7 +50,6 @@ namespace OCC {
 GeneralSettings::GeneralSettings(QWidget *parent)
     : QWidget(parent)
     , _ui(new Ui::GeneralSettings)
-    , _currentlyLoading(false)
 {
     _ui->setupUi(this);
 
index 0c9aa4148c5927d2ff89074793e6f6106211da36..4b5e6a538f636e17478b4fe6f3219b9676f6cde1 100644 (file)
@@ -62,7 +62,7 @@ private:
     Ui::GeneralSettings *_ui;
     QPointer<IgnoreListEditor> _ignoreEditor;
     QPointer<SyncLogDialog> _syncLogDialog;
-    bool _currentlyLoading;
+    bool _currentlyLoading = false;
 };
 
 
index a75412f13279bfe3f84cd1c06689fbf6913f4552..39310ccf4a319b0b782c51d1ba326ee23b2f1be3 100644 (file)
@@ -34,10 +34,6 @@ ProxyAuthHandler *ProxyAuthHandler::instance()
 }
 
 ProxyAuthHandler::ProxyAuthHandler()
-    : _blocked(false)
-    , _waitingForDialog(0)
-    , _waitingForKeychain(0)
-    , _keychainJobRunning(false)
 {
     _dialog = new ProxyAuthDialog();
 
index 3d5afedd3f13809bddc8d37a8f6b99bf182ab075..6e4e24902cede7924b885200c3d6cd1417dfd9e1 100644 (file)
@@ -84,14 +84,14 @@ private:
 
     /// If the user cancels the credential dialog, blocked will be set to
     /// true and we won't bother him again.
-    bool _blocked;
+    bool _blocked = false;
 
     /// In several instances handleProxyAuthenticationRequired() can be called
     /// while it is still running. These counters detect what we're currently
     /// waiting for.
-    int _waitingForDialog;
-    int _waitingForKeychain;
-    bool _keychainJobRunning;
+    int _waitingForDialog = 0;
+    int _waitingForKeychain = 0;
+    bool _keychainJobRunning = false;
 
     QPointer<ProxyAuthDialog> _dialog;
 
index bd508319b18b4431018052ed2057663e32a8c964..0c7674d7379b3e285c8cf0953293bf53be1d26af 100644 (file)
@@ -47,9 +47,7 @@ Systray *Systray::instance()
 }
 
 Systray::Systray()
-    : _isOpen(false)
-    , _syncIsPaused(false)
-    , _trayEngine(new QQmlApplicationEngine(this))
+    : _trayEngine(new QQmlApplicationEngine(this))
 {
     _trayEngine->addImportPath("qrc:/qml/theme");
     _trayEngine->addImageProvider("avatars", new ImageProvider);
index 6d55ca36f8f2f22ec17ffa6643e506c0b2a3f9a9..0152a75ffbabfd66b2111012697665b7cbb10be2 100644 (file)
@@ -76,8 +76,8 @@ public slots:
 private:
     static Systray *_instance;
     Systray();
-    bool _isOpen;
-    bool _syncIsPaused;
+    bool _isOpen = false;
+    bool _syncIsPaused = false;
     QQmlApplicationEngine *_trayEngine;
 };
 
index 6938e4c5b1bbd8c508647c568b7629eb00a26c9b..4c3fa4fb55143634629a66ef7c7ae818749f63fd 100644 (file)
@@ -518,7 +518,6 @@ UserModel *UserModel::instance()
 
 UserModel::UserModel(QObject *parent)
     : QAbstractListModel(parent)
-    , _currentUserId()
 {
     // TODO: Remember selected user from last quit via settings file
     if (AccountManager::instance()->accounts().size() > 0) {
index b52cac0e26b037908d8dc33e867c784f1365783b..34672dc378f4196923cb55fff2221f1ab6d299df 100644 (file)
@@ -134,7 +134,7 @@ private:
     static UserModel *_instance;
     UserModel(QObject *parent = 0);
     QList<User*> _users;
-    int _currentUserId;
+    int _currentUserId = 0;
     bool _init = true;
 
     void buildUserList();
index f0c63f6c86982b9a939bb01c5fb0f077c0691934..b9912152d00a23d968ebbc8871e2d1cb0e7a3db7 100644 (file)
@@ -29,8 +29,7 @@
 namespace OCC {
 
 Flow2AuthCredsPage::Flow2AuthCredsPage()
-    : AbstractCredentialsWizardPage(),
-    _flow2AuthWidget(nullptr)
+    : AbstractCredentialsWizardPage()
 {
     _layout = new QVBoxLayout(this);
 
index 8a59605e01cea34c8817bf6ca14df184f862f8f8..a3afbbcba6ef13eb0b48f4e15b0e22e49d576d82 100644 (file)
@@ -61,8 +61,8 @@ public:
     QString _appPassword;
 
 private:
-    Flow2AuthWidget *_flow2AuthWidget;
-    QVBoxLayout *_layout;
+    Flow2AuthWidget *_flow2AuthWidget = nullptr;
+    QVBoxLayout *_layout = nullptr;
 };
 
 } // namespace OCC
index 498a9803ef63c384110728d8c8bbfc019021858f..7d4524e3adcd6264feb8b5ff7cd4b4e532d7f4b0 100644 (file)
@@ -27,10 +27,7 @@ Q_LOGGING_CATEGORY(lcFlow2AuthWidget, "gui.wizard.flow2authwidget", QtInfoMsg)
 
 Flow2AuthWidget::Flow2AuthWidget(QWidget *parent)
     : QWidget(parent)
-    , _account(nullptr)
-    , _ui()
     , _progressIndi(new QProgressIndicator(this))
-    , _statusUpdateSkipCount(0)
 {
     _ui.setupUi(this);
 
index 609791d9b91a8e8ec50d67ea5abd7e4307046ef0..6c8cb5a2c047e379786148ce031c1861e758660c 100644 (file)
@@ -48,7 +48,7 @@ signals:
     void pollNow();
 
 private:
-    Account *_account;
+    Account *_account = nullptr;
     QScopedPointer<Flow2Auth> _asyncAuth;
     Ui_Flow2AuthWidget _ui;
 
@@ -62,7 +62,7 @@ private:
     void customizeStyle();
 
     QProgressIndicator *_progressIndi;
-    int _statusUpdateSkipCount;
+    int _statusUpdateSkipCount = 0;
 };
 
 } // namespace OCC
index ce15dc105bfa559117f88e0e722eebcb50fd4e46..4fb0f424a3d15dd13dd5cea4c1314e8b4706d234 100644 (file)
@@ -36,14 +36,7 @@ namespace OCC {
 
 OwncloudAdvancedSetupPage::OwncloudAdvancedSetupPage()
     : QWizardPage()
-    , _ui()
-    , _checking(false)
-    , _created(false)
-    , _localFolderValid(false)
     , _progressIndi(new QProgressIndicator(this))
-    , _remoteFolder()
-    , _rSize(-1)
-    , _rSelectedSize(-1)
 {
     _ui.setupUi(this);
 
index e3d328a18e989227d9f987a70e34c2aeb92577a7..f49fc8f1d76e1e8bd778b762c7517c786c156652 100644 (file)
@@ -71,14 +71,14 @@ private:
     void customizeStyle();
 
     Ui_OwncloudAdvancedSetupPage _ui;
-    bool _checking;
-    bool _created;
-    bool _localFolderValid;
+    bool _checking = false;
+    bool _created = false;
+    bool _localFolderValid = false;
     QProgressIndicator *_progressIndi;
     QString _remoteFolder;
     QStringList _selectiveSyncBlacklist;
-    qint64 _rSize;
-    qint64 _rSelectedSize;
+    qint64 _rSize = -1;
+    qint64 _rSelectedSize = -1;
 };
 
 } // namespace OCC
index d0a41e43c9c80424b5e732d4b594e0dd1fedf86f..71f1c19c91d347c7c5c2f933dddfb9957708264e 100644 (file)
@@ -39,16 +39,10 @@ namespace OCC {
 
 OwncloudSetupPage::OwncloudSetupPage(QWidget *parent)
     : QWizardPage()
-    , _ui()
-    , _oCUrl()
-    , _ocUser()
-    , _authTypeKnown(false)
-    , _checking(false)
-    , _authType(DetermineAuthTypeJob::Basic)
     , _progressIndi(new QProgressIndicator(this))
+    , _ocWizard(qobject_cast<OwncloudWizard *>(parent))
 {
     _ui.setupUi(this);
-    _ocWizard = qobject_cast<OwncloudWizard *>(parent);
 
     Theme *theme = Theme::instance();
     setTitle(WizardCommon::titleTemplate().arg(tr("Connect to %1").arg(theme->appNameGUI())));
index 6e7ed93b0164b171ef184d529d954750473ecb34..88d164a72e58162a5948ae65a878ae2653b17dbd 100644 (file)
@@ -85,16 +85,13 @@ private:
 
     QString _oCUrl;
     QString _ocUser;
-    bool _authTypeKnown;
-    bool _checking;
-    bool _multipleFoldersExist;
-    DetermineAuthTypeJob::AuthType _authType;
+    bool _authTypeKnown = false;
+    bool _checking = false;
+    DetermineAuthTypeJob::AuthType _authType = DetermineAuthTypeJob::Basic;
 
     QProgressIndicator *_progressIndi;
-    QButtonGroup *_selectiveSyncButtons;
-    QString _remoteFolder;
-    AddCertificateDialog *addCertDial;
     OwncloudWizard *_ocWizard;
+    AddCertificateDialog *addCertDial = nullptr;
 };
 
 } // namespace OCC
index 3469b42dcf1e6fb229752db7fa27f26fd250b00a..f18d8891da0d248323059a46ec296896fabe6faa 100644 (file)
@@ -27,8 +27,6 @@ namespace OCC {
 
 OwncloudShibbolethCredsPage::OwncloudShibbolethCredsPage()
     : AbstractCredentialsWizardPage()
-    , _browser(nullptr)
-    , _afterInitialSetup(false)
 {
 }
 
index 32e59d9b02661382334d8415e9d8c68998f38244..cf1c48f5b6a9ae4ffe3b7e7fda1e5cd91e5926d4 100644 (file)
@@ -58,7 +58,7 @@ private:
     void setupBrowser();
 
     QPointer<ShibbolethWebView> _browser;
-    bool _afterInitialSetup;
+    bool _afterInitialSetup = false;
     QNetworkCookie _cookie;
 };
 
index 2076136ffe81af7d88f3bf56665e1a496f667802..aa7f0aaa4c8e4d25611f398a9aa4456a08e42969 100644 (file)
@@ -47,16 +47,13 @@ OwncloudWizard::OwncloudWizard(QWidget *parent)
     , _setupPage(new OwncloudSetupPage(this))
     , _httpCredsPage(new OwncloudHttpCredsPage(this))
     , _browserCredsPage(new OwncloudOAuthCredsPage)
-    , _flow2CredsPage(new Flow2AuthCredsPage)
 #ifndef NO_SHIBBOLETH
     , _shibbolethCredsPage(new OwncloudShibbolethCredsPage)
 #endif
+    , _flow2CredsPage(new Flow2AuthCredsPage)
     , _advancedSetupPage(new OwncloudAdvancedSetupPage)
     , _resultPage(new OwncloudWizardResultPage)
-    , _credentialsPage(nullptr)
     , _webViewPage(new WebViewPage(this))
-    , _setupLog()
-    , _registration(false)
 {
     setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
     setPage(WizardCommon::Page_ServerSetup, _setupPage);
index 3cbf89f710704fb9aee2ea9d383d575f1e1bbc56..ee6161ca55d9de0a08a927b4427dbeee2cdad374 100644 (file)
@@ -117,12 +117,12 @@ private:
     Flow2AuthCredsPage *_flow2CredsPage;
     OwncloudAdvancedSetupPage *_advancedSetupPage;
     OwncloudWizardResultPage *_resultPage;
-    AbstractCredentialsWizardPage *_credentialsPage;
+    AbstractCredentialsWizardPage *_credentialsPage = nullptr;
     WebViewPage *_webViewPage;
 
     QStringList _setupLog;
 
-    bool _registration;
+    bool _registration = false;
 
     friend class OwncloudSetupWizard;
 };
index c7f0ad616c117d279263e4f951efd0ca251100d1..826ef0ade756ce4b1c1cc26815474c78fde8bc7f 100644 (file)
@@ -25,10 +25,6 @@ namespace OCC {
 
 OwncloudWizardResultPage::OwncloudWizardResultPage()
     : QWizardPage()
-    , _localFolder()
-    , _remoteFolder()
-    , _complete(false)
-    , _ui()
 {
     _ui.setupUi(this);
     // no fields to register.
index 166b57ab2e457d4c0e7d67dca88dc06dc8467180..416f075e00d0c6bea4bca1db0c131522c9ac992e 100644 (file)
@@ -50,7 +50,7 @@ protected:
 private:
     QString _localFolder;
     QString _remoteFolder;
-    bool _complete;
+    bool _complete = false;
 
     Ui_OwncloudWizardResultPage _ui;
 };
index 677891f848eeff2ce41cdba1c84deb8df61688ac..e71ca059edb2adfff4a5a4725e2160b0e7b48654 100644 (file)
@@ -24,8 +24,6 @@ namespace OCC {
 Q_LOGGING_CATEGORY(lcCredentials, "nextcloud.sync.credentials", QtInfoMsg)
 
 AbstractCredentials::AbstractCredentials()
-    : _account(nullptr)
-    , _wasFetched(false)
 {
 }
 
index 41807c4192278d4f6fd336fb089ca82fcf3f1b0e..896626c12eb86127b715ff1e0be9978a0c1e5ea0 100644 (file)
@@ -103,8 +103,8 @@ Q_SIGNALS:
     void asked();
 
 protected:
-    Account *_account;
-    bool _wasFetched;
+    Account *_account = nullptr;
+    bool _wasFetched = false;
 };
 
 } // namespace OCC
index 31c70a11996d06e881c9dadba4f2b83b76ff5b65..d946d7fc745f25cbdb810daaf7dfd03459fe475b 100644 (file)
@@ -104,8 +104,6 @@ static void addSettingsToJob(Account *account, QKeychain::Job *job)
 }
 
 HttpCredentials::HttpCredentials()
-    : _ready(false)
-    , _keychainMigration(false)
 {
 }
 
index 0687f4e5a34879a701c3eb278869729d84f13308..1f95084b2d7528d29882a733ae1c5e3ca6a6592e 100644 (file)
@@ -137,10 +137,10 @@ protected:
     QString _previousPassword;
 
     QString _fetchErrorString;
-    bool _ready;
+    bool _ready = false;
     QSslKey _clientSslKey;
     QSslCertificate _clientSslCertificate;
-    bool _keychainMigration;
+    bool _keychainMigration = false;
     bool _retryOnKeyChainError = true; // true if we haven't done yet any reading from keychain
 };
 
index 04b2ae09705509a278951ddf47949ae40b15e5e7..a5c8521b7d5dcc7c129b6e8d8e50319b8294de94 100644 (file)
@@ -40,12 +40,8 @@ struct DiscoveryDirectoryResult
 {
     QString path;
     QString msg;
-    int code;
+    int code = EIO;
     std::deque<std::unique_ptr<csync_file_stat_t>> list;
-    DiscoveryDirectoryResult()
-        : code(EIO)
-    {
-    }
 };
 
 /**
index c4d294aecad0cc2d97085a071533c7cb9582be7d..91446553e35041510672fee54f85c034028920c3 100644 (file)
@@ -48,11 +48,6 @@ Logger *Logger::instance()
 
 Logger::Logger(QObject *parent)
     : QObject(parent)
-    , _showTime(true)
-    , _logWindowActivated(false)
-    , _doFileFlush(false)
-    , _logExpire(0)
-    , _logDebug(false)
 {
     qSetMessagePattern("[%{function} \t%{message}");
 #ifndef NO_MSG_HANDLER
index 91dbb32026155731dfe436e3b40184ac66745561..b5742ed4453825050643b236677cec952c6fd5e1 100644 (file)
@@ -97,12 +97,12 @@ private:
     Logger(QObject *parent = nullptr);
     ~Logger();
     QList<Log> _logs;
-    bool _showTime;
-    bool _logWindowActivated;
+    bool _showTime = true;
+    bool _logWindowActivated = false;
     QFile _logFile;
-    bool _doFileFlush;
-    int _logExpire;
-    bool _logDebug;
+    bool _doFileFlush = false;
+    int _logExpire = 0;
+    bool _logDebug = false;
     QScopedPointer<QTextStream> _logstream;
     mutable QMutex _mutex;
     QString _logDirectory;
index 66b7ba7cdc0ae45155c1859e0454f2eacc3a8225..fc3c8238d331f392a59182643d8ebf572113219a 100644 (file)
@@ -127,15 +127,6 @@ public:
      */
     struct OWNCLOUDSYNC_EXPORT Progress
     {
-        Progress()
-            : _progressPerSec(0)
-            , _prevCompleted(0)
-            , _initialSmoothing(1.0)
-            , _completed(0)
-            , _total(0)
-        {
-        }
-
         /** Returns the estimates about progress per second and eta. */
         Estimates estimates() const;
 
@@ -155,16 +146,16 @@ public:
         void setCompleted(quint64 completed);
 
         // Updated by update()
-        double _progressPerSec;
-        quint64 _prevCompleted;
+        double _progressPerSec = 0;
+        quint64 _prevCompleted = 0;
 
         // Used to get to a good value faster when
         // progress measurement stats. See update().
-        double _initialSmoothing;
+        double _initialSmoothing = 1.0;
 
         // Set and updated by ProgressInfo
-        quint64 _completed;
-        quint64 _total;
+        quint64 _completed = 0;
+        quint64 _total = 0;
 
         friend class ProgressInfo;
     };
index e054ab83a467b37fc703e2d42ba48559d0c7e7a3..2215dca42ff6611b6aec9ca3d1b291d8d1005a68 100644 (file)
@@ -101,14 +101,6 @@ public:
         , _errorMayBeBlacklisted(false)
         , _status(NoStatus)
         , _isRestoration(false)
-        , _httpErrorCode(0)
-        , _affectedItems(1)
-        , _instruction(CSYNC_INSTRUCTION_NONE)
-        , _modtime(0)
-        , _size(0)
-        , _inode(0)
-        , _previousSize(0)
-        , _previousModtime(0)
     {
     }
 
@@ -225,20 +217,20 @@ public:
     // Variables useful to report to the user
     Status _status BITFIELD(4);
     bool _isRestoration BITFIELD(1); // The original operation was forbidden, and this is a restoration
-    quint16 _httpErrorCode;
+    quint16 _httpErrorCode = 0;
     RemotePermissions _remotePerm;
     QString _errorString; // Contains a string only in case of error
     QByteArray _responseTimeStamp;
-    quint32 _affectedItems; // the number of affected items by the operation on this item.
+    quint32 _affectedItems = 1; // the number of affected items by the operation on this item.
     // usually this value is 1, but for removes on dirs, it might be much higher.
 
     // Variables used by the propagator
-    csync_instructions_e _instruction;
+    csync_instructions_e _instruction = CSYNC_INSTRUCTION_NONE;
     QString _originalFile; // as it is in the csync tree
-    time_t _modtime;
+    time_t _modtime = 0;
     QByteArray _etag;
-    quint64 _size;
-    quint64 _inode;
+    quint64 _size = 0;
+    quint64 _inode = 0;
     QByteArray _fileId;
 
     // This is the value for the 'new' side, matching with _size and _modtime.
@@ -250,8 +242,8 @@ public:
     QByteArray _checksumHeader;
 
     // The size and modtime of the file getting overwritten (on the disk for downloads, on the server for uploads).
-    quint64 _previousSize;
-    time_t _previousModtime;
+    quint64 _previousSize = 0;
+    time_t _previousModtime = 0;
 
     QString _directDownloadUrl;
     QString _directDownloadCookies;
index 8d1a5933fe6c8a327ce23ac9324bb7be3708bb82..b4bcfd23448808a9fd8b314c24036bb32a6c5ef6 100644 (file)
@@ -16,8 +16,6 @@
 
 namespace OCC {
 SyncFileStatus::SyncFileStatus()
-    : _tag(StatusNone)
-    , _shared(false)
 {
 }
 
index e4743f7a3f5293b9840e9223110c3f0a4d7c716b..f778c89e88d637236bc7916ed5803c6063f0f72c 100644 (file)
@@ -50,8 +50,8 @@ public:
     QString toSocketAPIString() const;
 
 private:
-    SyncFileStatusTag _tag;
-    bool _shared;
+    SyncFileStatusTag _tag = StatusNone;
+    bool _shared = false;
 };
 
 inline bool operator==(const SyncFileStatus &a, const SyncFileStatus &b)
index a3481c74fad287d5928ccb22e38c2b750a567cf5..e33d7354ec185ecccc92fdd2bad9596cbdd259af 100644 (file)
 namespace OCC {
 
 SyncResult::SyncResult()
-    : _status(Undefined)
-    , _foundFilesNotSynced(false)
-    , _folderStructureWasChanged(false)
-    , _numNewItems(0)
-    , _numRemovedItems(0)
-    , _numUpdatedItems(0)
-    , _numRenamedItems(0)
-    , _numNewConflictItems(0)
-    , _numOldConflictItems(0)
-    , _numErrorItems(0)
-    , _numLockedItems(0)
-
 {
 }
 
index 1a0c680ca5cded95ca6d0fea581b5271a81ae9a8..a3079f8afebfe8130e7b3e1fc148f52709c4fb59 100644 (file)
@@ -86,7 +86,7 @@ public:
     void processCompletedItem(const SyncFileItemPtr &item);
 
 private:
-    Status _status;
+    Status _status = Undefined;
     SyncFileItemVector _syncItems;
     QDateTime _syncTime;
     QString _folder;
@@ -94,18 +94,18 @@ private:
      * when the sync tool support this...
      */
     QStringList _errors;
-    bool _foundFilesNotSynced;
-    bool _folderStructureWasChanged;
+    bool _foundFilesNotSynced = false;
+    bool _folderStructureWasChanged = false;
 
     // count new, removed and updated items
-    int _numNewItems;
-    int _numRemovedItems;
-    int _numUpdatedItems;
-    int _numRenamedItems;
-    int _numNewConflictItems;
-    int _numOldConflictItems;
-    int _numErrorItems;
-    int _numLockedItems;
+    int _numNewItems = 0;
+    int _numRemovedItems = 0;
+    int _numUpdatedItems = 0;
+    int _numRenamedItems = 0;
+    int _numNewConflictItems = 0;
+    int _numOldConflictItems = 0;
+    int _numErrorItems = 0;
+    int _numLockedItems = 0;
 
     SyncFileItemPtr _firstItemNew;
     SyncFileItemPtr _firstItemDeleted;
index 645ccff8aba2751238403f0d0e32faac9bfa65eb..5ad0c4363ecd53024ff479ae3beaa9080a68e707 100644 (file)
@@ -204,7 +204,6 @@ QString Theme::hidpiFileName(const QString &fileName, QPaintDevice *dev)
 
 Theme::Theme()
     : QObject(nullptr)
-    , _mono(false)
 {
 }
 
index 2d06576482599940b23a8759179c7838698f2643..2ecbf6c8161ffcdd725ca096f7b0d4d7616ae9b0 100644 (file)
@@ -466,7 +466,7 @@ private:
     Theme &operator=(Theme const &);
 
     static Theme *_instance;
-    bool _mono;
+    bool _mono = false;
 #ifndef TOKEN_AUTH_ONLY
     mutable QHash<QString, QIcon> _iconCache;
 #endif