diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-01-26 16:21:43 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-01-29 14:18:06 +0100 |
commit | e7c285e3423ddd660447f6a6fc6bbae25f99f386 (patch) | |
tree | 1d700f09a5e96a2a0d390af30581097bdec0bf77 /src/utils | |
parent | e1a7c1d0ca30c2c4a293ffbff6b9c51c881d23e3 (diff) | |
download | mana-e7c285e3423ddd660447f6a6fc6bbae25f99f386.tar.gz mana-e7c285e3423ddd660447f6a6fc6bbae25f99f386.tar.bz2 mana-e7c285e3423ddd660447f6a6fc6bbae25f99f386.tar.xz mana-e7c285e3423ddd660447f6a6fc6bbae25f99f386.zip |
Apply C++11 fixits
modernize-loop-convert
modernize-deprecated-headers
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/base64.cpp | 4 | ||||
-rw-r--r-- | src/utils/sha256.cpp | 6 | ||||
-rw-r--r-- | src/utils/stringutils.cpp | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/utils/base64.cpp b/src/utils/base64.cpp index cf10c8fd..189407d7 100644 --- a/src/utils/base64.cpp +++ b/src/utils/base64.cpp @@ -29,8 +29,8 @@ #include "utils/base64.h" -#include <stdlib.h> -#include <string.h> +#include <cstdlib> +#include <cstring> static char base64_table[] = { diff --git a/src/utils/sha256.cpp b/src/utils/sha256.cpp index a97dce3c..a18e5f18 100644 --- a/src/utils/sha256.cpp +++ b/src/utils/sha256.cpp @@ -265,10 +265,10 @@ std::string SHA256Hash(const char *src, int len) // Convert it to hex const char* hxc = "0123456789abcdef"; std::string hash = ""; - for (int i = 0; i < SHA256_DIGEST_SIZE; i++) + for (unsigned char i : bytehash) { - hash += hxc[bytehash[i] / 16]; - hash += hxc[bytehash[i] % 16]; + hash += hxc[i / 16]; + hash += hxc[i % 16]; } return hash; } diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp index 59a3f17d..5083770c 100644 --- a/src/utils/stringutils.cpp +++ b/src/utils/stringutils.cpp @@ -23,7 +23,7 @@ #include "log.h" -#include <string.h> +#include <cstring> #include <algorithm> #include <cstdarg> #include <cstdio> |