From c1da9922eb8dc59468c0d30619d23494575a6853 Mon Sep 17 00:00:00 2001 From: Muhammad <73486659+Mis1eader-dev@users.noreply.github.com> Date: Wed, 26 Jul 2023 08:22:22 +0300 Subject: [PATCH] Removed const string& (#1693) --- lib/inc/drogon/utils/Utilities.h | 10 ++++++---- lib/src/Utilities.cc | 21 --------------------- 2 files changed, 6 insertions(+), 25 deletions(-) diff --git a/lib/inc/drogon/utils/Utilities.h b/lib/inc/drogon/utils/Utilities.h index 0799fc5d..9e212351 100644 --- a/lib/inc/drogon/utils/Utilities.h +++ b/lib/inc/drogon/utils/Utilities.h @@ -129,10 +129,12 @@ inline std::string base64Encode(string_view data, } /// Encode the string to base64 format with no padding. -DROGON_EXPORT std::string base64EncodeUnpadded( - const unsigned char *bytes_to_encode, - unsigned int in_len, - bool url_safe = false); +inline std::string base64EncodeUnpadded(const unsigned char *bytes_to_encode, + unsigned int in_len, + bool url_safe = false) +{ + return base64Encode(bytes_to_encode, in_len, url_safe, false); +} /// Encode the string to base64 format with no padding. inline std::string base64EncodeUnpadded(string_view data, bool url_safe = false) diff --git a/lib/src/Utilities.cc b/lib/src/Utilities.cc index c3f74eba..4f00cf13 100644 --- a/lib/src/Utilities.cc +++ b/lib/src/Utilities.cc @@ -139,13 +139,6 @@ static inline bool isBase64(unsigned char c) return false; } -bool isInteger(const std::string &str) -{ - for (auto c : str) - if (c < '0' || c > '9') - return false; - return true; -} bool isInteger(string_view str) { for (auto c : str) @@ -154,13 +147,6 @@ bool isInteger(string_view str) return true; } -bool isBase64(const std::string &str) -{ - for (auto c : str) - if (!isBase64(c)) - return false; - return true; -} bool isBase64(string_view str) { for (auto c : str) @@ -460,13 +446,6 @@ std::string base64Encode(const unsigned char *bytes_to_encode, return ret; } -std::string base64EncodeUnpadded(const unsigned char *bytes_to_encode, - unsigned int in_len, - bool url_safe) -{ - return base64Encode(bytes_to_encode, in_len, url_safe, false); -} - std::vector base64DecodeToVector(string_view encoded_string) { auto in_len = encoded_string.size();