Commit c9f67411 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

const'ref

parent 003de5c1
Pipeline #64840 passed with stage
in 40 minutes and 25 seconds
......@@ -630,7 +630,7 @@ void CryptoComposerTest::testSetGnupgHome()
}
const std::vector<GpgME::Key> &keys = Test::getKeys();
for (const auto key : keys) {
for (const auto &key : keys) {
Test::populateKeyring(dir.path(), key);
}
......@@ -695,7 +695,7 @@ void CryptoComposerTest::testAutocryptHeaders()
QCOMPARE(composer.exec(), false);
}
for (const auto key : keys) {
for (const auto &key : keys) {
Test::populateKeyring(dir.path(), key);
}
......
......@@ -275,7 +275,7 @@ void EncryptJobTest::testSetGnupgHome()
QCOMPARE(eJob->exec(), false);
}
for (const auto key : keys) {
for (const auto &key : keys) {
Test::populateKeyring(dir.path(), key);
}
auto eJob = new EncryptJob(&composer);
......
......@@ -210,7 +210,7 @@ void AutocryptHeadersJob::process()
#endif
const auto keys = d->gossipKeys;
for (const auto key : keys) {
for (const auto &key : keys) {
if (QByteArray(key.primaryFingerprint()) == QByteArray(d->recipientKey.primaryFingerprint())) {
continue;
}
......
......@@ -106,7 +106,7 @@ void AutocryptUtilsTest::test_gossip()
auto storage = AutocryptStorage::self();
QCOMPARE(storage->d_func()->recipients.keys().size(), expectedKeys.size());
for (const auto addr : expectedKeys) {
for (const auto &addr : expectedKeys) {
QVERIFY2(storage->getRecipient(addr), qPrintable(QStringLiteral("storage missing %1").arg(QString::fromLatin1(addr))));
}
......
......@@ -84,7 +84,7 @@ void MessageCore::processAutocryptfromMail(const HeaderMixupNodeHelper &mixup)
continue;
}
bool invalid = false;
for (const auto key : params.keys()) {
for (const auto &key : params.keys()) {
if (key == "addr") {
continue;
} else if (key == "prefer-encrypt") {
......@@ -127,14 +127,14 @@ void MessageCore::processAutocryptfromMail(const HeaderMixupNodeHelper &mixup)
if (mixup.hasMailHeader("Autocrypt-Gossip")) {
MimeTreeParser::MessagePart::Ptr messagePart(nullptr);
for (const auto mp : mixup.messagePartsOfMailHeader("Autocrypt-Gossip")) {
for (const auto &mp : mixup.messagePartsOfMailHeader("Autocrypt-Gossip")) {
if (mp.staticCast<MimeTreeParser::EncryptedMessagePart>()) {
messagePart = mp;
break;
}
}
if (messagePart) {
for (const auto header : messagePart->headers("Autocrypt-Gossip")) {
for (const auto &header : messagePart->headers("Autocrypt-Gossip")) {
const auto params = paramsFromAutocryptHeader(header);
auto recipient = storage->addRecipient(params.value("addr"));
recipient->updateFromGossip(mixup, header);
......
......@@ -206,7 +206,7 @@ void ProtectedHeadersTest::testMessagePartsOfMailHeader()
// test overwrite
{
QStringList actual;
for (const auto mp : nodeHelper.messagePartsOfMailHeader("from", originalMessage.data())) {
for (const auto &mp : nodeHelper.messagePartsOfMailHeader("from", originalMessage.data())) {
actual << QString::fromLatin1(mp->metaObject()->className());
}
QCOMPARE(actual, messagePartVector);
......@@ -215,7 +215,7 @@ void ProtectedHeadersTest::testMessagePartsOfMailHeader()
// test protected only headers
{
QStringList actual;
for (const auto mp : nodeHelper.messagePartsOfMailHeader("message-id", originalMessage.data())) {
for (const auto &mp : nodeHelper.messagePartsOfMailHeader("message-id", originalMessage.data())) {
actual << QString::fromLatin1(mp->metaObject()->className());
}
QCOMPARE(actual, messagePartVector);
......@@ -224,7 +224,7 @@ void ProtectedHeadersTest::testMessagePartsOfMailHeader()
// test non-existing headers
{
QStringList actual;
for (const auto mp : nodeHelper.messagePartsOfMailHeader("invalid", originalMessage.data())) {
for (const auto &mp : nodeHelper.messagePartsOfMailHeader("invalid", originalMessage.data())) {
actual << QString::fromLatin1(mp->metaObject()->className());
}
QCOMPARE(actual, QStringList());
......@@ -233,7 +233,7 @@ void ProtectedHeadersTest::testMessagePartsOfMailHeader()
// test envelope headers
{
QStringList actual;
for (const auto mp : nodeHelper.messagePartsOfMailHeader("user-agent", originalMessage.data())) {
for (const auto &mp : nodeHelper.messagePartsOfMailHeader("user-agent", originalMessage.data())) {
actual << QString::fromLatin1(mp->metaObject()->className());
}
QCOMPARE(actual, QStringList());
......
......@@ -492,7 +492,7 @@ bool NodeHelper::hasMailHeader(const char *header, const KMime::Content *message
{
if (mHeaderOverwrite.contains(message)) {
const auto parts = mHeaderOverwrite.value(message);
for (const auto messagePart : parts) {
for (const auto &messagePart : parts) {
if (messagePart->hasHeader(header)) {
return true;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment