Skip to content

Commit

Permalink
avoid for loops detaching the container when uneeded
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu Gallien <[email protected]>
  • Loading branch information
mgallien committed Oct 17, 2023
1 parent a46bc8e commit 8b0d6dc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/libsync/syncengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ void SyncEngine::slotDiscoveryFinished()
}

if (_discoveryPhase->_hasDownloadRemovedItems && _discoveryPhase->_hasUploadErrorItems) {
for (const auto &item : _syncItems) {
for (const auto &item : qAsConst(_syncItems)) {
if (item->_instruction == CSYNC_INSTRUCTION_ERROR && item->_direction == SyncFileItem::Up) {
item->_instruction = CSYNC_INSTRUCTION_IGNORE;
}
Expand Down
3 changes: 2 additions & 1 deletion test/testsecurefiledrop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ private slots:

bool isAnyFileDropFileMissing = false;

for (const auto &key : metadata->fileDrop().keys()) {
const auto allKeys = metadata->fileDrop().keys();
for (const auto &key : allKeys) {
if (std::find_if(metadata->files().constBegin(), metadata->files().constEnd(), [&key](const EncryptedFile &encryptedFile) {
return encryptedFile.encryptedFilename == key;
}) == metadata->files().constEnd()) {
Expand Down

0 comments on commit 8b0d6dc

Please sign in to comment.