From d5dafb2ae332fb6ad463c363e6c2c527bcf66656 Mon Sep 17 00:00:00 2001 From: Ingo Klöcker Date: Wed, 13 Dec 2023 11:45:26 +0100 Subject: qt: Replace Q_FOREACH with range-for * lang/qt/src/qgpgmekeyformailboxjob.cpp (do_work): Replace Q_FOREACH with range-for. * lang/qt/src/qgpgmekeylistjob.cpp (QGpgMEKeyListJob::resultHook): Ditto. * lang/qt/src/threadedjobmixin.cpp (_detail::audit_log_as_html): Ditto. * lang/qt/tests/t-keylist.cpp (KeyListTest::testPubkeyAlgoAsString): Ditto. * lang/qt/tests/t-keylocate.cpp (KeyLocateTest::testDaneKeyLocate, KeyLocateTest::testKeyLocateSingle): Ditto. * lang/qt/src/qgpgmesignencryptjob.cpp (sign_encrypt): Replace Q_FOREACH with range-for. Add braces around single statement blocks. * lang/qt/src/qgpgmesignjob.cpp (sign): Ditto. * lang/qt/src/qgpgmenewcryptoconfig.cpp (QGpgMENewCryptoConfig::reloadConfiguration, QGpgMENewCryptoConfig::sync, QGpgMENewCryptoConfigComponent::setComponent, QGpgMENewCryptoConfigEntry::urlValueList, QGpgMENewCryptoConfigEntry::setURLValueList): Replace Q_FOREACH with range-for. Fix indentation. Add braces around single statement blocks. -- Where necessary the iterated object is wrapped with qAsConst to avoid deep copies of the iterated object. --- lang/qt/src/qgpgmesignencryptjob.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lang/qt/src/qgpgmesignencryptjob.cpp') diff --git a/lang/qt/src/qgpgmesignencryptjob.cpp b/lang/qt/src/qgpgmesignencryptjob.cpp index c2ced590..55513c9f 100644 --- a/lang/qt/src/qgpgmesignencryptjob.cpp +++ b/lang/qt/src/qgpgmesignencryptjob.cpp @@ -124,11 +124,13 @@ static QGpgMESignEncryptJob::result_type sign_encrypt(Context *ctx, QThread *thr } ctx->clearSigningKeys(); - Q_FOREACH (const Key &signer, signers) - if (!signer.isNull()) + for (const Key &signer : signers) { + if (!signer.isNull()) { if (const Error err = ctx->addSigningKey(signer)) { return std::make_tuple(SigningResult(err), EncryptionResult(), QByteArray(), QString(), Error()); } + } + } if (!cipherText) { QGpgME::QByteArrayDataProvider out; -- cgit