mirror of
https://github.com/QuasarApp/qca.git
synced 2025-05-07 08:19:33 +00:00
Rewrite code a bit so clang-format doesn't break exceptions
clazy and clang-tidy comments needs to in the proper place
This commit is contained in:
parent
0fd3c4cb26
commit
f88abb0697
plugins/qca-botan
src
unittest
@ -436,6 +436,12 @@ static void qcaCipherToBotanCipher(const QString &type, std::string *algoName, s
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::string qcaCipherToBotanCipher(const QString &qcaCipher) {
|
||||||
|
std::string algoName, algoMode, algoPadding;
|
||||||
|
qcaCipherToBotanCipher(qcaCipher, &algoName, &algoMode, &algoPadding);
|
||||||
|
return algoName+'/'+algoMode+'/'+algoPadding; // NOLINT(performance-inefficient-string-concatenation)
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------
|
//-----------------------------------------------------------
|
||||||
class BotanCipherContext : public QCA::CipherContext
|
class BotanCipherContext : public QCA::CipherContext
|
||||||
{
|
{
|
||||||
@ -648,11 +654,10 @@ public:
|
|||||||
list += QStringLiteral("blowfish-ofb");
|
list += QStringLiteral("blowfish-ofb");
|
||||||
|
|
||||||
for (const QString &cipher : qAsConst(list)) {
|
for (const QString &cipher : qAsConst(list)) {
|
||||||
std::string algoName, algoMode, algoPadding;
|
const std::string bothanCipher = qcaCipherToBotanCipher(cipher);
|
||||||
qcaCipherToBotanCipher(cipher, &algoName, &algoMode, &algoPadding);
|
|
||||||
try {
|
try {
|
||||||
std::unique_ptr<Botan::Keyed_Filter> enc(Botan::get_cipher(algoName+'/'+algoMode+'/'+algoPadding, Botan::ENCRYPTION)); // NOLINT(performance-inefficient-string-concatenation)
|
std::unique_ptr<Botan::Keyed_Filter> enc(Botan::get_cipher(bothanCipher, Botan::ENCRYPTION));
|
||||||
std::unique_ptr<Botan::Keyed_Filter> dec(Botan::get_cipher(algoName+'/'+algoMode+'/'+algoPadding, Botan::DECRYPTION)); // NOLINT(performance-inefficient-string-concatenation)
|
std::unique_ptr<Botan::Keyed_Filter> dec(Botan::get_cipher(bothanCipher, Botan::DECRYPTION));
|
||||||
supported += cipher;
|
supported += cipher;
|
||||||
} catch (Botan::Exception& e) {
|
} catch (Botan::Exception& e) {
|
||||||
}
|
}
|
||||||
|
@ -2021,7 +2021,9 @@ CRLEntry::CRLEntry(const Certificate &c, Reason r)
|
|||||||
_reason = r;
|
_reason = r;
|
||||||
}
|
}
|
||||||
|
|
||||||
CRLEntry::CRLEntry(const BigInteger serial, const QDateTime &time, Reason r) // clazy:exclude=function-args-by-ref NOLINT(performance-unnecessary-value-param) TODO make serial const & when we break ABI
|
// TODO make serial const & when we break ABI
|
||||||
|
CRLEntry::CRLEntry(const BigInteger serial, // clazy:exclude=function-args-by-ref NOLINT(performance-unnecessary-value-param)
|
||||||
|
const QDateTime &time, Reason r)
|
||||||
{
|
{
|
||||||
_serial = serial;
|
_serial = serial;
|
||||||
_time = time;
|
_time = time;
|
||||||
|
@ -81,7 +81,8 @@ void CertUnitTest::nullCert()
|
|||||||
else {
|
else {
|
||||||
QCA::Certificate nullCert;
|
QCA::Certificate nullCert;
|
||||||
QVERIFY(nullCert.isNull());
|
QVERIFY(nullCert.isNull());
|
||||||
QCA::Certificate anotherNullCert = nullCert; // NOLINT(performance-unnecessary-copy-initialization) This is copied on purpose to check the assignment operator
|
// This is copied on purpose to check the assignment operator
|
||||||
|
QCA::Certificate anotherNullCert = nullCert; // NOLINT(performance-unnecessary-copy-initialization)
|
||||||
QVERIFY( anotherNullCert.isNull() );
|
QVERIFY( anotherNullCert.isNull() );
|
||||||
QCOMPARE( nullCert, anotherNullCert );
|
QCOMPARE( nullCert, anotherNullCert );
|
||||||
}
|
}
|
||||||
@ -1114,7 +1115,8 @@ void CertUnitTest::csr()
|
|||||||
else {
|
else {
|
||||||
QCA::CertificateRequest nullCSR;
|
QCA::CertificateRequest nullCSR;
|
||||||
QVERIFY( nullCSR.isNull() );
|
QVERIFY( nullCSR.isNull() );
|
||||||
QCA::CertificateRequest anotherNullCSR = nullCSR; // NOLINT(performance-unnecessary-copy-initialization) This is copied on purpose to check the assignment operator
|
// This is copied on purpose to check the assignment operator
|
||||||
|
QCA::CertificateRequest anotherNullCSR = nullCSR; // NOLINT(performance-unnecessary-copy-initialization)
|
||||||
QVERIFY( anotherNullCSR.isNull() );
|
QVERIFY( anotherNullCSR.isNull() );
|
||||||
QCOMPARE( nullCSR, anotherNullCSR);
|
QCOMPARE( nullCSR, anotherNullCSR);
|
||||||
|
|
||||||
|
@ -64,7 +64,8 @@ void HexUnitTest::testHexString_data()
|
|||||||
QTest::newRow("ABCD") << QStringLiteral("ABCD") << QStringLiteral("41424344");
|
QTest::newRow("ABCD") << QStringLiteral("ABCD") << QStringLiteral("41424344");
|
||||||
QTest::newRow("empty") << QString(QLatin1String("")) << QString(QLatin1String(""));
|
QTest::newRow("empty") << QString(QLatin1String("")) << QString(QLatin1String(""));
|
||||||
QTest::newRow("abcddef") << QStringLiteral("abcddef") << QStringLiteral("61626364646566");
|
QTest::newRow("abcddef") << QStringLiteral("abcddef") << QStringLiteral("61626364646566");
|
||||||
QTest::newRow("empty too") << QString::fromLatin1("\0") << QString::fromLatin1(""); // Empty QString. clazy:exclude=qstring-allocations
|
QTest::newRow("empty too") << QString::fromLatin1("\0") // clazy:exclude=qstring-allocations
|
||||||
|
<< QString::fromLatin1(""); // Empty QString. clazy:exclude=qstring-allocations
|
||||||
QTest::newRow("BEL") << QStringLiteral("\a") << QStringLiteral("07"); // BEL
|
QTest::newRow("BEL") << QStringLiteral("\a") << QStringLiteral("07"); // BEL
|
||||||
QTest::newRow("BS") << QStringLiteral("\b") << QStringLiteral("08"); // BS
|
QTest::newRow("BS") << QStringLiteral("\b") << QStringLiteral("08"); // BS
|
||||||
QTest::newRow("HT") << QStringLiteral("\t") << QStringLiteral("09"); // HT
|
QTest::newRow("HT") << QStringLiteral("\t") << QStringLiteral("09"); // HT
|
||||||
|
Loading…
x
Reference in New Issue
Block a user