Pārlūkot izejas kodu

move init to default value in class declaration

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>
Matthieu Gallien 3 gadi atpakaļ
vecāks
revīzija
079d392d36
54 mainītis faili ar 76 papildinājumiem un 153 dzēšanām
  1. 3 6
      src/3rdparty/qtokenizer/qtokenizer.h
  2. 1 3
      src/3rdparty/qtsingleapplication/qtsingleapplication.cpp
  3. 2 2
      src/3rdparty/qtsingleapplication/qtsingleapplication.h
  4. 0 2
      src/common/syncjournaldb.cpp
  5. 2 2
      src/common/syncjournaldb.h
  6. 0 2
      src/gui/accountsettings.cpp
  7. 2 2
      src/gui/accountsettings.h
  8. 0 1
      src/gui/accountstate.cpp
  9. 0 9
      src/gui/application.cpp
  10. 9 9
      src/gui/application.h
  11. 0 1
      src/gui/connectionvalidator.cpp
  12. 1 1
      src/gui/connectionvalidator.h
  13. 0 2
      src/gui/creds/flow2auth.cpp
  14. 2 2
      src/gui/creds/flow2auth.h
  15. 0 4
      src/gui/creds/webflowcredentialsdialog.cpp
  16. 2 2
      src/gui/creds/webflowcredentialsdialog.h
  17. 0 2
      src/gui/folder.cpp
  18. 2 2
      src/gui/folder.h
  19. 0 3
      src/gui/folderwizard.cpp
  20. 2 2
      src/gui/folderwizard.h
  21. 1 4
      src/gui/remotewipe.cpp
  22. 3 3
      src/gui/remotewipe.h
  23. 0 1
      src/gui/selectivesyncdialog.cpp
  24. 1 1
      src/gui/selectivesyncdialog.h
  25. 0 1
      src/gui/sslerrordialog.cpp
  26. 1 1
      src/gui/sslerrordialog.h
  27. 0 1
      src/gui/tray/unifiedsearchresultslistmodel.cpp
  28. 1 1
      src/gui/tray/unifiedsearchresultslistmodel.h
  29. 0 1
      src/gui/tray/usermodel.cpp
  30. 1 1
      src/gui/tray/usermodel.h
  31. 0 1
      src/gui/updater/ocupdater.cpp
  32. 1 1
      src/gui/updater/ocupdater.h
  33. 0 3
      src/gui/userinfo.cpp
  34. 3 3
      src/gui/userinfo.h
  35. 0 1
      src/gui/wizard/owncloudhttpcredspage.cpp
  36. 1 1
      src/gui/wizard/owncloudhttpcredspage.h
  37. 0 3
      src/libsync/abstractnetworkjob.cpp
  38. 3 3
      src/libsync/abstractnetworkjob.h
  39. 0 5
      src/libsync/bandwidthmanager.cpp
  40. 5 5
      src/libsync/bandwidthmanager.h
  41. 0 4
      src/libsync/discoveryphase.cpp
  42. 4 4
      src/libsync/discoveryphase.h
  43. 0 2
      src/libsync/networkjobs.cpp
  44. 2 2
      src/libsync/networkjobs.h
  45. 0 1
      src/libsync/owncloudpropagator.cpp
  46. 6 10
      src/libsync/owncloudpropagator.h
  47. 3 6
      src/libsync/propagatedownload.h
  48. 0 2
      src/libsync/propagateremotemkdir.cpp
  49. 2 2
      src/libsync/propagateremotemkdir.h
  50. 0 2
      src/libsync/propagateupload.cpp
  51. 2 2
      src/libsync/propagateupload.h
  52. 1 2
      src/libsync/propagatorjobs.h
  53. 0 7
      src/libsync/syncengine.cpp
  54. 7 7
      src/libsync/syncengine.h

+ 3 - 6
src/3rdparty/qtokenizer/qtokenizer.h

@@ -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>

+ 1 - 3
src/3rdparty/qtsingleapplication/qtsingleapplication.cpp

@@ -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;
 

+ 2 - 2
src/3rdparty/qtsingleapplication/qtsingleapplication.h

@@ -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;

+ 0 - 2
src/common/syncjournaldb.cpp

@@ -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");

+ 2 - 2
src/common/syncjournaldb.h

@@ -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.
      *

+ 0 - 2
src/gui/accountsettings.cpp

@@ -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);
 

+ 2 - 2
src/gui/accountsettings.h

@@ -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;
 };

+ 0 - 1
src/gui/accountstate.cpp

@@ -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)

+ 0 - 9
src/gui/application.cpp

@@ -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();
 

+ 9 - 9
src/gui/application.h

@@ -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;

+ 0 - 1
src/gui/connectionvalidator.cpp

@@ -40,7 +40,6 @@ ConnectionValidator::ConnectionValidator(AccountStatePtr accountState, QObject *
     : QObject(parent)
     , _accountState(accountState)
     , _account(accountState->account())
-    , _isCheckingServerAndAuth(false)
 {
 }
 

+ 1 - 1
src/gui/connectionvalidator.h

@@ -140,7 +140,7 @@ private:
     QStringList _errors;
     AccountStatePtr _accountState;
     AccountPtr _account;
-    bool _isCheckingServerAndAuth;
+    bool _isCheckingServerAndAuth = false;
 };
 }
 

+ 0 - 2
src/gui/creds/flow2auth.cpp

@@ -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);

+ 2 - 2
src/gui/creds/flow2auth.h

@@ -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;
 };
 

+ 0 - 4
src/gui/creds/webflowcredentialsdialog.cpp

