mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 15:06:08 +03:00
Merge pull request #1481 from asapelkin/for_loop_optimization
Avoiding copying in range-based loops
This commit is contained in:
commit
04a9f0313a
5 changed files with 9 additions and 9 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
|
||||
|
@ -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);
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue