move init to default value in class declaration
authorMatthieu Gallien <matthieu.gallien@nextcloud.com>
Mon, 6 Feb 2023 09:38:59 +0000 (10:38 +0100)
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>
Mon, 6 Feb 2023 10:55:09 +0000 (10:55 +0000)
done via clang-tidy and manual tuning

run-clang-tidy -p build -header-filter='.*' -config="{Checks: '*', CheckOptions: [{key: UseAssignment, value: true}]}" -checks='-*,modernize-use-default-member-init' -fix

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
54 files changed:
src/3rdparty/qtokenizer/qtokenizer.h
src/3rdparty/qtsingleapplication/qtsingleapplication.cpp
src/3rdparty/qtsingleapplication/qtsingleapplication.h
src/common/syncjournaldb.cpp
src/common/syncjournaldb.h
src/gui/accountsettings.cpp
src/gui/accountsettings.h
src/gui/accountstate.cpp
src/gui/application.cpp
src/gui/application.h
src/gui/connectionvalidator.cpp
src/gui/connectionvalidator.h
src/gui/creds/flow2auth.cpp
src/gui/creds/flow2auth.h
src/gui/creds/webflowcredentialsdialog.cpp
src/gui/creds/webflowcredentialsdialog.h
src/gui/folder.cpp
src/gui/folder.h
src/gui/folderwizard.cpp
src/gui/folderwizard.h
src/gui/remotewipe.cpp
src/gui/remotewipe.h
src/gui/selectivesyncdialog.cpp
src/gui/selectivesyncdialog.h
src/gui/sslerrordialog.cpp
src/gui/sslerrordialog.h
src/gui/tray/unifiedsearchresultslistmodel.cpp
src/gui/tray/unifiedsearchresultslistmodel.h
src/gui/tray/usermodel.cpp
src/gui/tray/usermodel.h
src/gui/updater/ocupdater.cpp
src/gui/updater/ocupdater.h
src/gui/userinfo.cpp
src/gui/userinfo.h
src/gui/wizard/owncloudhttpcredspage.cpp
src/gui/wizard/owncloudhttpcredspage.h
src/libsync/abstractnetworkjob.cpp
src/libsync/abstractnetworkjob.h
src/libsync/bandwidthmanager.cpp
src/libsync/bandwidthmanager.h
src/libsync/discoveryphase.cpp
src/libsync/discoveryphase.h
src/libsync/networkjobs.cpp
src/libsync/networkjobs.h
src/libsync/owncloudpropagator.cpp
src/libsync/owncloudpropagator.h
src/libsync/propagatedownload.h
src/libsync/propagateremotemkdir.cpp
src/libsync/propagateremotemkdir.h
src/libsync/propagateupload.cpp
src/libsync/propagateupload.h
src/libsync/propagatorjobs.h
src/libsync/syncengine.cpp
src/libsync/syncengine.h

index 0eda45a66050004b681c3258e44ece0bcd03d511..e1b856c3b98eead3d71cc8e66bde8a8bbb551e2d 100644 (file)
@@ -65,9 +65,6 @@ struct QTokenizerPrivate {
       , tokenBegin(end)
       , tokenEnd(begin)
       , delimiters(_delims)
-      , isDelim(false)
-      , returnDelimiters(false)
-      , returnQuotes(false)
     {
     }
 
@@ -105,9 +102,9 @@ struct QTokenizerPrivate {
     const_iterator tokenEnd;
     T delimiters;
     T quotes;
-    bool isDelim;
-    bool returnDelimiters;
-    bool returnQuotes;
+    bool isDelim = false;
+    bool returnDelimiters = false;
+    bool returnQuotes = false;
 };
 
 template <class T, class const_iterator = typename T::const_iterator>
index 422608d1afb767c7d13714a152ae7fbf47241f17..70e5a6969f2c05dd6c356e71f738ede85214e2bf 100644 (file)
@@ -50,9 +50,7 @@ static QString instancesLockFilename(const QString &appSessionId)
 }
 
 QtSingleApplication::QtSingleApplication(const QString &appId, int &argc, char **argv)