@@ -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);
 

+ 2 - 2
src/gui/creds/webflowcredentialsdialog.h

@@ -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;

+ 0 - 2
src/gui/folder.cpp

@@ -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())

+ 2 - 2
src/gui/folder.h

@@ -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;
 

+ 0 - 3
src/gui/folderwizard.cpp

@@ -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);

+ 2 - 2
src/gui/folderwizard.h

@@ -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;
 };
 

+ 1 - 4
src/gui/remotewipe.cpp

@@ -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 *) {

+ 3 - 3
src/gui/remotewipe.h

@@ -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;
 };

+ 0 - 1
src/gui/selectivesyncdialog.cpp

@@ -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);

+ 1 - 1
src/gui/selectivesyncdialog.h

@@ -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;

+ 0 - 1
src/gui/sslerrordialog.cpp

@@ -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)
 {

+ 1 - 1
src/gui/sslerrordialog.h

@@ -56,7 +56,7 @@ public:
 
 private:
     [[nodiscard]] QString styleSheet() const;
-    bool _allTrusted;
+    bool _allTrusted = false;
 
     [[nodiscard]] QString certDiv(QSslCertificate) const;
 

+ 0 - 1
src/gui/tray/unifiedsearchresultslistmodel.cpp

@@ -194,7 +194,6 @@ Q_LOGGING_CATEGORY(lcUnifiedSearch, "nextcloud.gui.unifiedsearch", QtInfoMsg)
 
 UnifiedSearchResultsListModel::UnifiedSearchResultsListModel(AccountState *accountState, QObject *parent)
     : QAbstractListModel(parent)
-    , _waitingForSearchTermEditEnd(false)
     , _accountState(accountState)
 {
 }

+ 1 - 1
src/gui/tray/unifiedsearchresultslistmodel.h

@@ -126,7 +126,7 @@ private:
 
     QString _searchTerm;
     QString _errorString;
-    bool _waitingForSearchTermEditEnd;
+    bool _waitingForSearchTermEditEnd = false;
 
     QString _currentFetchMoreInProgressProviderId;
 

+ 0 - 1
src/gui/tray/usermodel.cpp

@@ -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);

+ 1 - 1
src/gui/tray/usermodel.h

@@ -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

+ 0 - 1
src/gui/updater/ocupdater.cpp

@@ -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))
 {

+ 1 - 1
src/gui/updater/ocupdater.h

@@ -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;

+ 0 - 3
src/gui/userinfo.cpp

@@ -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);

+ 3 - 3
src/gui/userinfo.h

@@ -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
 };
 

+ 0 - 1
src/gui/wizard/owncloudhttpcredspage.cpp

@@ -28,7 +28,6 @@ namespace OCC {
 OwncloudHttpCredsPage::OwncloudHttpCredsPage(QWidget *parent)
     : AbstractCredentialsWizardPage()
     , _ui()
-    , _connected(false)
     , _progressIndi(new QProgressIndicator(this))
 {
     _ui.setupUi(this);

+ 1 - 1
src/gui/wizard/owncloudhttpcredspage.h

@@ -56,7 +56,7 @@ private:
     void customizeStyle();
 
     Ui_OwncloudHttpCredsPage _ui;
-    bool _connected;
+    bool _connected = false;
     QProgressIndicator *_progressIndi;
     OwncloudWizard *_ocWizard;
 };

+ 0 - 3
src/libsync/abstractnetworkjob.cpp

@@ -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)
 {

+ 3 - 3
src/libsync/abstractnetworkjob.h

@@ -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;

+ 0 - 5
src/libsync/bandwidthmanager.cpp

@@ -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;

+ 5 - 5
src/libsync/bandwidthmanager.h

@@ -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

+ 0 - 4
src/libsync/discoveryphase.cpp

@@ -348,10 +348,6 @@ DiscoverySingleDirectoryJob::DiscoverySingleDirectoryJob(const AccountPtr &accou
     : QObject(parent)
     , _subPath(path)
     , _account(account)
-    , _ignoredFirst(false)
-    , _isRootPath(false)
-    , _isExternalStorage(false)
-    , _isE2eEncrypted(false)
 {
 }
 

+ 4 - 4
src/libsync/discoveryphase.h

@@ -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;

+ 0 - 2
src/libsync/networkjobs.cpp

@@ -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,

+ 2 - 2
src/libsync/networkjobs.h

@@ -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;
 };
 
 

+ 0 - 1
src/libsync/owncloudpropagator.cpp

@@ -1056,7 +1056,6 @@ bool OwncloudPropagator::isInBulkUploadBlackList(const QString &file) const
 
 PropagatorJob::PropagatorJob(OwncloudPropagator *propagator)
     : QObject(propagator)
-    , _state(NotYetStarted)
 {
 }
 

+ 6 - 10
src/libsync/owncloudpropagator.h

@@ -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.
      *

+ 3 - 6
src/libsync/propagatedownload.h

@@ -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;

+ 0 - 2
src/libsync/propagateremotemkdir.cpp

@@ -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('/');

+ 2 - 2
src/libsync/propagateremotemkdir.h

@@ -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);

+ 0 - 2
src/libsync/propagateupload.cpp

@@ -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('/');

+ 2 - 2
src/libsync/propagateupload.h

@@ -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;
 };
 

+ 1 - 2
src/libsync/propagatorjobs.h

@@ -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;
 };
 
 /**

+ 0 - 7
src/libsync/syncengine.cpp

@@ -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");

+ 7 - 7
src/libsync/syncengine.h

@@ -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;