From 1b73011f598db065e66ebe04ce0d182ca352cedc Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Mon, 10 Jul 2023 17:20:23 +0800 Subject: [PATCH] Constify SyncJournalDb::findPathInSelectiveSyncList Signed-off-by: Claudio Cambra --- src/common/syncjournaldb.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/common/syncjournaldb.cpp b/src/common/syncjournaldb.cpp index 7cbc9b5407..fb192e21e3 100644 --- a/src/common/syncjournaldb.cpp +++ b/src/common/syncjournaldb.cpp @@ -207,24 +207,24 @@ bool SyncJournalDb::maybeMigrateDb(const QString &localPath, const QString &abso bool SyncJournalDb::findPathInSelectiveSyncList(const QStringList &list, const QString &path) { - Q_ASSERT(std::is_sorted(list.begin(), list.end())); + Q_ASSERT(std::is_sorted(list.cbegin(), list.cend())); - if (list.size() == 1 && list.first() == QLatin1String("/")) { + if (list.size() == 1 && list.first() == QStringLiteral("/")) { // Special case for the case "/" is there, it matches everything return true; } - QString pathSlash = path + QLatin1Char('/'); + const QString pathSlash = path + QLatin1Char('/'); // Since the list is sorted, we can do a binary search. // If the path is a prefix of another item or right after in the lexical order. - auto it = std::lower_bound(list.begin(), list.end(), pathSlash); + auto it = std::lower_bound(list.cbegin(), list.cend(), pathSlash); - if (it != list.end() && *it == pathSlash) { + if (it != list.cend() && *it == pathSlash) { return true; } - if (it == list.begin()) { + if (it == list.cbegin()) { return false; } --it;