From: Matthieu Gallien Date: Mon, 6 Feb 2023 09:38:59 +0000 (+0100) Subject: move init to default value in class declaration X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~11^2~9^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=db880a33888a6eac59f948467948dee1a778f2ba;p=nextcloud-desktop.git 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 --- diff --git a/src/3rdparty/qtokenizer/qtokenizer.h b/src/3rdparty/qtokenizer/qtokenizer.h index 0eda45a66..e1b856c3b 100644 --- a/src/3rdparty/qtokenizer/qtokenizer.h +++ b/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 diff --git a/src/3rdparty/qtsingleapplication/qtsingleapplication.cpp b/src/3rdparty/qtsingleapplication/qtsingleapplication.cpp index 422608d1a..70e5a6969 100644 --- a/src/3rdparty/qtsingleapplication/qtsingleapplication.cpp +++ b/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; diff --git a/src/3rdparty/qtsingleapplication/qtsingleapplication.h b/src/3rdparty/qtsingleapplication/qtsingleapplication.h index cb9c80b5d..272560712 100644 --- a/src/3rdparty/qtsingleapplication/qtsingleapplication.h +++ b/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; diff --git a/src/common/syncjournaldb.cpp b/src/common/syncjournaldb.cpp index 84668ed26..fc3c4149f 100644 --- a/src/common/syncjournaldb.cpp +++ b/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"); diff --git a/src/common/syncjournaldb.h b/src/common/syncjournaldb.h index 4660e9357..07803084e 100644 --- a/src/common/syncjournaldb.h +++ b/src/common/syncjournaldb.h @@ -418,8 +418,8 @@ private: QString _dbFile; QRecursiveMutex _mutex; // Public functions are protected with the mutex. QMap _checksymTypeCache; - int _transaction; - bool _metadataTableIsEmpty; + int _transaction = 0; + bool _metadataTableIsEmpty = false; /* Storing etags to these folders, or their parent folders, is filtered out. * diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index 51ac7cd35..876498bbc 100644 --- a/src/gui/accountsettings.cpp +++ b/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); diff --git a/src/gui/accountsettings.h b/src/gui/accountsettings.h index 7a3cd2df0..be70931d8 100644 --- a/src/gui/accountsettings.h +++ b/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 _folderConnections; }; diff --git a/src/gui/accountstate.cpp b/src/gui/accountstate.cpp index feec1f4c9..372fa218f 100644 --- a/src/gui/accountstate.cpp +++ b/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) diff --git a/src/gui/application.cpp b/src/gui/application.cpp index 45a806230..4ba331689 100644 --- a/src/gui/application.cpp +++ b/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(); diff --git a/src/gui/application.h b/src/gui/application.h index 8ae193264..9b6bad9eb 100644 --- a/src/gui/application.h +++ b/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; diff --git a/src/gui/connectionvalidator.cpp b/src/gui/connectionvalidator.cpp index 5868d72e2..515c47f8a 100644 --- a/src/gui/connectionvalidator.cpp +++ b/src/gui/connectionvalidator.cpp @@ -40,7 +40,6 @@ ConnectionValidator::ConnectionValidator(AccountStatePtr accountState, QObject * : QObject(parent) , _accountState(accountState) , _account(accountState->account()) - , _isCheckingServerAndAuth(false) { } diff --git a/src/gui/connectionvalidator.h b/src/gui/connectionvalidator.h index 920f63175..354d5a818 100644 --- a/src/gui/connectionvalidator.h +++ b/src/gui/connectionvalidator.h @@ -140,7 +140,7 @@ private: QStringList _errors; AccountStatePtr _accountState; AccountPtr _account; - bool _isCheckingServerAndAuth; + bool _isCheckingServerAndAuth = false; }; } diff --git a/src/gui/creds/flow2auth.cpp b/src/gui/creds/flow2auth.cpp index 1526921b8..f90873dbc 100644 --- a/src/gui/creds/flow2auth.cpp +++ b/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); diff --git a/src/gui/creds/flow2auth.h b/src/gui/creds/flow2auth.h index 35efb721c..adac4d39b 100644 --- a/src/gui/creds/flow2auth.h +++ b/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; }; diff --git a/src/gui/creds/webflowcredentialsdialog.cpp b/src/gui/creds/webflowcredentialsdialog.cpp index 19db3430b..4ec6747fc 100644 --- a/src/gui/creds/webflowcredentialsdialog.cpp +++ b/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); diff --git a/src/gui/creds/webflowcredentialsdialog.h b/src/gui/creds/webflowcredentialsdialog.h index b684603d7..86abe8af3 100644 --- a/src/gui/creds/webflowcredentialsdialog.h +++ b/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; diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp index ea933758d..38db18d55 100644 --- a/src/gui/folder.cpp +++ b/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()) diff --git a/src/gui/folder.h b/src/gui/folder.h index 9e6de5797..2d0a8edc4 100644 --- a/src/gui/folder.h +++ b/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; diff --git a/src/gui/folderwizard.cpp b/src/gui/folderwizard.cpp index e13733398..99d147f62 100644 --- a/src/gui/folderwizard.cpp +++ b/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); diff --git a/src/gui/folderwizard.h b/src/gui/folderwizard.h index 393c0ad33..e0aeecc5c 100644 --- a/src/gui/folderwizard.h +++ b/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; }; diff --git a/src/gui/remotewipe.cpp b/src/gui/remotewipe.cpp index 73af19f71..362ab0386 100644 --- a/src/gui/remotewipe.cpp +++ b/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 *) { diff --git a/src/gui/remotewipe.h b/src/gui/remotewipe.h index f57ec8043..2a2a0ad9e 100644 --- a/src/gui/remotewipe.h +++ b/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; }; diff --git a/src/gui/selectivesyncdialog.cpp b/src/gui/selectivesyncdialog.cpp index 692306e4b..4f4ca1ec1 100644 --- a/src/gui/selectivesyncdialog.cpp +++ b/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); diff --git a/src/gui/selectivesyncdialog.h b/src/gui/selectivesyncdialog.h index acf8a6f4b..92f45f3d7 100644 --- a/src/gui/selectivesyncdialog.h +++ b/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; diff --git a/src/gui/sslerrordialog.cpp b/src/gui/sslerrordialog.cpp index 7b97a657a..bd3eee0b4 100644 --- a/src/gui/sslerrordialog.cpp +++ b/src/gui/sslerrordialog.cpp @@ -57,7 +57,6 @@ bool SslDialogErrorHandler::handleErrors(QList errors, const QSslConf SslErrorDialog::SslErrorDialog(AccountPtr account, QWidget *parent) : QDialog(parent) - , _allTrusted(false) , _ui(new Ui::SslErrorDialog) , _account(account) { diff --git a/src/gui/sslerrordialog.h b/src/gui/sslerrordialog.h index 597227e76..5d779ff34 100644 --- a/src/gui/sslerrordialog.h +++ b/src/gui/sslerrordialog.h @@ -56,7 +56,7 @@ public: private: [[nodiscard]] QString styleSheet() const; - bool _allTrusted; + bool _allTrusted = false; [[nodiscard]] QString certDiv(QSslCertificate) const; diff --git a/src/gui/tray/unifiedsearchresultslistmodel.cpp b/src/gui/tray/unifiedsearchresultslistmodel.cpp index 5f951c07c..6ec9a7a2a 100644 --- a/src/gui/tray/unifiedsearchresultslistmodel.cpp +++ b/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) { } diff --git a/src/gui/tray/unifiedsearchresultslistmodel.h b/src/gui/tray/unifiedsearchresultslistmodel.h index 539b4f59c..24beea864 100644 --- a/src/gui/tray/unifiedsearchresultslistmodel.h +++ b/src/gui/tray/unifiedsearchresultslistmodel.h @@ -126,7 +126,7 @@ private: QString _searchTerm; QString _errorString; - bool _waitingForSearchTermEditEnd; + bool _waitingForSearchTermEditEnd = false; QString _currentFetchMoreInProgressProviderId; diff --git a/src/gui/tray/usermodel.cpp b/src/gui/tray/usermodel.cpp index a26a054cd..a057248ce 100644 --- a/src/gui/tray/usermodel.cpp +++ b/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); diff --git a/src/gui/tray/usermodel.h b/src/gui/tray/usermodel.h index c49cd9990..a9c7d1f2e 100644 --- a/src/gui/tray/usermodel.h +++ b/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 diff --git a/src/gui/updater/ocupdater.cpp b/src/gui/updater/ocupdater.cpp index b44a0d18a..833cc2a3a 100644 --- a/src/gui/updater/ocupdater.cpp +++ b/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)) { diff --git a/src/gui/updater/ocupdater.h b/src/gui/updater/ocupdater.h index 1bbf8b859..494d12841 100644 --- a/src/gui/updater/ocupdater.h +++ b/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; diff --git a/src/gui/userinfo.cpp b/src/gui/userinfo.cpp index b13f1a724..1c111d736 100644 --- a/src/gui/userinfo.cpp +++ b/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); diff --git a/src/gui/userinfo.h b/src/gui/userinfo.h index eaad8db19..f01c7502f 100644 --- a/src/gui/userinfo.h +++ b/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 _job; // the currently running job }; diff --git a/src/gui/wizard/owncloudhttpcredspage.cpp b/src/gui/wizard/owncloudhttpcredspage.cpp index cab2a7427..ed514b72a 100644 --- a/src/gui/wizard/owncloudhttpcredspage.cpp +++ b/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); diff --git a/src/gui/wizard/owncloudhttpcredspage.h b/src/gui/wizard/owncloudhttpcredspage.h index 915482b97..6a5f5db66 100644 --- a/src/gui/wizard/owncloudhttpcredspage.h +++ b/src/gui/wizard/owncloudhttpcredspage.h @@ -56,7 +56,7 @@ private: void customizeStyle(); Ui_OwncloudHttpCredsPage _ui; - bool _connected; + bool _connected = false; QProgressIndicator *_progressIndi; OwncloudWizard *_ocWizard; }; diff --git a/src/libsync/abstractnetworkjob.cpp b/src/libsync/abstractnetworkjob.cpp index ef2dc75f4..cb31cd6f4 100644 --- a/src/libsync/abstractnetworkjob.cpp +++ b/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) { diff --git a/src/libsync/abstractnetworkjob.h b/src/libsync/abstractnetworkjob.h index 6af5b207c..2e2a45b22 100644 --- a/src/libsync/abstractnetworkjob.h +++ b/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 _reply; // (QPointer because the NetworkManager may be destroyed before the jobs at exit) QString _path; QTimer _timer; diff --git a/src/libsync/bandwidthmanager.cpp b/src/libsync/bandwidthmanager.cpp index a8dd2a6b1..d70943774 100644 --- a/src/libsync/bandwidthmanager.cpp +++ b/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; diff --git a/src/libsync/bandwidthmanager.h b/src/libsync/bandwidthmanager.h index dac0d78a1..eb902f34b 100644 --- a/src/libsync/bandwidthmanager.h +++ b/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 _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 diff --git a/src/libsync/discoveryphase.cpp b/src/libsync/discoveryphase.cpp index d54a744d1..877703bfa 100644 --- a/src/libsync/discoveryphase.cpp +++ b/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) { } diff --git a/src/libsync/discoveryphase.h b/src/libsync/discoveryphase.h index b2547be65..a34b3fbe4 100644 --- a/src/libsync/discoveryphase.h +++ b/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; diff --git a/src/libsync/networkjobs.cpp b/src/libsync/networkjobs.cpp index f1f73bdfa..1dfaa4900 100644 --- a/src/libsync/networkjobs.cpp +++ b/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, diff --git a/src/libsync/networkjobs.h b/src/libsync/networkjobs.h index fb9536043..8b8ae8870 100644 --- a/src/libsync/networkjobs.h +++ b/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; }; diff --git a/src/libsync/owncloudpropagator.cpp b/src/libsync/owncloudpropagator.cpp index 0143f8f6f..fe46ca4dd 100644 --- a/src/libsync/owncloudpropagator.cpp +++ b/src/libsync/owncloudpropagator.cpp @@ -1056,7 +1056,6 @@ bool OwncloudPropagator::isInBulkUploadBlackList(const QString &file) const PropagatorJob::PropagatorJob(OwncloudPropagator *propagator) : QObject(propagator) - , _state(NotYetStarted) { } diff --git a/src/libsync/owncloudpropagator.h b/src/libsync/owncloudpropagator.h index afd364dc9..1b4ca98b6 100644 --- a/src/libsync/owncloudpropagator.h +++ b/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 _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 _jobsToDo; SyncFileItemVector _tasksToDo; QVector _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 &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 _activeJobList; /** We detected that another sync is required after this one */ - bool _anotherSyncNeeded; + bool _anotherSyncNeeded = false; /** Per-folder quota guesses. * diff --git a/src/libsync/propagatedownload.h b/src/libsync/propagatedownload.h index cb9304d3e..e6a7b133b 100644 --- a/src/libsync/propagatedownload.h +++ b/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 _job; QFile _tmpFile; - bool _deleteExisting; + bool _deleteExisting = false; bool _isEncrypted = false; EncryptedFile _encryptedInfo; ConflictRecord _conflictRecord; diff --git a/src/libsync/propagateremotemkdir.cpp b/src/libsync/propagateremotemkdir.cpp index 0a2eb2a3c..88401dbd5 100644 --- a/src/libsync/propagateremotemkdir.cpp +++ b/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('/'); diff --git a/src/libsync/propagateremotemkdir.h b/src/libsync/propagateremotemkdir.h index a48fad0e9..2ba9fbc39 100644 --- a/src/libsync/propagateremotemkdir.h +++ b/src/libsync/propagateremotemkdir.h @@ -28,8 +28,8 @@ class PropagateRemoteMkdir : public PropagateItemJob { Q_OBJECT QPointer _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); diff --git a/src/libsync/propagateupload.cpp b/src/libsync/propagateupload.cpp index 658c9060d..832999d75 100644 --- a/src/libsync/propagateupload.cpp +++ b/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('/'); diff --git a/src/libsync/propagateupload.h b/src/libsync/propagateupload.h index c536b7d55..2340108e4 100644 --- a/src/libsync/propagateupload.h +++ b/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 headers(); private: - PropagateUploadEncrypted *_uploadEncryptedHelper; - bool _uploadingEncrypted; + PropagateUploadEncrypted *_uploadEncryptedHelper = nullptr; + bool _uploadingEncrypted = false; UploadStatus _uploadStatus; }; diff --git a/src/libsync/propagatorjobs.h b/src/libsync/propagatorjobs.h index 5bfa0ce81..28cad7f17 100644 --- a/src/libsync/propagatorjobs.h +++ b/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; }; /** diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp index fe89c34e1..b74b05bf3 100644 --- a/src/libsync/syncengine.cpp +++ b/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"); qRegisterMetaType("SyncFileItemPtr"); diff --git a/src/libsync/syncengine.h b/src/libsync/syncengine.h index e7db1565d..88e0cba8b 100644 --- a/src/libsync/syncengine.h +++ b/src/libsync/syncengine.h @@ -313,8 +313,8 @@ private: QVector _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 _touchedFiles;