From e9527012622497b0c418df9442180df58401d394 Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Mon, 15 Feb 2021 18:03:33 +0100 Subject: Apply suggestions from code review Co-authored-by: Nicolas Fella <6377822+nicolasfella@users.noreply.github.com> --- lib/converters.cpp | 6 +++--- lib/crypto/qolmutils.cpp | 2 +- lib/encryptionmanager.cpp | 4 ++-- lib/room.cpp | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/converters.cpp b/lib/converters.cpp index e6dcd854..a3ac44c5 100644 --- a/lib/converters.cpp +++ b/lib/converters.cpp @@ -17,10 +17,10 @@ QJsonValue Quotient::JsonConverter::dump(const QVariant& v) QVariant Quotient::JsonConverter::load(const QJsonValue& jv) { if (jv.isObject()) { - QJsonObject obj = jv.toObject(); - if (obj.contains("key") && obj.contains("signatures")) { + const QJsonObject obj = jv.toObject(); + if (obj.contains(QLatin1String("key")) && obj.contains(QLatin1String("signatures"))) { SignedOneTimeKey signedOneTimeKeys; - signedOneTimeKeys.key = obj["key"].toString(); + signedOneTimeKeys.key = obj[QLatin1String("key")].toString(); } } return jv.toVariant(); diff --git a/lib/crypto/qolmutils.cpp b/lib/crypto/qolmutils.cpp index a486ea0f..4479932e 100644 --- a/lib/crypto/qolmutils.cpp +++ b/lib/crypto/qolmutils.cpp @@ -12,7 +12,7 @@ using namespace Quotient; QByteArray Quotient::toKey(const Quotient::PicklingMode &mode) { if (std::holds_alternative(mode)) { - return ""; + return {}; } return std::get(mode).key; } diff --git a/lib/encryptionmanager.cpp b/lib/encryptionmanager.cpp index c8dc6bdd..719add1d 100644 --- a/lib/encryptionmanager.cpp +++ b/lib/encryptionmanager.cpp @@ -333,10 +333,10 @@ QString EncryptionManager::sessionDecryptMessage( int type = personalCipherObject.value(TypeKeyL).toInt(-1); QByteArray body = personalCipherObject.value(BodyKeyL).toString().toLatin1(); if (type == 0) { - QOlmMessage preKeyMessage = QOlmMessage(body, QOlmMessage::PreKey); + QOlmMessage preKeyMessage(body, QOlmMessage::PreKey); decrypted = d->sessionDecrypt(preKeyMessage, senderKey); } else if (type == 1) { - QOlmMessage message = QOlmMessage(body, QOlmMessage::PreKey); + QOlmMessage message(body, QOlmMessage::PreKey); decrypted = d->sessionDecrypt(message, senderKey); } return decrypted; diff --git a/lib/room.cpp b/lib/room.cpp index d86b2813..a8a7fe0c 100644 --- a/lib/room.cpp +++ b/lib/room.cpp @@ -65,7 +65,7 @@ #include #ifdef Quotient_E2EE_ENABLED -# include "crypto/qolmaccount.h" +#include "crypto/qolmaccount.h" # include "crypto/qolmerrors.h" # include "crypto/qolminboundsession.h" #endif // Quotient_E2EE_ENABLED -- cgit v1.2.3