-    : QApplication(argc, argv),
-      firstPeer(-1),
-      pidPeer(nullptr)
+    : QApplication(argc, argv)
 {
     this->appId = appId;
 
index cb9c80b5dba896e2aba2959373f31fa4edfd4789..2725607128703c242491b07f35b79e6c2bf5a137 100644 (file)
@@ -65,9 +65,9 @@ Q_SIGNALS:
 private:
     QString instancesFileName(const QString &appId);
 
-    qint64 firstPeer;
+    qint64 firstPeer = -1;
     QSharedMemory *instances;
-    QtLocalPeer *pidPeer;
+    QtLocalPeer *pidPeer = nullptr;
     QWidget *actWin;
     QString appId;
     bool block;
index 84668ed26f924691e6432c18bb0f4298ea5c176f..fc3c4149fd5c2adf181a45dc3a3233ed2fbb36ff 100644 (file)
@@ -104,8 +104,6 @@ static QByteArray defaultJournalMode(const QString &dbPath)
 SyncJournalDb::SyncJournalDb(const QString &dbFilePath, QObject *parent)
     : QObject(parent)
     , _dbFile(dbFilePath)
-    , _transaction(0)
-    , _metadataTableIsEmpty(false)
 {
     // Allow forcing the journal mode for debugging
     static QByteArray envJournalMode = qgetenv("OWNCLOUD_SQLITE_JOURNAL_MODE");
index 4660e93574d8ce6c4001edf501b3f215038573f4..07803084e66829047b7ce63cd617dd1bd47460a1 100644 (file)
@@ -418,8 +418,8 @@ private:
     QString _dbFile;
     QRecursiveMutex _mutex; // Public functions are protected with the mutex.
     QMap<QByteArray, int> _checksymTypeCache;
-    int _transaction;
-    bool _metadataTableIsEmpty;
+    int _transaction = 0;
+    bool _metadataTableIsEmpty = false;
 
     /* Storing etags to these folders, or their parent folders, is filtered out.
      *
index 51ac7cd3507b0c5cb439eccb52a2a5f07f672ead..876498bbcffecc2decdc212101281872660ad5f4 100644 (file)
@@ -147,10 +147,8 @@ protected:
 AccountSettings::AccountSettings(AccountState *accountState, QWidget *parent)
     : QWidget(parent)
     , _ui(new Ui::AccountSettings)
-    , _wasDisabledBefore(false)
     , _accountState(accountState)
     , _userInfo(accountState, false, true)
-    , _menuShown(false)
 {
     _ui->setupUi(this);
 
index 7a3cd2df02f475b704ef19986c29ba7caa0fcaef..be70931d8f88ee4e7ad033cb23c7912df6c9fc07 100644 (file)
@@ -140,13 +140,13 @@ private:
 
     FolderStatusModel *_model;
     QUrl _OCUrl;
-    bool _wasDisabledBefore;
+    bool _wasDisabledBefore = false;
     AccountState *_accountState;
     UserInfo _userInfo;
     QAction *_toggleSignInOutAction = nullptr;
     QAction *_addAccountAction = nullptr;
 
-    bool _menuShown;
+    bool _menuShown = false;
 
     QHash<QString, QMetaObject::Connection> _folderConnections;
 };
index feec1f4c93356641626a141de8708a7fc072f8d3..372fa218f0abcab71424c71660c5df578bc42160 100644 (file)
@@ -44,7 +44,6 @@ AccountState::AccountState(AccountPtr account)
     , _account(account)
     , _state(AccountState::Disconnected)
     , _connectionStatus(ConnectionValidator::Undefined)
-    , _waitingForNewCredentials(false)
     , _maintenanceToConnectedDelay(60000 + (qrand() % (4 * 60000))) // 1-5min delay
     , _remoteWipe(new RemoteWipe(_account))
     , _isDesktopNotificationsAllowed(true)
index 45a806230592bbcf3bbb5a53d3ebdb3605dfa84a..4ba331689230fe372c7572617f39534a1fba1b3d 100644 (file)
@@ -213,15 +213,6 @@ Application::Application(int &argc, char **argv)
     : SharedTools::QtSingleApplication(Theme::instance()->appName(), argc, argv)
     , _gui(nullptr)
     , _theme(Theme::instance())
-    , _helpOnly(false)
-    , _versionOnly(false)
-    , _showLogWindow(false)
-    , _logExpire(0)
-    , _logFlush(false)
-    , _logDebug(true)
-    , _userTriggeredConnect(false)
-    , _debugMode(false)
-    , _backgroundMode(false)
 {
     _startedAt.start();
 
index 8ae193264c725d8623d67aedcda66aea5cb4dfc0..9b6bad9eb5d63959e90c79f42eadf43c7db6c3c2 100644 (file)
@@ -122,22 +122,22 @@ private:
 
     Theme *_theme;
 
-    bool _helpOnly;
-    bool _versionOnly;
+    bool _helpOnly = false;
+    bool _versionOnly = false;
 
     QElapsedTimer _startedAt;
 
     // options from command line:
-    bool _showLogWindow;
+    bool _showLogWindow = false;
     bool _quitInstance = false;
     QString _logFile;
     QString _logDir;
-    int _logExpire;
-    bool _logFlush;
-    bool _logDebug;
-    bool _userTriggeredConnect;
-    bool _debugMode;
-    bool _backgroundMode;
+    int _logExpire = 0;
+    bool _logFlush = false;
+    bool _logDebug = true;
+    bool _userTriggeredConnect = false;
+    bool _debugMode = false;
+    bool _backgroundMode = false;
     QUrl _editFileLocallyUrl;
 
     ClientProxy _proxy;
index 5868d72e2940ce73f14d786409b97fa78ff07196..515c47f8a97426a82a277a51cd05cf2749cee02c 100644 (file)
@@ -40,7 +40,6 @@ ConnectionValidator::ConnectionValidator(AccountStatePtr accountState, QObject *
     : QObject(parent)
     , _accountState(accountState)
     , _account(accountState->account())
-    , _isCheckingServerAndAuth(false)
 {
 }
 
index 920f63175a611653321c28c23f1c40658a3e80b0..354d5a81897605c6d0e2c5599c67f5df7dc8a26b 100644 (file)
@@ -140,7 +140,7 @@ private:
     QStringList _errors;
     AccountStatePtr _accountState;
     AccountPtr _account;
-    bool _isCheckingServerAndAuth;
+    bool _isCheckingServerAndAuth = false;
 };
 }
 
index 1526921b83ed3a9762de6fda2ffe79a278a0d899..f90873dbc6793315d15e1340330cb9d05c5ca7ae 100644 (file)
@@ -35,8 +35,6 @@ Q_LOGGING_CATEGORY(lcFlow2auth, "nextcloud.sync.credentials.flow2auth", QtInfoMs
 Flow2Auth::Flow2Auth(Account *account, QObject *parent)
     : QObject(parent)
     , _account(account)
-    , _isBusy(false)
-    , _hasToken(false)
 {
     _pollTimer.setInterval(1000);
     QObject::connect(&_pollTimer, &QTimer::timeout, this, &Flow2Auth::slotPollTimerTimeout);
index 35efb721ca9f47adb5d437055936905976e3d0c3..adac4d39bb1ad8cceb3b58d66ad13f0fa37030b1 100644 (file)
@@ -79,8 +79,8 @@ private:
     QTimer _pollTimer;
     qint64 _secondsLeft = 0LL;
     qint64 _secondsInterval = 0LL;
-    bool _isBusy;
-    bool _hasToken;
+    bool _isBusy = false;
+    bool _hasToken = false;
     bool _enforceHttps = false;
 };
 
index 19db3430bedfef2be777b5c6017d1212a3343f30..4ec6747fc6aced3d17bdf3848622f61bc3f6f4ae 100644 (file)
@@ -17,10 +17,6 @@ namespace OCC {
 WebFlowCredentialsDialog::WebFlowCredentialsDialog(Account *account, bool useFlow2, QWidget *parent)
     : QDialog(parent)
     , _useFlow2(useFlow2)
-    , _flow2AuthWidget(nullptr)
-#ifdef WITH_WEBENGINE
-    , _webView(nullptr)
-#endif // WITH_WEBENGINE
 {
     setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
 
index b684603d761095faf1175a15f5545e8149f863cc..86abe8af3fd71a51b1f2d2c328ea59f0c3e5fe2f 100644 (file)
@@ -50,9 +50,9 @@ private:
 
     bool _useFlow2;
 
-    Flow2AuthWidget *_flow2AuthWidget;
+    Flow2AuthWidget *_flow2AuthWidget = nullptr;
 #ifdef WITH_WEBENGINE
-    WebView *_webView;
+    WebView *_webView = nullptr;
 #endif // WITH_WEBENGINE
 
     QLabel *_errorLabel;
index ea933758d7da1a6b4f5fe4c87aebde86244f931f..38db18d5547e659756329a074f4a355a0e94ee89 100644 (file)
@@ -63,8 +63,6 @@ Folder::Folder(const FolderDefinition &definition,
     , _accountState(accountState)
     , _definition(definition)
     , _lastSyncDuration(0)
-    , _consecutiveFailingSyncs(0)
-    , _consecutiveFollowUpSyncs(0)
     , _journal(_definition.absoluteJournalPath())
     , _fileLog(new SyncRunFileLog)
     , _vfs(vfs.release())
index 9e6de57973444974c725fb1b7754bea0ee0437b0..2d0a8edc4bb294e13035d8c3d724dd247c8cd62e 100644 (file)
@@ -472,11 +472,11 @@ private:
 
     /// The number of syncs that failed in a row.
     /// Reset when a sync is successful.
-    int _consecutiveFailingSyncs;
+    int _consecutiveFailingSyncs = 0;
 
     /// The number of requested follow-up syncs.
     /// Reset when no follow-up is requested.
-    int _consecutiveFollowUpSyncs;
+    int _consecutiveFollowUpSyncs = 0;
 
     mutable SyncJournalDb _journal;
 
index e1373339832a1b3d9bf5e9d95f0ddf9b9653e16b..99d147f6274467066aabb8257b900ff1db4f2ba1 100644 (file)
@@ -171,9 +171,7 @@ void FolderWizardLocalPath::changeStyle()
 // =================================================================================
 FolderWizardRemotePath::FolderWizardRemotePath(const AccountPtr &account)
     : FormatWarningsWizardPage()
-    , _warnWasVisible(false)
     , _account(account)
-
 {
     _ui.setupUi(this);
     _ui.warnFrame->hide();
@@ -634,7 +632,6 @@ void FolderWizardSelectiveSync::virtualFilesCheckboxClicked()
 FolderWizard::FolderWizard(AccountPtr account, QWidget *parent)
     : QWizard(parent)
     , _folderWizardSourcePage(new FolderWizardLocalPath(account))
-    , _folderWizardTargetPage(nullptr)
     , _folderWizardSelectiveSyncPage(new FolderWizardSelectiveSync(account))
 {
     setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
index 393c0ad33ab8bb8879eace2aca3eff9f2fff42ef..e0aeecc5c03a7e48ed736b4c51a3c3b4f639ffd8 100644 (file)
@@ -115,7 +115,7 @@ private:
     void recursiveInsert(QTreeWidgetItem *parent, QStringList pathTrail, QString path);
     bool selectByPath(QString path);
     Ui_FolderWizardTargetPage _ui{};
-    bool _warnWasVisible;
+    bool _warnWasVisible = false;
     AccountPtr _account;
     QTimer _lscolTimer;
     QStringList _encryptedPaths;
@@ -167,7 +167,7 @@ public:
 
 private:
     FolderWizardLocalPath *_folderWizardSourcePage;
-    FolderWizardRemotePath *_folderWizardTargetPage;
+    FolderWizardRemotePath *_folderWizardTargetPage = nullptr;
     FolderWizardSelectiveSync *_folderWizardSelectiveSyncPage;
 };
 
index 73af19f71c0628772e26c6629bd115fbe0145a96..362ab0386357ce27454d7272cd4c579ea2adad01 100644 (file)
@@ -28,10 +28,7 @@ RemoteWipe::RemoteWipe(AccountPtr account, QObject *parent)
     : QObject(parent),
       _account(account),
       _appPassword(QString()),
-      _accountRemoved(false),
-      _networkManager(nullptr),
-      _networkReplyCheck(nullptr),
-      _networkReplySuccess(nullptr)
+      _networkManager(nullptr)
 {
     QObject::connect(AccountManager::instance(), &AccountManager::accountRemoved,
                      this, [=](AccountState *) {
index f57ec80435fd41031f34dafcc25430ef6a51effe..2a2a0ad9e06d52e9c350559cffba228121c875ef 100644 (file)
@@ -50,10 +50,10 @@ private slots:
 private:
     AccountPtr _account;
     QString _appPassword;
-    bool _accountRemoved;
+    bool _accountRemoved = false;
     QNetworkAccessManager _networkManager;
-    QNetworkReply *_networkReplyCheck;
-    QNetworkReply *_networkReplySuccess;
+    QNetworkReply *_networkReplyCheck = nullptr;
+    QNetworkReply *_networkReplySuccess = nullptr;
 
     friend class ::TestRemoteWipe;
 };
index 692306e4bde5b759a887082f7f53b7c2b67f19cb..4f4ca1ec1fc2d8312e9576bfe832ca165c80b7ca 100644 (file)
@@ -67,7 +67,6 @@ private:
 SelectiveSyncWidget::SelectiveSyncWidget(AccountPtr account, QWidget *parent)
     : QWidget(parent)
     , _account(account)
-    , _inserting(false)
     , _folderTree(new QTreeWidget(this))
 {
     _loading = new QLabel(tr("Loading â€¦"), _folderTree);
index acf8a6f4b1475b6c6095894f004510eb050d6705..92f45f3d7e5e2e3abfe2cce97d15a5fbcb9cfbaa 100644 (file)
@@ -72,7 +72,7 @@ private:
     QString _rootName;
     QStringList _oldBlackList;
 
-    bool _inserting; // set to true when we are inserting new items on the list
+    bool _inserting = false; // set to true when we are inserting new items on the list
     QLabel *_loading;
 
     QTreeWidget *_folderTree;
index 7b97a657a6c01dec0d26e94b09f0db54a01549de..bd3eee0b434b979b516a29b295df67fcd97f8cd1 100644 (file)
@@ -57,7 +57,6 @@ bool SslDialogErrorHandler::handleErrors(QList<QSslError> errors, const QSslConf
 
 SslErrorDialog::SslErrorDialog(AccountPtr account, QWidget *parent)
     : QDialog(parent)
-    , _allTrusted(false)
     , _ui(new Ui::SslErrorDialog)
     , _account(account)
 {
index 597227e76ca75954c0654726f9155ccbc3d76044..5d779ff343169ae829725a9534eb0b1f732d530c 100644 (file)
@@ -56,7 +56,7 @@ public:
 
 private:
     [[nodiscard]] QString styleSheet() const;
-    bool _allTrusted;
+    bool _allTrusted = false;
 
     [[nodiscard]] QString certDiv(QSslCertificate) const;
 
index 5f951c07c44ac7ea3c0f898086308101f74e2d0b..6ec9a7a2a6382d5f13b8936345129f6cd7b63b1a 100644 (file)
@@ -194,7 +194,6 @@ Q_LOGGING_CATEGORY(lcUnifiedSearch, "nextcloud.gui.unifiedsearch", QtInfoMsg)
 
 UnifiedSearchResultsListModel::UnifiedSearchResultsListModel(AccountState *accountState, QObject *parent)
     : QAbstractListModel(parent)
-    , _waitingForSearchTermEditEnd(false)
     , _accountState(accountState)
 {
 }
index 539b4f59c719bc0eaf7342e02cc24502f15eb178..24beea8643e3d2c5713cd231670db64a3c349343 100644 (file)
@@ -126,7 +126,7 @@ private:
 
     QString _searchTerm;
     QString _errorString;
-    bool _waitingForSearchTermEditEnd;
+    bool _waitingForSearchTermEditEnd = false;
 
     QString _currentFetchMoreInProgressProviderId;
 
index a26a054cd001ede34f74a8e78e5f734d6f623639..a057248ce0f289d4a622d2b419dfa468b68e70a5 100644 (file)
@@ -43,7 +43,6 @@ User::User(AccountStatePtr &account, const bool &isCurrent, QObject *parent)
     , _isCurrentUser(isCurrent)
     , _activityModel(new ActivityListModel(_account.data(), this))
     , _unifiedSearchResultsModel(new UnifiedSearchResultsListModel(_account.data(), this))
-    , _notificationRequestsRunning(0)
 {
     connect(ProgressDispatcher::instance(), &ProgressDispatcher::progressInfo,
         this, &User::slotProgressInfo);
index c49cd9990c774384266efd51b0b7f97c9354a536..a9c7d1f2ec4916168bc75dbbdbf8c3a67405abc7 100644 (file)
@@ -149,7 +149,7 @@ private:
 
     // number of currently running notification requests. If non zero,
     // no query for notifications is started.
-    int _notificationRequestsRunning;
+    int _notificationRequestsRunning = 0;
 };
 
 class UserModel : public QAbstractListModel
index b44a0d18a55a643029198bf27b1a2b9555d02719..833cc2a3a236a86b644b511fc12b5cd338815b1f 100644 (file)
@@ -86,7 +86,6 @@ void UpdaterScheduler::slotTimerFired()
 OCUpdater::OCUpdater(const QUrl &url)
     : Updater()
     , _updateUrl(url)
-    , _state(Unknown)
     , _accessManager(new AccessManager(this))
     , _timeoutWatchdog(new QTimer(this))
 {
index 1bbf8b8594ef6b28c70ff443939ac81400f7183b..494d12841779676bb72412e87deb9a95f9b0a108 100644 (file)
@@ -139,7 +139,7 @@ protected:
 
 private:
     QUrl _updateUrl;
-    int _state;
+    int _state = Unknown;
     QNetworkAccessManager *_accessManager;
     QTimer *_timeoutWatchdog; /** Timer to guard the timeout of an individual network request */
     UpdateInfo _updateInfo;
index b13f1a72456cd3bae6162817a699b4c5702d92ed..1c111d7360a7e90259570ea366e1c59fa95bfa9f 100644 (file)
@@ -37,9 +37,6 @@ UserInfo::UserInfo(AccountState *accountState, bool allowDisconnectedAccountStat
     , _accountState(accountState)
     , _allowDisconnectedAccountState(allowDisconnectedAccountState)
     , _fetchAvatarImage(fetchAvatarImage)
-    , _lastQuotaTotalBytes(0)
-    , _lastQuotaUsedBytes(0)
-    , _active(false)
 {
     connect(accountState, &AccountState::stateChanged,
         this, &UserInfo::slotAccountStateChanged);
index eaad8db19931e4f882310a9418cd244147b9d023..f01c7502fb6751ec4ea219556227017e786ea044 100644 (file)
@@ -100,11 +100,11 @@ private:
     bool _allowDisconnectedAccountState;
     bool _fetchAvatarImage;
 
-    qint64 _lastQuotaTotalBytes;
-    qint64 _lastQuotaUsedBytes;
+    qint64 _lastQuotaTotalBytes = 0;
+    qint64 _lastQuotaUsedBytes = 0;
     QTimer _jobRestartTimer;
     QDateTime _lastInfoReceived; // the time at which the user info and quota was received last
-    bool _active; // if we should check at regular interval (when the UI is visible)
+    bool _active = false; // if we should check at regular interval (when the UI is visible)
     QPointer<JsonApiJob> _job; // the currently running job
 };
 
index cab2a7427b50af8fdb4537a8d2fd265e4c6eeaaa..ed514b72a459cc420b6d9bbd7c33792abfdd74aa 100644 (file)
@@ -28,7 +28,6 @@ namespace OCC {
 OwncloudHttpCredsPage::OwncloudHttpCredsPage(QWidget *parent)
     : AbstractCredentialsWizardPage()
     , _ui()
-    , _connected(false)
     , _progressIndi(new QProgressIndicator(this))
 {
     _ui.setupUi(this);
index 915482b97513a0aa35311d0fa1136041b666e771..6a5f5db669de82ec5f29a56e9c2542cb82dbb5a2 100644 (file)
@@ -56,7 +56,7 @@ private:
     void customizeStyle();
 
     Ui_OwncloudHttpCredsPage _ui;
-    bool _connected;
+    bool _connected = false;
     QProgressIndicator *_progressIndi;
     OwncloudWizard *_ocWizard;
 };
index ef2dc75f48f587b22688a3e5a718c4bb0275a3e0..cb31cd6f4adaf88c6b50f545383596556e41039f 100644 (file)
@@ -49,10 +49,7 @@ int AbstractNetworkJob::httpTimeout = qEnvironmentVariableIntValue("OWNCLOUD_TIM
 
 AbstractNetworkJob::AbstractNetworkJob(AccountPtr account, const QString &path, QObject *parent)
     : QObject(parent)
-    , _timedout(false)
-    , _followRedirects(true)
     , _account(account)
-    , _ignoreCredentialFailure(false)
     , _reply(nullptr)
     , _path(path)
 {
index 6af5b207c21aebc8933d1de4b32bc2a99052b760..2e2a45b22fe86c1e24fe5163cd24e8c109c2347e 100644 (file)
@@ -179,11 +179,11 @@ protected:
     virtual void onTimedOut();
 
     QByteArray _responseTimestamp;
-    bool _timedout; // set to true when the timeout slot is received
+    bool _timedout = false; // set to true when the timeout slot is received
 
     // Automatically follows redirects. Note that this only works for
     // GET requests that don't set up any HTTP body or other flags.
-    bool _followRedirects;
+    bool _followRedirects = true;
 
     QString replyStatusString();
 
@@ -196,7 +196,7 @@ protected:
 
 private:
     QNetworkReply *addTimer(QNetworkReply *reply);
-    bool _ignoreCredentialFailure;
+    bool _ignoreCredentialFailure = false;
     QPointer<QNetworkReply> _reply; // (QPointer because the NetworkManager may be destroyed before the jobs at exit)
     QString _path;
     QTimer _timer;
index a8dd2a6b11c5e3ab50deee4c37ed46328b76bda9..d7094377485227c2f4da533359b1aba725cd4f7c 100644 (file)
@@ -47,11 +47,6 @@ static qint64 relativeLimitMeasuringTimerIntervalMsec = 1000 * 2;
 BandwidthManager::BandwidthManager(OwncloudPropagator *p)
     : QObject()
     , _propagator(p)
-    , _relativeLimitCurrentMeasuredDevice(nullptr)
-    , _relativeUploadLimitProgressAtMeasuringRestart(0)
-    , _currentUploadLimit(0)
-    , _relativeLimitCurrentMeasuredJob(nullptr)
-    , _currentDownloadLimit(0)
 {
     _currentUploadLimit = _propagator->_uploadLimit;
     _currentDownloadLimit = _propagator->_downloadLimit;
index dac0d78a1e2b0fe5cf037eeed92a387664232628..eb902f34b29800051a409e26bfae270ae9688b0f 100644 (file)
@@ -80,11 +80,11 @@ private:
     QTimer _relativeUploadDelayTimer;
 
     // the device measured
-    UploadDevice *_relativeLimitCurrentMeasuredDevice;
+    UploadDevice *_relativeLimitCurrentMeasuredDevice = nullptr;
 
     // for measuring how much progress we made at start
-    qint64 _relativeUploadLimitProgressAtMeasuringRestart;
-    qint64 _currentUploadLimit;
+    qint64 _relativeUploadLimitProgressAtMeasuringRestart = 0;
+    qint64 _currentUploadLimit = 0;
 
     std::list<GETFileJob *> _downloadJobList;
     QTimer _relativeDownloadMeasuringTimer;
@@ -93,12 +93,12 @@ private:
     QTimer _relativeDownloadDelayTimer;
 
     // the device measured
-    GETFileJob *_relativeLimitCurrentMeasuredJob;
+    GETFileJob *_relativeLimitCurrentMeasuredJob = nullptr;
 
     // for measuring how much progress we made at start
     qint64 _relativeDownloadLimitProgressAtMeasuringRestart = 0LL;
 
-    qint64 _currentDownloadLimit;
+    qint64 _currentDownloadLimit = 0;
 };
 
 } // namespace OCC
index d54a744d194afaf08ac04ed5524ea647f93b5cbf..877703bfadb86e118760d5f3a7b2f5300c534586 100644 (file)
@@ -348,10 +348,6 @@ DiscoverySingleDirectoryJob::DiscoverySingleDirectoryJob(const AccountPtr &accou
     : QObject(parent)
     , _subPath(path)
     , _account(account)
-    , _ignoredFirst(false)
-    , _isRootPath(false)
-    , _isExternalStorage(false)
-    , _isE2eEncrypted(false)
 {
 }
 
index b2547be652c9eec1e8fee1e219b47e07eb33d138..a34b3fbe45a7e4c572d3467ae2efd11c2e73820d 100644 (file)
@@ -166,13 +166,13 @@ private:
     AccountPtr _account;
     // The first result is for the directory itself and need to be ignored.
     // This flag is true if it was already ignored.
-    bool _ignoredFirst;
+    bool _ignoredFirst = false;
     // Set to true if this is the root path and we need to check the data-fingerprint
-    bool _isRootPath;
+    bool _isRootPath = false;
     // If this directory is an external storage (The first item has 'M' in its permission)
-    bool _isExternalStorage;
+    bool _isExternalStorage = false;
     // If this directory is e2ee
-    bool _isE2eEncrypted;
+    bool _isE2eEncrypted = false;
     // If set, the discovery will finish with an error
     int64_t _size = 0;
     QString _error;
index f1f73bdfa20e922c78c824a6dd1ef06a4e43f691..1dfaa4900b2208c1cce12ea59905d83215538769 100644 (file)
@@ -418,8 +418,6 @@ namespace {
 
 CheckServerJob::CheckServerJob(AccountPtr account, QObject *parent)
     : AbstractNetworkJob(account, QLatin1String(statusphpC), parent)
-    , _subdirFallback(false)
-    , _permanentRedirects(0)
 {
     setIgnoreCredentialFailure(true);
     connect(this, &AbstractNetworkJob::redirected,
index fb95360430ff2dbb753b8ebe65a5117c20b7f462..8b8ae88707ba77037c381d101dd58eb6708062fb 100644 (file)
@@ -347,7 +347,7 @@ private slots:
     void slotRedirected(QNetworkReply *reply, const QUrl &targetUrl, int redirectCount);
 
 private:
-    bool _subdirFallback;
+    bool _subdirFallback = false;
 
     /** The permanent-redirect adjusted account url.
      *
@@ -357,7 +357,7 @@ private:
     QUrl _serverUrl;
 
     /** Keep track of how many permanent redirect were applied. */
-    int _permanentRedirects;
+    int _permanentRedirects = 0;
 };
 
 
index 0143f8f6f43be9eab95daf220dbf43d961500943..fe46ca4ddd4284868d24be5262128132aef65eeb 100644 (file)
@@ -1056,7 +1056,6 @@ bool OwncloudPropagator::isInBulkUploadBlackList(const QString &file) const
 
 PropagatorJob::PropagatorJob(OwncloudPropagator *propagator)
     : QObject(propagator)
-    , _state(NotYetStarted)
 {
 }
 
index afd364dc91cde973a30f82edd5be33652f94fdeb..1b4ca98b617b81c1e5e18134de776462cf00e8f2 100644 (file)
@@ -81,7 +81,7 @@ public:
         Running,
         Finished
     };
-    JobState _state;
+    JobState _state = NotYetStarted;
 
     Q_ENUM(JobState)
 
@@ -188,12 +188,11 @@ protected slots:
 
 private:
     QScopedPointer<PropagateItemJob> _restoreJob;
-    JobParallelism _parallelism;
+    JobParallelism _parallelism = FullParallelism;
 
 public:
     PropagateItemJob(OwncloudPropagator *propagator, const SyncFileItemPtr &item)
         : PropagatorJob(propagator)
-        , _parallelism(FullParallelism)
         , _item(item)
     {
         // we should always execute jobs that process the E2EE API calls as sequential jobs
@@ -235,12 +234,11 @@ public:
     QVector<PropagatorJob *> _jobsToDo;
     SyncFileItemVector _tasksToDo;
     QVector<PropagatorJob *> _runningJobs;
-    SyncFileItem::Status _hasError; // NoStatus,  or NormalError / SoftError if there was an error
-    quint64 _abortsCount;
+    SyncFileItem::Status _hasError = SyncFileItem::NoStatus; // NoStatus,  or NormalError / SoftError if there was an error
+    quint64 _abortsCount = 0;
 
     explicit PropagatorCompositeJob(OwncloudPropagator *propagator)
         : PropagatorJob(propagator)
-        , _hasError(SyncFileItem::NoStatus), _abortsCount(0)
     {
     }
 
@@ -411,16 +409,14 @@ class OWNCLOUDSYNC_EXPORT OwncloudPropagator : public QObject
     Q_OBJECT
 public:
     SyncJournalDb *const _journal;
-    bool _finishedEmited; // used to ensure that finished is only emitted once
+    bool _finishedEmited = false; // used to ensure that finished is only emitted once
 
 public:
     OwncloudPropagator(AccountPtr account, const QString &localDir,
                        const QString &remoteFolder, SyncJournalDb *progressDb,
                        QSet<QString> &bulkUploadBlackList)
         : _journal(progressDb)
-        , _finishedEmited(false)
         , _bandwidthManager(this)
-        , _anotherSyncNeeded(false)
         , _chunkSize(10 * 1000 * 1000) // 10 MB, overridden in setSyncOptions
         , _account(account)
         , _localDir((localDir.endsWith(QChar('/'))) ? localDir : localDir + '/')
@@ -464,7 +460,7 @@ public:
     QList<PropagateItemJob *> _activeJobList;
 
     /** We detected that another sync is required after this one */
-    bool _anotherSyncNeeded;
+    bool _anotherSyncNeeded = false;
 
     /** Per-folder quota guesses.
      *
index cb9304d3e709c6adadfee45754b67c1bd13eb0ff..e6a7b133bf4becdb8f0f42ac1f375e8818ed4e76 100644 (file)
@@ -196,9 +196,6 @@ class PropagateDownloadFile : public PropagateItemJob
 public:
     PropagateDownloadFile(OwncloudPropagator *propagator, const SyncFileItemPtr &item)
         : PropagateItemJob(propagator, item)
-        , _resumeStart(0)
-        , _downloadProgress(0)
-        , _deleteExisting(false)
     {
     }
     void start() override;
@@ -249,11 +246,11 @@ private:
     void startAfterIsEncryptedIsChecked();
     void deleteExistingFolder();
 
-    qint64 _resumeStart;
-    qint64 _downloadProgress;
+    qint64 _resumeStart = 0;
+    qint64 _downloadProgress = 0;
     QPointer<GETFileJob> _job;
     QFile _tmpFile;
-    bool _deleteExisting;
+    bool _deleteExisting = false;
     bool _isEncrypted = false;
     EncryptedFile _encryptedInfo;
     ConflictRecord _conflictRecord;
index 0a2eb2a3cb1eaf39cd8a7dbb310425526f2ba684..88401dbd5f14791dcfba1fe4c8ff6010d95cee6d 100644 (file)
@@ -31,8 +31,6 @@ Q_LOGGING_CATEGORY(lcPropagateRemoteMkdir, "nextcloud.sync.propagator.remotemkdi
 
 PropagateRemoteMkdir::PropagateRemoteMkdir(OwncloudPropagator *propagator, const SyncFileItemPtr &item)
     : PropagateItemJob(propagator, item)
-    , _deleteExisting(false)
-    , _uploadEncryptedHelper(nullptr)
 {
     const auto path = _item->_file;
     const auto slashPosition = path.lastIndexOf('/');
index a48fad0e98dc5107967c1a442f50d1075f42cfb8..2ba9fbc39aaf0d62a005dfeb25658355f9b847b7 100644 (file)
@@ -28,8 +28,8 @@ class PropagateRemoteMkdir : public PropagateItemJob
 {
     Q_OBJECT
     QPointer<AbstractNetworkJob> _job;
-    bool _deleteExisting;
-    PropagateUploadEncrypted *_uploadEncryptedHelper;
+    bool _deleteExisting = false;
+    PropagateUploadEncrypted *_uploadEncryptedHelper = nullptr;
     friend class PropagateDirectory; // So it can access the _item;
 public:
     PropagateRemoteMkdir(OwncloudPropagator *propagator, const SyncFileItemPtr &item);
index 658c9060d24c0f7dfec1ff22014889f75f40364e..832999d75a3fd6d7fca71081e214d71b933bca7a 100644 (file)
@@ -173,8 +173,6 @@ PropagateUploadFileCommon::PropagateUploadFileCommon(OwncloudPropagator *propaga
     , _finished(false)
     , _deleteExisting(false)
     , _aborting(false)
-    , _uploadEncryptedHelper(nullptr)
-    , _uploadingEncrypted(false)
 {
     const auto path = _item->_file;
     const auto slashPosition = path.lastIndexOf('/');
index c536b7d5548040d1b74954bad632f208d4e8e791..2340108e475249c91f292a83b4f9fa2ec08688e6 100644 (file)
@@ -317,8 +317,8 @@ protected:
     /** Bases headers that need to be sent on the PUT, or in the MOVE for chunking-ng */
     QMap<QByteArray, QByteArray> headers();
 private:
-  PropagateUploadEncrypted *_uploadEncryptedHelper;
-  bool _uploadingEncrypted;
+  PropagateUploadEncrypted *_uploadEncryptedHelper = nullptr;
+  bool _uploadingEncrypted = false;
   UploadStatus _uploadStatus;
 };
 
index 5bfa0ce814a97f9392df6cda5078546378acecf6..28cad7f17a7006861cae4274879fda8013946ad6 100644 (file)
@@ -58,7 +58,6 @@ class PropagateLocalMkdir : public PropagateItemJob
 public:
     PropagateLocalMkdir(OwncloudPropagator *propagator, const SyncFileItemPtr &item)
         : PropagateItemJob(propagator, item)
-        , _deleteExistingFile(false)
     {
     }
     void start() override;
@@ -75,7 +74,7 @@ private:
     void startLocalMkdir();
     void startDemanglingName(const QString &parentPath);
 
-    bool _deleteExistingFile;
+    bool _deleteExistingFile = false;
 };
 
 /**
index fe89c34e1febce16fa5ca7ebb11233217f8ba87f..b74b05bf3a95cf25c051048ac67b41373fd7dfe8 100644 (file)
@@ -89,18 +89,11 @@ SyncEngine::SyncEngine(AccountPtr account,
                        const QString &remotePath,
                        OCC::SyncJournalDb *journal)
     : _account(account)
-    , _needsUpdate(false)
-    , _syncRunning(false)
     , _localPath(localPath)
     , _remotePath(remotePath)
     , _journal(journal)
     , _progressInfo(new ProgressInfo)
-    , _hasNoneFiles(false)
-    , _hasRemoveFile(false)
-    , _uploadLimit(0)
-    , _downloadLimit(0)
     , _syncOptions(syncOptions)
-    , _anotherSyncNeeded(NoFollowUpSync)
 {
     qRegisterMetaType<SyncFileItem>("SyncFileItem");
     qRegisterMetaType<SyncFileItemPtr>("SyncFileItemPtr");
index e7db1565dd2f1eb9e849a2aaadbd97dc3ed96f5b..88e0cba8b1364f1afac95be9b3874000f7e6f334 100644 (file)
@@ -313,8 +313,8 @@ private:
     QVector<SyncFileItemPtr> _syncItems;
 
     AccountPtr _account;
-    bool _needsUpdate;
-    bool _syncRunning;
+    bool _needsUpdate = false;
+    bool _syncRunning = false;
     QString _localPath;
     QString _remotePath;
     QByteArray _remoteRootEtag;
@@ -346,20 +346,20 @@ private:
     void restoreOldFiles(SyncFileItemVector &syncItems);
 
     // true if there is at least one file which was not changed on the server
-    bool _hasNoneFiles;
+    bool _hasNoneFiles = false;
 
     // true if there is at leasr one file with instruction REMOVE
-    bool _hasRemoveFile;
+    bool _hasRemoveFile = false;
 
     // If ignored files should be ignored
     bool _ignore_hidden_files = false;
 
 
-    int _uploadLimit;
-    int _downloadLimit;
+    int _uploadLimit = 0;
+    int _downloadLimit = 0;
     SyncOptions _syncOptions;
 
-    AnotherSyncNeeded _anotherSyncNeeded;
+    AnotherSyncNeeded _anotherSyncNeeded = NoFollowUpSync;
 
     /** Stores the time since a job touched a file. */
     QMultiMap<QElapsedTimer, QString> _touchedFiles;