Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoiding copying in range-based loops #1481

Merged
merged 6 commits into from
Oct 9, 2019
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/csync/csync_exclude.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,8 @@ bool ExcludedFiles::reloadExcludeFiles()
_fullRegexDir.clear();

bool success = true;
for (auto basePath : _excludeFiles.keys()) {
for (auto file : _excludeFiles.value(basePath)) {
for (const auto& basePath : _excludeFiles.keys()) {
for (const auto& file : _excludeFiles.value(basePath)) {
success = loadExcludeFile(basePath, file);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/gui/socketapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ void SocketApi::command_GET_STRINGS(const QString &argument, SocketListener *lis
{ "EMAIL_PRIVATE_LINK_MENU_TITLE", tr("Send private link by email...") },
} };
listener->sendMessage(QString("GET_STRINGS:BEGIN"));
for (auto key_value : strings) {
for (const auto& key_value : strings) {
if (argument.isEmpty() || argument == QLatin1String(key_value.first)) {
listener->sendMessage(QString("STRING:%1:%2").arg(key_value.first, key_value.second));
}
Expand Down
4 changes: 2 additions & 2 deletions test/testsyncconflict.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ private slots:
QVERIFY(conflicts.size() == 2);
QVERIFY(conflicts[0].contains("A (conflicted copy"));
QVERIFY(conflicts[1].contains("B (conflicted copy"));
for (auto conflict : conflicts)
for (const auto& conflict : conflicts)
QDir(fakeFolder.localPath() + conflict).removeRecursively();
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());

Expand Down Expand Up @@ -581,7 +581,7 @@ private slots:
auto conflicts = findConflicts(fakeFolder.currentLocalState());
QVERIFY(conflicts.size() == 1);
QVERIFY(conflicts[0].contains("A (conflicted copy"));
for (auto conflict : conflicts)
for (const auto& conflict : conflicts)
QDir(fakeFolder.localPath() + conflict).removeRecursively();

QVERIFY(fakeFolder.syncEngine().isAnotherSyncNeeded() == ImmediateFollowUp);
Expand Down
4 changes: 2 additions & 2 deletions test/testsyncjournaldb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,12 +289,12 @@ private slots:
<< "foo bla bar/file"
<< "fo_"
<< "fo_/file";
for (auto elem : elements)
for (const auto& elem : elements)
makeEntry(elem);

auto checkElements = [&]() {
bool ok = true;
for (auto elem : elements) {
for (const auto& elem : elements) {
SyncJournalFileRecord record;
_db.getFileRecord(elem, &record);
if (!record.isValid()) {
Expand Down
4 changes: 2 additions & 2 deletions test/testsyncmove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -523,13 +523,13 @@ private slots:
auto currentLocal = fakeFolder.currentLocalState();
auto conflicts = findConflicts(currentLocal.children["A4"]);
QCOMPARE(conflicts.size(), 1);
for (auto c : conflicts) {
for (const auto& c : conflicts) {
QCOMPARE(currentLocal.find(c)->contentChar, 'L');
local.remove(c);
}
conflicts = findConflicts(currentLocal.children["B4"]);
QCOMPARE(conflicts.size(), 1);
for (auto c : conflicts) {
for (const auto& c : conflicts) {
QCOMPARE(currentLocal.find(c)->contentChar, 'L');
local.remove(c);
}
Expand Down