aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2021-02-15 18:03:33 +0100
committerTobias Fella <fella@posteo.de>2021-12-01 21:34:52 +0100
commite9527012622497b0c418df9442180df58401d394 (patch)
tree2708a5389a06cee74f528a00d406a3cbe09783e7
parent38547289d56cf66b4f1384ae789cf5b6cd71763e (diff)
downloadlibquotient-e9527012622497b0c418df9442180df58401d394.tar.gz
libquotient-e9527012622497b0c418df9442180df58401d394.zip
Apply suggestions from code review
Co-authored-by: Nicolas Fella <6377822+nicolasfella@users.noreply.github.com>
-rw-r--r--lib/converters.cpp6
-rw-r--r--lib/crypto/qolmutils.cpp2
-rw-r--r--lib/encryptionmanager.cpp4
-rw-r--r--lib/room.cpp2
4 files changed, 7 insertions, 7 deletions
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<QVariant>::dump(const QVariant& v)
QVariant Quotient::JsonConverter<QVariant>::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<Quotient::Unencrypted>(mode)) {
- return "";
+ return {};
}
return std::get<Quotient::Encrypted>(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 <functional>
#ifdef Quotient_E2EE_ENABLED
-# include "crypto/qolmaccount.h"
+#include "crypto/qolmaccount.h"
# include "crypto/qolmerrors.h"
# include "crypto/qolminboundsession.h"
#endif // Quotient_E2EE_ENABLED