aboutsummaryrefslogtreecommitdiff
path: root/lib/e2ee/qolmerrors.cpp
diff options
context:
space:
mode:
authorTobias Fella <fella@posteo.de>2021-12-25 16:00:09 +0100
committerTobias Fella <fella@posteo.de>2021-12-25 16:00:25 +0100
commitf4d6a08811b0bf3a10a23ff703fc5a8ff1fcc624 (patch)
tree03b6d33848a9eaf156cafa4db0156a295628606c /lib/e2ee/qolmerrors.cpp
parentf01427c307c825feaa6c45888c259903605c9796 (diff)
downloadlibquotient-f4d6a08811b0bf3a10a23ff703fc5a8ff1fcc624.tar.gz
libquotient-f4d6a08811b0bf3a10a23ff703fc5a8ff1fcc624.zip
Apply suggestions
Diffstat (limited to 'lib/e2ee/qolmerrors.cpp')
-rw-r--r--lib/e2ee/qolmerrors.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/e2ee/qolmerrors.cpp b/lib/e2ee/qolmerrors.cpp
index 568cf7fe..5a60b7e6 100644
--- a/lib/e2ee/qolmerrors.cpp
+++ b/lib/e2ee/qolmerrors.cpp
@@ -4,18 +4,20 @@
#include "qolmerrors.h"
-#include <cstring>
+#include "util.h"
+#include <QtCore/QLatin1String>
Quotient::QOlmError Quotient::fromString(const char* error_raw) {
- if (!strncmp(error_raw, "BAD_ACCOUNT_KEY", 15)) {
+ const QLatin1String error { error_raw };
+ if (error_raw == "BAD_ACCOUNT_KEY"_ls) {
return QOlmError::BadAccountKey;
- } else if (!strncmp(error_raw, "BAD_MESSAGE_KEY_ID", 18)) {
+ } else if (error_raw == "BAD_MESSAGE_KEY_ID"_ls) {
return QOlmError::BadMessageKeyId;
- } else if (!strncmp(error_raw, "INVALID_BASE64", 14)) {
+ } else if (error_raw == "INVALID_BASE64"_ls) {
return QOlmError::InvalidBase64;
- } else if (!strncmp(error_raw, "NOT_ENOUGH_RANDOM", 17)) {
+ } else if (error_raw == "NOT_ENOUGH_RANDOM"_ls) {
return QOlmError::NotEnoughRandom;
- } else if (!strncmp(error_raw, "OUTPUT_BUFFER_TOO_SMALL", 23)) {
+ } else if (error_raw == "OUTPUT_BUFFER_TOO_SMALL"_ls) {
return QOlmError::OutputBufferTooSmall;
} else {
return QOlmError::Unknown;