diff options
author | unril <unril@yandex-team.ru> | 2022-02-10 16:46:05 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:05 +0300 |
commit | 11ae9eca250d0188b7962459cbc6706719e7dca9 (patch) | |
tree | 4b7d6755091980d33210de19b2eb35a401a761ea /contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/StringUtils.cpp | |
parent | 9c914f41ba5e9f9365f404e892197553ac23809e (diff) | |
download | ydb-11ae9eca250d0188b7962459cbc6706719e7dca9.tar.gz |
Restoring authorship annotation for <unril@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/StringUtils.cpp')
-rw-r--r-- | contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/StringUtils.cpp | 134 |
1 files changed, 67 insertions, 67 deletions
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/StringUtils.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/StringUtils.cpp index e1deb3f046..22e3c8e973 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/StringUtils.cpp +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/StringUtils.cpp @@ -155,8 +155,8 @@ Aws::String StringUtils::URLEncode(const char* unsafe) size_t unsafeLength = strlen(unsafe); for (auto i = unsafe, n = unsafe + unsafeLength; i != n; ++i) { - char c = *i; - if (IsAlnum(c) || c == '-' || c == '_' || c == '.' || c == '~') + char c = *i; + if (IsAlnum(c) || c == '-' || c == '_' || c == '.' || c == '~') { escaped << (char)c; } @@ -209,77 +209,77 @@ Aws::String StringUtils::URLEncode(double unsafe) Aws::String StringUtils::URLDecode(const char* safe) { - Aws::String unescaped; + Aws::String unescaped; - for (; *safe; safe++) + for (; *safe; safe++) { - switch(*safe) + switch(*safe) { - case '%': - { - int hex = 0; - auto ch = *++safe; - if (ch >= '0' && ch <= '9') - { - hex = (ch - '0') * 16; - } - else if (ch >= 'A' && ch <= 'F') - { - hex = (ch - 'A' + 10) * 16; - } - else if (ch >= 'a' && ch <= 'f') - { - hex = (ch - 'a' + 10) * 16; - } - else - { - unescaped.push_back('%'); - if (ch == 0) - { - return unescaped; - } - unescaped.push_back(ch); - break; - } - - ch = *++safe; - if (ch >= '0' && ch <= '9') - { - hex += (ch - '0'); - } - else if (ch >= 'A' && ch <= 'F') - { - hex += (ch - 'A' + 10); - } - else if (ch >= 'a' && ch <= 'f') - { - hex += (ch - 'a' + 10); - } - else - { - unescaped.push_back('%'); - unescaped.push_back(*(safe - 1)); - if (ch == 0) - { - return unescaped; - } - unescaped.push_back(ch); - break; - } - - unescaped.push_back(char(hex)); - break; - } - case '+': - unescaped.push_back(' '); - break; - default: - unescaped.push_back(*safe); - break; + case '%': + { + int hex = 0; + auto ch = *++safe; + if (ch >= '0' && ch <= '9') + { + hex = (ch - '0') * 16; + } + else if (ch >= 'A' && ch <= 'F') + { + hex = (ch - 'A' + 10) * 16; + } + else if (ch >= 'a' && ch <= 'f') + { + hex = (ch - 'a' + 10) * 16; + } + else + { + unescaped.push_back('%'); + if (ch == 0) + { + return unescaped; + } + unescaped.push_back(ch); + break; + } + + ch = *++safe; + if (ch >= '0' && ch <= '9') + { + hex += (ch - '0'); + } + else if (ch >= 'A' && ch <= 'F') + { + hex += (ch - 'A' + 10); + } + else if (ch >= 'a' && ch <= 'f') + { + hex += (ch - 'a' + 10); + } + else + { + unescaped.push_back('%'); + unescaped.push_back(*(safe - 1)); + if (ch == 0) + { + return unescaped; + } + unescaped.push_back(ch); + break; + } + + unescaped.push_back(char(hex)); + break; + } + case '+': + unescaped.push_back(' '); + break; + default: + unescaped.push_back(*safe); + break; } } - return unescaped; + return unescaped; } static bool IsSpace(int ch) |