diff --git a/src/browser/BrowserService.cpp b/src/browser/BrowserService.cpp index 9917ded3c..456028632 100644 --- a/src/browser/BrowserService.cpp +++ b/src/browser/BrowserService.cpp @@ -421,7 +421,7 @@ QList BrowserService::searchEntries(const QString& url, const StringPair if (DatabaseWidget* dbWidget = qobject_cast(m_dbTabWidget->widget(i))) { if (Database* db = dbWidget->database()) { // Check if database is connected with KeePassXC-Browser - for (const StringPair keyPair : keyList) { + for (const StringPair& keyPair : keyList) { QString key = db->metadata()->customData()->value(QLatin1String(ASSOCIATE_KEY_PREFIX) + keyPair.first); if (!key.isEmpty() && keyPair.second == key) { databases << db; diff --git a/src/core/Group.cpp b/src/core/Group.cpp index dab48ebd1..05cac41e9 100644 --- a/src/core/Group.cpp +++ b/src/core/Group.cpp @@ -926,7 +926,7 @@ bool Group::resolveAutoTypeEnabled() const } } -QStringList Group::locate(QString locateTerm, QString currentPath) +QStringList Group::locate(QString locateTerm, QString currentPath) const { // TODO: Replace with EntrySearcher QStringList response; @@ -934,15 +934,15 @@ QStringList Group::locate(QString locateTerm, QString currentPath) return response; } - for (Entry* entry : asConst(m_entries)) { + for (const Entry* entry : asConst(m_entries)) { QString entryPath = currentPath + entry->title(); if (entryPath.toLower().contains(locateTerm.toLower())) { response << entryPath; } } - for (Group* group : asConst(m_children)) { - for (QString path : group->locate(locateTerm, currentPath + group->name() + QString("/"))) { + for (const Group* group : asConst(m_children)) { + for (const QString& path : group->locate(locateTerm, currentPath + group->name() + QString("/"))) { response << path; } } diff --git a/src/core/Group.h b/src/core/Group.h index e2b55cbd4..3a9332c8e 100644 --- a/src/core/Group.h +++ b/src/core/Group.h @@ -118,7 +118,7 @@ public: Entry* findEntryByPath(QString entryPath); Group* findGroupByUuid(const QUuid& uuid); Group* findGroupByPath(QString groupPath); - QStringList locate(QString locateTerm, QString currentPath = {"/"}); + QStringList locate(QString locateTerm, QString currentPath = {"/"}) const; Entry* addEntryWithPath(QString entryPath); void setUuid(const QUuid& uuid); void setName(const QString& name); diff --git a/src/sshagent/OpenSSHKey.cpp b/src/sshagent/OpenSSHKey.cpp index 44684d620..9d1301a05 100644 --- a/src/sshagent/OpenSSHKey.cpp +++ b/src/sshagent/OpenSSHKey.cpp @@ -101,7 +101,7 @@ const QString OpenSSHKey::fingerprint(QCryptographicHash::Algorithm algo) const stream.writeString(m_type); - for (QByteArray ba : m_publicData) { + for (const QByteArray& ba : m_publicData) { stream.writeString(ba); } @@ -137,7 +137,7 @@ const QString OpenSSHKey::publicKey() const stream.writeString(m_type); - for (QByteArray ba : m_publicData) { + for (const QByteArray& ba : m_publicData) { stream.writeString(ba); } @@ -544,7 +544,7 @@ bool OpenSSHKey::writePublic(BinaryStream& stream) return false; } - for (QByteArray t : m_publicData) { + for (const QByteArray& t : m_publicData) { if (!stream.writeString(t)) { m_error = tr("Unexpected EOF when writing public key"); return false; @@ -566,7 +566,7 @@ bool OpenSSHKey::writePrivate(BinaryStream& stream) return false; } - for (QByteArray t : m_privateData) { + for (const QByteArray& t : m_privateData) { if (!stream.writeString(t)) { m_error = tr("Unexpected EOF when writing private key"); return false; diff --git a/src/sshagent/SSHAgent.cpp b/src/sshagent/SSHAgent.cpp index 758c86851..487398238 100644 --- a/src/sshagent/SSHAgent.cpp +++ b/src/sshagent/SSHAgent.cpp @@ -38,7 +38,7 @@ SSHAgent::SSHAgent(QObject* parent) SSHAgent::~SSHAgent() { - for (QSet keys : m_keys.values()) { + for (const QSet& keys : m_keys.values()) { for (OpenSSHKey key : keys) { removeIdentity(key); }