aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/StringUtils.cpp
diff options
context:
space:
mode:
authorunril <unril@yandex-team.ru>2022-02-10 16:46:05 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:05 +0300
commit3b241dd57cf58f20bbbd63fa6a0a758dbec09b68 (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/StringUtils.cpp
parent11ae9eca250d0188b7962459cbc6706719e7dca9 (diff)
downloadydb-3b241dd57cf58f20bbbd63fa6a0a758dbec09b68.tar.gz
Restoring authorship annotation for <unril@yandex-team.ru>. Commit 2 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.cpp134
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 22e3c8e973..e1deb3f046 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)