From 38a8e5ee03788ce2b96c7c22c157ad125bbef235 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 29 Oct 2015 15:01:29 +0100 Subject: [PATCH] Discovery: conding style: use const references for function parameters --- src/libsync/discoveryphase.cpp | 12 ++++++------ src/libsync/discoveryphase.h | 12 ++++++------ src/libsync/syncengine.cpp | 2 +- src/libsync/syncengine.h | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/libsync/discoveryphase.cpp b/src/libsync/discoveryphase.cpp index d345af84d..71e39f9af 100644 --- a/src/libsync/discoveryphase.cpp +++ b/src/libsync/discoveryphase.cpp @@ -207,7 +207,7 @@ int get_errno_from_http_errcode( int err, const QString & reason ) { -DiscoverySingleDirectoryJob::DiscoverySingleDirectoryJob(AccountPtr account, const QString &path, QObject *parent) +DiscoverySingleDirectoryJob::DiscoverySingleDirectoryJob(const AccountPtr &account, const QString &path, QObject *parent) : QObject(parent), _subPath(path), _account(account), _ignoredFirst(false) { } @@ -237,7 +237,7 @@ void DiscoverySingleDirectoryJob::abort() } } -static csync_vio_file_stat_t* propertyMapToFileStat(QMap map) +static csync_vio_file_stat_t* propertyMapToFileStat(const QMap &map) { csync_vio_file_stat_t* file_stat = csync_vio_file_stat_new(); @@ -289,7 +289,7 @@ static csync_vio_file_stat_t* propertyMapToFileStat(QMap map) return file_stat; } -void DiscoverySingleDirectoryJob::directoryListingIteratedSlot(QString file,QMap map) +void DiscoverySingleDirectoryJob::directoryListingIteratedSlot(QString file, const QMap &map) { //qDebug() << Q_FUNC_INFO << _subPath << file << map.count() << map.keys() << _account->davPath() << _lsColJob->reply()->request().url().path(); if (!_ignoredFirst) { @@ -392,7 +392,7 @@ void DiscoveryMainThread::setupHooks(DiscoveryJob *discoveryJob, const QString & } // Coming from owncloud_opendir -> DiscoveryJob::vio_opendir_hook -> doOpendirSignal -void DiscoveryMainThread::doOpendirSlot(QString subPath, DiscoveryDirectoryResult *r) +void DiscoveryMainThread::doOpendirSlot(const QString &subPath, DiscoveryDirectoryResult *r) { QString fullPath = _pathPrefix; if (!_pathPrefix.endsWith('/')) { @@ -445,7 +445,7 @@ void DiscoveryMainThread::singleDirectoryJobResultSlot(const QList_vioMutex.unlock(); } -void DiscoveryMainThread::singleDirectoryJobFinishedWithErrorSlot(int csyncErrnoCode, QString msg) +void DiscoveryMainThread::singleDirectoryJobFinishedWithErrorSlot(int csyncErrnoCode, const QString &msg) { if (!_currentDiscoveryDirectoryResult) { return; // possibly aborted @@ -461,7 +461,7 @@ void DiscoveryMainThread::singleDirectoryJobFinishedWithErrorSlot(int csyncErrno _discoveryJob->_vioMutex.unlock(); } -void DiscoveryMainThread::singleDirectoryJobFirstDirectoryPermissionsSlot(QString p) +void DiscoveryMainThread::singleDirectoryJobFirstDirectoryPermissionsSlot(const QString &p) { // Should be thread safe since the sync thread is blocked if (!_discoveryJob->_csync_ctx->remote.root_perms) { diff --git a/src/libsync/discoveryphase.h b/src/libsync/discoveryphase.h index 71d126a07..6786065cc 100644 --- a/src/libsync/discoveryphase.h +++ b/src/libsync/discoveryphase.h @@ -80,7 +80,7 @@ struct DiscoveryDirectoryResult { class DiscoverySingleDirectoryJob : public QObject { Q_OBJECT public: - explicit DiscoverySingleDirectoryJob(AccountPtr account, const QString &path, QObject *parent = 0); + explicit DiscoverySingleDirectoryJob(const AccountPtr &account, const QString &path, QObject *parent = 0); void start(); void abort(); // This is not actually a network job, it is just a job @@ -89,9 +89,9 @@ signals: void etagConcatenation(const QString &); void etag(const QString &); void finishedWithResult(const QList &); - void finishedWithError(int csyncErrnoCode, QString msg); + void finishedWithError(int csyncErrnoCode, const QString &msg); private slots: - void directoryListingIteratedSlot(QString,QMap); + void directoryListingIteratedSlot(QString, const QMap&); void lsJobFinishedWithoutErrorSlot(); void lsJobFinishedWithErrorSlot(QNetworkReply*); private: @@ -125,13 +125,13 @@ public: public slots: // From DiscoveryJob: - void doOpendirSlot(QString url, DiscoveryDirectoryResult* ); + void doOpendirSlot(const QString &url, DiscoveryDirectoryResult* ); void doGetSizeSlot(const QString &path ,qint64 *result); // From Job: void singleDirectoryJobResultSlot(const QList &); - void singleDirectoryJobFinishedWithErrorSlot(int csyncErrnoCode, QString msg); - void singleDirectoryJobFirstDirectoryPermissionsSlot(QString); + void singleDirectoryJobFinishedWithErrorSlot(int csyncErrnoCode, const QString &msg); + void singleDirectoryJobFirstDirectoryPermissionsSlot(const QString&); void slotGetSizeFinishedWithError(); void slotGetSizeResult(const QVariantMap&); diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp index 4c9b294fc..2a5617356 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -698,7 +698,7 @@ void SyncEngine::startSync() QMetaObject::invokeMethod(discoveryJob, "start", Qt::QueuedConnection); } -void SyncEngine::slotRootEtagReceived(QString e) { +void SyncEngine::slotRootEtagReceived(const QString &e) { if (_remoteRootEtag.isEmpty()) { qDebug() << Q_FUNC_INFO << e; _remoteRootEtag = e; diff --git a/src/libsync/syncengine.h b/src/libsync/syncengine.h index 7c32c7e7a..5ba371b2b 100644 --- a/src/libsync/syncengine.h +++ b/src/libsync/syncengine.h @@ -94,7 +94,7 @@ signals: // During update, before reconcile void rootEtag(QString); - void folderDiscovered(bool local, QString folderUrl); + void folderDiscovered(bool local, const QString &folderUrl); // before actual syncing (after update+reconcile) for each item void syncItemDiscovered(const SyncFileItem&); @@ -118,7 +118,7 @@ signals: void newBigFolder(const QString &folder); private slots: - void slotRootEtagReceived(QString); + void slotRootEtagReceived(const QString &); void slotItemCompleted(const SyncFileItem& item, const PropagatorJob & job); void slotFinished(); void slotProgress(const SyncFileItem& item, quint64 curent);