diff options
author | Hannah von Reth <hannah.vonreth@owncloud.com> | 2022-07-14 14:03:30 +0300 |
---|---|---|
committer | Hannah von Reth <hannah.vonreth@owncloud.com> | 2022-07-14 14:03:30 +0300 |
commit | bb4b664202c5eb729ab91e3c4e8e0d5ca16eff7a (patch) | |
tree | fc81c97e039fb306273a8e093ff8d0ee9b0c7a80 | |
parent | 4a71da558775c72a51a7e35032beca207e3fed6c (diff) |
Optimise map accesswork/optionalFind
-rw-r--r-- | src/libsync/discoveryphase.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/libsync/discoveryphase.cpp b/src/libsync/discoveryphase.cpp index b7d9f55b8..0dd14653d 100644 --- a/src/libsync/discoveryphase.cpp +++ b/src/libsync/discoveryphase.cpp @@ -438,13 +438,13 @@ void DiscoverySingleDirectoryJob::directoryListingIteratedSlot(const QString &fi if (!_ignoredFirst) { // The first entry is for the folder itself, we should process it differently. _ignoredFirst = true; - if (map.contains(QStringLiteral("permissions"))) { - auto perm = RemotePermissions::fromServerString(map.value(QStringLiteral("permissions"))); + if (auto it = Utility::optionalFind(map, QStringLiteral("permissions"))) { + auto perm = RemotePermissions::fromServerString(it->value()); emit firstDirectoryPermissions(perm); _isExternalStorage = perm.hasPermission(RemotePermissions::IsMounted); } - if (map.contains(QStringLiteral("data-fingerprint"))) { - _dataFingerprint = map.value(QStringLiteral("data-fingerprint")).toUtf8(); + if (auto it = Utility::optionalFind(map, QStringLiteral("data-fingerprint"))) { + _dataFingerprint = it->value().toUtf8(); if (_dataFingerprint.isEmpty()) { // Placeholder that means that the server supports the feature even if it did not set one. _dataFingerprint = "[empty]"; @@ -471,9 +471,9 @@ void DiscoverySingleDirectoryJob::directoryListingIteratedSlot(const QString &fi } //This works in concerto with the RequestEtagJob and the Folder object to check if the remote folder changed. - if (map.contains(QStringLiteral("getetag"))) { - if (_firstEtag.isEmpty()) { - _firstEtag = parseEtag(map.value(QStringLiteral("getetag")).toUtf8()); // for directory itself + if (_firstEtag.isEmpty()) { + if (auto it = Utility::optionalFind(map, QStringLiteral("getetag"))) { + _firstEtag = parseEtag(it->value().toUtf8()); // for directory itself } } } |