aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/string_utils
diff options
context:
space:
mode:
authoralbert <albert@yandex-team.ru>2022-02-10 16:48:14 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:48:14 +0300
commit9f25ef3232c288ca664ceee6c376cf64e4349a2e (patch)
treeb192eaf3150845f7302fafd460a972b0439d6fe5 /library/cpp/string_utils
parent6a1e535429145ec1ecfbc5f1efd3c95323261fb5 (diff)
downloadydb-9f25ef3232c288ca664ceee6c376cf64e4349a2e.tar.gz
Restoring authorship annotation for <albert@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/string_utils')
-rw-r--r--library/cpp/string_utils/quote/quote.cpp20
-rw-r--r--library/cpp/string_utils/quote/quote.h8
-rw-r--r--library/cpp/string_utils/scan/scan.h6
-rw-r--r--library/cpp/string_utils/url/url.cpp12
4 files changed, 23 insertions, 23 deletions
diff --git a/library/cpp/string_utils/quote/quote.cpp b/library/cpp/string_utils/quote/quote.cpp
index e523350b80..48594a79da 100644
--- a/library/cpp/string_utils/quote/quote.cpp
+++ b/library/cpp/string_utils/quote/quote.cpp
@@ -37,13 +37,13 @@ namespace {
static inline char x2c(TStringBuf& x) {
if (!IsAsciiHex((ui8)x[0]) || !IsAsciiHex((ui8)x[1]))
- return '%';
- ui8 c = 0;
-
+ return '%';
+ ui8 c = 0;
+
GETSBXC;
GETSBXC;
- return c;
- }
+ return c;
+ }
};
class TFromHexLenLimited {
@@ -242,13 +242,13 @@ TString CGIUnescapeRet(const TStringBuf from) {
return to;
}
-char* UrlUnescape(char* to, TStringBuf from) {
+char* UrlUnescape(char* to, TStringBuf from) {
while (!from.empty()) {
- char ch = from[0];
+ char ch = from[0];
from.Skip(1);
- if ('%' == ch && 2 <= from.length())
- ch = TFromHexZeroTerm::x2c(from);
- *to++ = ch;
+ if ('%' == ch && 2 <= from.length())
+ ch = TFromHexZeroTerm::x2c(from);
+ *to++ = ch;
}
*to = 0;
diff --git a/library/cpp/string_utils/quote/quote.h b/library/cpp/string_utils/quote/quote.h
index 3b7221154e..527668defb 100644
--- a/library/cpp/string_utils/quote/quote.h
+++ b/library/cpp/string_utils/quote/quote.h
@@ -12,14 +12,14 @@ char* CGIEscape(char* to, const char* from);
char* CGIEscape(char* to, const char* from, size_t len);
inline char* CGIEscape(char* to, const TStringBuf from) {
return CGIEscape(to, from.data(), from.size());
-}
+}
void CGIEscape(TString& url);
TString CGIEscapeRet(const TStringBuf url);
TString& AppendCgiEscaped(const TStringBuf value, TString& to);
inline TStringBuf CgiEscapeBuf(char* to, const TStringBuf from) {
return TStringBuf(to, CGIEscape(to, from.data(), from.size()));
-}
+}
inline TStringBuf CgiEscape(void* tmp, const TStringBuf s) {
return CgiEscapeBuf(static_cast<char*>(tmp), s);
}
@@ -35,7 +35,7 @@ TString CGIUnescapeRet(const TStringBuf from);
inline TStringBuf CgiUnescapeBuf(char* to, const TStringBuf from) {
return TStringBuf(to, CGIUnescape(to, from.data(), from.size()));
-}
+}
inline TStringBuf CgiUnescape(void* tmp, const TStringBuf s) {
return CgiUnescapeBuf(static_cast<char*>(tmp), s);
}
@@ -58,7 +58,7 @@ TString UrlEscapeRet(const TStringBuf from, bool forceEscape = false);
//UrlUnescape:
// '+' is NOT converted to space!
// %xx converted to bytes, other characters are copied unchanged.
-char* UrlUnescape(char* to, TStringBuf from);
+char* UrlUnescape(char* to, TStringBuf from);
void UrlUnescape(TString& url);
TString UrlUnescapeRet(const TStringBuf from);
diff --git a/library/cpp/string_utils/scan/scan.h b/library/cpp/string_utils/scan/scan.h
index 703db54321..5711bafeab 100644
--- a/library/cpp/string_utils/scan/scan.h
+++ b/library/cpp/string_utils/scan/scan.h
@@ -4,19 +4,19 @@
template <bool addAll, char sep, char sepKeyVal, class F>
static inline void ScanKeyValue(TStringBuf s, F&& f) {
- TStringBuf key, val;
+ TStringBuf key, val;
while (!s.empty()) {
val = s.NextTok(sep);
if (val.empty()) {
- continue; // && case
+ continue; // && case
}
key = val.NextTok(sepKeyVal);
if (addAll || val.IsInited()) {
- f(key, val); // includes empty keys
+ f(key, val); // includes empty keys
}
}
}
diff --git a/library/cpp/string_utils/url/url.cpp b/library/cpp/string_utils/url/url.cpp
index 85f4ac5d69..31fb932a4d 100644
--- a/library/cpp/string_utils/url/url.cpp
+++ b/library/cpp/string_utils/url/url.cpp
@@ -364,18 +364,18 @@ static inline int Unescape(char* str) {
size_t NormalizeUrlName(char* dest, const TStringBuf source, size_t dest_size) {
if (source.empty() || source[0] == '?')
return strlcpy(dest, "/", dest_size);
- size_t len = Min(dest_size - 1, source.length());
- memcpy(dest, source.data(), len);
- dest[len] = 0;
+ size_t len = Min(dest_size - 1, source.length());
+ memcpy(dest, source.data(), len);
+ dest[len] = 0;
len -= Unescape(dest);
strlwr(dest);
return len;
}
size_t NormalizeHostName(char* dest, const TStringBuf source, size_t dest_size, ui16 defport) {
- size_t len = Min(dest_size - 1, source.length());
- memcpy(dest, source.data(), len);
- dest[len] = 0;
+ size_t len = Min(dest_size - 1, source.length());
+ memcpy(dest, source.data(), len);
+ dest[len] = 0;
char buf[8] = ":";
size_t buflen = 1 + ToString(defport, buf + 1, sizeof(buf) - 2);
buf[buflen] = '\0';