aboutsummaryrefslogtreecommitdiff
path: root/lib/e2ee/qolmerrors.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/e2ee/qolmerrors.cpp')
-rw-r--r--lib/e2ee/qolmerrors.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/e2ee/qolmerrors.cpp b/lib/e2ee/qolmerrors.cpp
index 6db1803c..568cf7fe 100644
--- a/lib/e2ee/qolmerrors.cpp
+++ b/lib/e2ee/qolmerrors.cpp
@@ -4,17 +4,18 @@
#include "qolmerrors.h"
+#include <cstring>
-Quotient::QOlmError Quotient::fromString(const std::string &error_raw) {
- if (!error_raw.compare("BAD_ACCOUNT_KEY")) {
+Quotient::QOlmError Quotient::fromString(const char* error_raw) {
+ if (!strncmp(error_raw, "BAD_ACCOUNT_KEY", 15)) {
return QOlmError::BadAccountKey;
- } else if (!error_raw.compare("BAD_MESSAGE_KEY_ID")) {
+ } else if (!strncmp(error_raw, "BAD_MESSAGE_KEY_ID", 18)) {
return QOlmError::BadMessageKeyId;
- } else if (!error_raw.compare("INVALID_BASE64")) {
+ } else if (!strncmp(error_raw, "INVALID_BASE64", 14)) {
return QOlmError::InvalidBase64;
- } else if (!error_raw.compare("NOT_ENOUGH_RANDOM")) {
+ } else if (!strncmp(error_raw, "NOT_ENOUGH_RANDOM", 17)) {
return QOlmError::NotEnoughRandom;
- } else if (!error_raw.compare("OUTPUT_BUFFER_TOO_SMALL")) {
+ } else if (!strncmp(error_raw, "OUTPUT_BUFFER_TOO_SMALL", 23)) {
return QOlmError::OutputBufferTooSmall;
} else {
return QOlmError::Unknown;