Skip to content
This repository was archived by the owner on Mar 4, 2023. It is now read-only.

Commit d10761f

Browse files
committed
various code cleanups
1 parent 3f12f7d commit d10761f

25 files changed

+56
-56
lines changed

src/datasync/accountmanager.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -293,13 +293,13 @@ LoginRequest::LoginRequest(LoginRequestPrivate *d_ptr) :
293293

294294
LoginRequest::LoginRequest(const LoginRequest &other) = default;
295295

296-
LoginRequest::LoginRequest(LoginRequest &&other) = default;
296+
LoginRequest::LoginRequest(LoginRequest &&other) noexcept = default;
297297

298298
LoginRequest::~LoginRequest() = default;
299299

300300
LoginRequest &LoginRequest::operator=(const LoginRequest &other) = default;
301301

302-
LoginRequest &LoginRequest::operator=(LoginRequest &&other) = default;
302+
LoginRequest &LoginRequest::operator=(LoginRequest &&other) noexcept = default;
303303

304304
DeviceInfo LoginRequest::device() const
305305
{
@@ -354,13 +354,13 @@ DeviceInfo::DeviceInfo(const QUuid &deviceId, const QString &name, const QByteAr
354354

355355
DeviceInfo::DeviceInfo(const DeviceInfo &other) = default;
356356

357-
DeviceInfo::DeviceInfo(DeviceInfo &&other) = default;
357+
DeviceInfo::DeviceInfo(DeviceInfo &&other) noexcept = default;
358358

359359
DeviceInfo::~DeviceInfo() = default;
360360

361361
DeviceInfo &DeviceInfo::operator=(const DeviceInfo &other) = default;
362362

363-
DeviceInfo &DeviceInfo::operator=(DeviceInfo &&other) = default;
363+
DeviceInfo &DeviceInfo::operator=(DeviceInfo &&other) noexcept = default;
364364

365365
QUuid DeviceInfo::deviceId() const
366366
{
@@ -412,7 +412,7 @@ bool DeviceInfo::operator!=(const DeviceInfo &other) const
412412

413413
DeviceInfoPrivate::DeviceInfoPrivate(QUuid deviceId, QString name, QByteArray fingerprint) :
414414
QSharedData{},
415-
deviceId{std::move(deviceId)},
415+
deviceId{deviceId},
416416
name{std::move(name)},
417417
fingerprint{std::move(fingerprint)}
418418
{}

src/datasync/accountmanager.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ class Q_DATASYNC_EXPORT DeviceInfo
4040
//! Copy constructor
4141
DeviceInfo(const DeviceInfo &other);
4242
//! Move constructor
43-
DeviceInfo(DeviceInfo &&other);
43+
DeviceInfo(DeviceInfo &&other) noexcept;
4444
~DeviceInfo();
4545

4646
//! Copy-Assignment operator
4747
DeviceInfo &operator=(const DeviceInfo &other);
4848
//! Move-Assignment operator
49-
DeviceInfo &operator=(DeviceInfo &&other);
49+
DeviceInfo &operator=(DeviceInfo &&other) noexcept;
5050

5151
//! @readAcFn{DeviceInfo::deviceId}
5252
QUuid deviceId() const;
@@ -92,13 +92,13 @@ class Q_DATASYNC_EXPORT LoginRequest
9292
//! Copy constructor
9393
LoginRequest(const LoginRequest &other);
9494
//! Move constructor
95-
LoginRequest(LoginRequest &&other);
95+
LoginRequest(LoginRequest &&other) noexcept;
9696
~LoginRequest();
9797

9898
//! Copy-Assignment operator
9999
LoginRequest &operator=(const LoginRequest &other);
100100
//! Move-Assignment operator
101-
LoginRequest &operator=(LoginRequest &&other);
101+
LoginRequest &operator=(LoginRequest &&other) noexcept;
102102

103103
//! @readAcFn{LoginRequest::device}
104104
DeviceInfo device() const;

src/datasync/changecontroller.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -222,12 +222,12 @@ ChangeController::CachedObjectKey::CachedObjectKey() = default;
222222

223223
ChangeController::CachedObjectKey::CachedObjectKey(ObjectKey other, QUuid deviceId) :
224224
ObjectKey{std::move(other)},
225-
optionalDevice{std::move(deviceId)}
225+
optionalDevice{deviceId}
226226
{}
227227

228228
ChangeController::CachedObjectKey::CachedObjectKey(QByteArray hash, QUuid deviceId) :
229229
ObjectKey{},
230-
optionalDevice{std::move(deviceId)},
230+
optionalDevice{deviceId},
231231
_hash{std::move(hash)}
232232
{}
233233

src/datasync/cryptocontroller.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ QStringList CryptoController::allKeystoreKeys()
125125
QStringList CryptoController::availableKeystoreKeys()
126126
{
127127
QStringList keys;
128-
for(const auto &key : factory->allKeys()) {
128+
for(const auto &key : factory->allKeys()) { // clazy:exclude=range-loop
129129
if(factory->isAvailable(key))
130130
keys.append(key);
131131
}

src/datasync/datastore.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ QVariantList DataStore::search(int metaTypeId, const QString &query, SearchMode
146146

147147
void DataStore::iterate(int metaTypeId, const function<bool (QVariant)> &iterator) const
148148
{
149-
for(const auto &key : keys(metaTypeId)) {
149+
for(const auto &key : keys(metaTypeId)) { // clazy:exclude=range-loop
150150
if(!iterator(load(metaTypeId, key)))
151151
break;
152152
}

src/datasync/defaults.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ Defaults::Defaults(const QSharedPointer<DefaultsPrivate> &d) : //MAJOR pass by m
2929

3030
Defaults &Defaults::operator=(const Defaults &other) = default;
3131

32-
Defaults &Defaults::operator=(Defaults &&other) = default;
32+
Defaults &Defaults::operator=(Defaults &&other) noexcept = default;
3333

3434
Defaults::Defaults(const Defaults &other) = default;
3535

36-
Defaults::Defaults(Defaults &&other) = default;
36+
Defaults::Defaults(Defaults &&other) noexcept = default;
3737

3838
Defaults::~Defaults() = default;
3939

@@ -151,13 +151,13 @@ DatabaseRef::DatabaseRef(DatabaseRefPrivate *d) :
151151
d{d}
152152
{}
153153

154-
DatabaseRef::DatabaseRef(DatabaseRef &&other) :
154+
DatabaseRef::DatabaseRef(DatabaseRef &&other) noexcept :
155155
d{nullptr}
156156
{
157157
d.swap(other.d);
158158
}
159159

160-
DatabaseRef &DatabaseRef::operator=(DatabaseRef &&other)
160+
DatabaseRef &DatabaseRef::operator=(DatabaseRef &&other) noexcept
161161
{
162162
d.reset();
163163
d.swap(other.d);

src/datasync/defaults.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ class Q_DATASYNC_EXPORT DatabaseRef
3636
//! @private
3737
DatabaseRef(DatabaseRefPrivate *d);
3838
//! Move constructor
39-
DatabaseRef(DatabaseRef &&other);
39+
DatabaseRef(DatabaseRef &&other) noexcept;
4040
//! Move assignment operator
41-
DatabaseRef &operator=(DatabaseRef &&other);
41+
DatabaseRef &operator=(DatabaseRef &&other) noexcept;
4242

4343
//! Returns true if this reference points to a valid database
4444
bool isValid() const;
@@ -85,11 +85,11 @@ class Q_DATASYNC_EXPORT Defaults
8585
//! Copy constructor
8686
Defaults(const Defaults &other);
8787
//! Move constructor
88-
Defaults(Defaults &&other);
88+
Defaults(Defaults &&other) noexcept;
8989
//! Copy assignment operator
9090
Defaults &operator=(const Defaults &other);
9191
//! Move assignment operator
92-
Defaults &operator=(Defaults &&other);
92+
Defaults &operator=(Defaults &&other) noexcept;
9393
~Defaults();
9494

9595
//! Create a new logger instance

src/datasync/localstore.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,7 @@ LocalStore::SyncScope::SyncScope(const Defaults &defaults, const ObjectKey &key,
836836
}
837837
}
838838

839-
LocalStore::SyncScope::SyncScope(LocalStore::SyncScope &&other) :
839+
LocalStore::SyncScope::SyncScope(LocalStore::SyncScope &&other) noexcept :
840840
d()
841841
{
842842
d.swap(other.d);

src/datasync/localstore_p.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class Q_DATASYNC_EXPORT LocalStore : public QObject
3737
Q_DISABLE_COPY(SyncScope)
3838

3939
public:
40-
SyncScope(SyncScope &&other);
40+
SyncScope(SyncScope &&other) noexcept;
4141
~SyncScope();
4242

4343
private:

src/datasync/migrationhelper.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ void MigrationRunnable::run()
176176
//special: copy headers
177177
oldSettings->beginGroup(QStringLiteral("RemoteConnector/headers"));
178178
currentSettings->beginGroup(QStringLiteral("connector/") + RemoteConnector::keyRemoteHeaders);
179-
for(const auto &key : oldSettings->childKeys()) {
179+
for(const auto &key : oldSettings->childKeys()) { // clazy:exclude=range-loop
180180
copyConf(oldSettings, key,
181181
currentSettings, key);
182182
}

src/datasync/remoteconfig.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ RemoteConfig::RemoteConfig(const QUrl &url, const QString &accessKey, const Head
99

1010
RemoteConfig::RemoteConfig(const RemoteConfig &other) = default;
1111

12-
RemoteConfig::RemoteConfig(RemoteConfig &&other) = default;
12+
RemoteConfig::RemoteConfig(RemoteConfig &&other) noexcept = default;
1313

1414
RemoteConfig::~RemoteConfig() = default;
1515

1616
RemoteConfig &RemoteConfig::operator=(const RemoteConfig &other) = default;
1717

18-
RemoteConfig &RemoteConfig::operator=(RemoteConfig &&other) = default;
18+
RemoteConfig &RemoteConfig::operator=(RemoteConfig &&other) noexcept = default;
1919

2020
QUrl RemoteConfig::url() const
2121
{

src/datasync/remoteconfig.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ class Q_DATASYNC_EXPORT RemoteConfig
3737
//! Copy constructor
3838
RemoteConfig(const RemoteConfig &other);
3939
//! Move constructor
40-
RemoteConfig(RemoteConfig &&other);
40+
RemoteConfig(RemoteConfig &&other) noexcept;
4141
~RemoteConfig();
4242

4343
//! Copy-Assignment operator
4444
RemoteConfig &operator=(const RemoteConfig &other);
4545
//! Move-Assignment operator
46-
RemoteConfig &operator=(RemoteConfig &&other);
46+
RemoteConfig &operator=(RemoteConfig &&other) noexcept;
4747

4848
//! @readAcFn{RemoteConfig::url}
4949
QUrl url() const;

src/datasync/remoteconnector.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ void RemoteConnector::onEntryIdleState()
675675
if(_expectChanges) {
676676
_expectChanges = false;
677677
logDebug() << "Server has changes. Reloading states";
678-
remoteEvent(RemoteReadyWithChanges);
678+
emit remoteEvent(RemoteReadyWithChanges);
679679
} else
680680
emit remoteEvent(RemoteReady);
681681
}
@@ -823,7 +823,7 @@ QVariant RemoteConnector::sValue(const QString &key) const
823823
if(settings()->childGroups().contains(keyRemoteHeaders)) {
824824
settings()->beginGroup(keyRemoteHeaders);
825825
RemoteConfig::HeaderHash headers;
826-
for(const auto &hKey : settings()->childKeys())
826+
for(const auto &hKey : settings()->childKeys()) // clazy:exclude=range-loop
827827
headers.insert(hKey.toUtf8(), settings()->value(hKey).toByteArray());
828828
settings()->endGroup();
829829
return QVariant::fromValue(headers);

src/datasync/synchelper.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ void hashNext(QCryptographicHash &hash, const QJsonValue &value)
106106
hash.addData(value.toString().toUtf8());
107107
break;
108108
case QJsonValue::Array:
109-
for(auto v : value.toArray())
109+
for(auto v : value.toArray()) // clazy:exclude=range-loop
110110
hashNext(hash, v);
111111
break;
112112
case QJsonValue::Object:

src/datasync/userexchangemanager.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ void UserExchangeManager::readDatagram()
206206

207207
auto isSelf = false;
208208
if(datagram.senderPort() == d->socket->localPort()) {
209-
for(const auto &addr : QNetworkInterface::allAddresses()) {
209+
for(const auto &addr : QNetworkInterface::allAddresses()) { // clazy:exclude=range-loop
210210
if(addr.isEqual(datagram.senderAddress())) {
211211
isSelf = true;
212212
break;
@@ -254,7 +254,7 @@ void UserExchangeManager::readDatagram()
254254

255255
//try to find the already existing user info for that data
256256
bool found = false;
257-
for(const auto &key : d->devices.keys()) {
257+
for(const auto &key : d->devices.keys()) { // clazy:exclude=range-loop
258258
if(info == key) {
259259
found = true;
260260
if(isInfo) { //isInfo -> reset timeout, update name if neccessary
@@ -300,7 +300,7 @@ UserInfo::UserInfo() :
300300

301301
UserInfo::UserInfo(const UserInfo &other) = default;
302302

303-
UserInfo::UserInfo(UserInfo &&other) = default;
303+
UserInfo::UserInfo(UserInfo &&other) noexcept = default;
304304

305305
UserInfo::UserInfo(UserInfoPrivate *data) :
306306
d(data)
@@ -310,7 +310,7 @@ UserInfo::~UserInfo() = default;
310310

311311
UserInfo &UserInfo::operator=(const UserInfo &other) = default;
312312

313-
UserInfo &UserInfo::operator=(UserInfo &&other) = default;
313+
UserInfo &UserInfo::operator=(UserInfo &&other) noexcept = default;
314314

315315
QString UserInfo::name() const
316316
{

src/datasync/userexchangemanager.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ class Q_DATASYNC_EXPORT UserInfo
3232
//! Copy Constructor
3333
UserInfo(const UserInfo &other);
3434
//! Move constructor
35-
UserInfo(UserInfo &&other);
35+
UserInfo(UserInfo &&other) noexcept;
3636
//! @private
3737
UserInfo(UserInfoPrivate *data);
3838
~UserInfo();
3939

4040
//! Copy-Assignment operator
4141
UserInfo &operator=(const UserInfo &other);
4242
//! Move-Assignment operator
43-
UserInfo &operator=(UserInfo &&other);
43+
UserInfo &operator=(UserInfo &&other) noexcept;
4444

4545
//! @readAcFn{UserInfo::name}
4646
QString name() const;

src/messages/accessmessage.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ AccessMessage::AccessMessage(QString deviceName, QByteArray nonce, const QShared
1010
cryptKey,
1111
crypto},
1212
pNonce{std::move(pNonce)},
13-
partnerId{std::move(partnerId)},
13+
partnerId{partnerId},
1414
macscheme{std::move(macscheme)},
1515
cmac{std::move(cmac)},
1616
trustmac{std::move(trustmac)}

src/messages/accountmessage.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using namespace QtDataSync;
33

44
AccountMessage::AccountMessage(QUuid deviceId) :
5-
deviceId{std::move(deviceId)}
5+
deviceId{deviceId}
66
{}
77

88
const QMetaObject *AccountMessage::getMetaObject() const

src/messages/devicechangemessage.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ using namespace QtDataSync;
33

44
DeviceChangeMessage::DeviceChangeMessage(QByteArray dataId, QUuid deviceId) :
55
ChangeMessage{std::move(dataId)},
6-
deviceId{std::move(deviceId)}
6+
deviceId{deviceId}
77
{}
88

99
const QMetaObject *DeviceChangeMessage::getMetaObject() const

src/messages/loginmessage.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ using namespace QtDataSync;
33

44
LoginMessage::LoginMessage(QUuid deviceId, QString deviceName, QByteArray nonce) :
55
InitMessage{std::move(nonce)},
6-
deviceId{std::move(deviceId)},
6+
deviceId{deviceId},
77
deviceName{std::move(deviceName)}
88
{}
99

src/messages/message.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ Utf8String::Utf8String() = default;
209209

210210
Utf8String::Utf8String(const Utf8String &other) = default;
211211

212-
Utf8String::Utf8String(Utf8String &&other) = default;
212+
Utf8String::Utf8String(Utf8String &&other) noexcept = default;
213213

214214
Utf8String::Utf8String(const QByteArray &data) :
215215
QString(QString::fromUtf8(data))
@@ -219,13 +219,13 @@ Utf8String::Utf8String(const QString &other) :
219219
QString(other)
220220
{}
221221

222-
Utf8String::Utf8String(QString &&other) :
222+
Utf8String::Utf8String(QString &&other) noexcept :
223223
QString(std::move(other))
224224
{}
225225

226226
Utf8String &Utf8String::operator=(const Utf8String &other) = default;
227227

228-
Utf8String &Utf8String::operator=(Utf8String &&other) = default;
228+
Utf8String &Utf8String::operator=(Utf8String &&other) noexcept = default;
229229

230230
Utf8String &Utf8String::operator=(const QByteArray &other)
231231
{
@@ -239,7 +239,7 @@ Utf8String &Utf8String::operator=(const QString &other)
239239
return *this;
240240
}
241241

242-
Utf8String &Utf8String::operator=(QString &&other)
242+
Utf8String &Utf8String::operator=(QString &&other) noexcept
243243
{
244244
swap(other);
245245
return *this;

src/messages/message_p.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,16 @@ class Q_DATASYNC_EXPORT Utf8String : public QString
4141
public:
4242
Utf8String();
4343
Utf8String(const Utf8String &other);
44-
Utf8String(Utf8String &&other);
44+
Utf8String(Utf8String &&other) noexcept;
4545
Utf8String(const QByteArray &data);
4646
Utf8String(const QString &other);
47-
Utf8String(QString &&other);
47+
Utf8String(QString &&other) noexcept;
4848

4949
Utf8String &operator=(const Utf8String &other);
50-
Utf8String &operator=(Utf8String &&other);
50+
Utf8String &operator=(Utf8String &&other) noexcept;
5151
Utf8String &operator=(const QByteArray &other);
5252
Utf8String &operator=(const QString &other);
53-
Utf8String &operator=(QString &&other);
53+
Utf8String &operator=(QString &&other) noexcept;
5454
};
5555

5656
Q_DATASYNC_EXPORT QDataStream &operator<<(QDataStream &stream, const Utf8String &message);

0 commit comments

Comments
 (0)