aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/string_utils
diff options
context:
space:
mode:
authorOleg Sidorkin <osidorkin@gmail.com>2022-02-10 16:49:36 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:36 +0300
commitf8f6804a3e352897afabc93afcb32081e3fca601 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/string_utils
parent5ce74d4fee2d42a4b86efc02dfdc704d458760e1 (diff)
downloadydb-f8f6804a3e352897afabc93afcb32081e3fca601.tar.gz
Restoring authorship annotation for Oleg Sidorkin <osidorkin@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/string_utils')
-rw-r--r--library/cpp/string_utils/quote/quote.cpp14
-rw-r--r--library/cpp/string_utils/quote/quote.h2
-rw-r--r--library/cpp/string_utils/quote/quote_ut.cpp34
3 files changed, 25 insertions, 25 deletions
diff --git a/library/cpp/string_utils/quote/quote.cpp b/library/cpp/string_utils/quote/quote.cpp
index efbdd36903..e523350b80 100644
--- a/library/cpp/string_utils/quote/quote.cpp
+++ b/library/cpp/string_utils/quote/quote.cpp
@@ -169,13 +169,13 @@ TString CGIEscapeRet(const TStringBuf url) {
return to;
}
-TString& AppendCgiEscaped(const TStringBuf value, TString& to) {
- const size_t origLength = to.length();
- to.ReserveAndResize(origLength + CgiEscapeBufLen(value.size()));
- to.resize(CGIEscape(to.begin() + origLength, value.data(), value.size()) - to.data());
- return to;
-}
-
+TString& AppendCgiEscaped(const TStringBuf value, TString& to) {
+ const size_t origLength = to.length();
+ to.ReserveAndResize(origLength + CgiEscapeBufLen(value.size()));
+ to.resize(CGIEscape(to.begin() + origLength, value.data(), value.size()) - to.data());
+ return to;
+}
+
// More general version of CGIEscape. The optional safe parameter specifies
// additional characters that should not be quoted — its default value is '/'.
diff --git a/library/cpp/string_utils/quote/quote.h b/library/cpp/string_utils/quote/quote.h
index 4116126364..3b7221154e 100644
--- a/library/cpp/string_utils/quote/quote.h
+++ b/library/cpp/string_utils/quote/quote.h
@@ -15,7 +15,7 @@ inline char* CGIEscape(char* to, const TStringBuf from) {
}
void CGIEscape(TString& url);
TString CGIEscapeRet(const TStringBuf url);
-TString& AppendCgiEscaped(const TStringBuf value, TString& to);
+TString& AppendCgiEscaped(const TStringBuf value, TString& to);
inline TStringBuf CgiEscapeBuf(char* to, const TStringBuf from) {
return TStringBuf(to, CGIEscape(to, from.data(), from.size()));
diff --git a/library/cpp/string_utils/quote/quote_ut.cpp b/library/cpp/string_utils/quote/quote_ut.cpp
index ca33293dca..6c552b279e 100644
--- a/library/cpp/string_utils/quote/quote_ut.cpp
+++ b/library/cpp/string_utils/quote/quote_ut.cpp
@@ -28,23 +28,23 @@ Y_UNIT_TEST_SUITE(TCGIEscapeTest) {
Y_UNIT_TEST(StrokaRet) {
UNIT_ASSERT_VALUES_EQUAL(CGIEscapeRet("!@#$%^&*(){}[]\" "), TString("!@%23$%25^%26*%28%29%7B%7D%5B%5D%22+"));
}
-
- Y_UNIT_TEST(StrokaAppendRet) {
- TString param;
- AppendCgiEscaped("!@#$%^&*(){}[]\" ", param);
- UNIT_ASSERT_VALUES_EQUAL(param, TString("!@%23$%25^%26*%28%29%7B%7D%5B%5D%22+"));
-
- TString param2 = "&param=";
- AppendCgiEscaped("!@#$%^&*(){}[]\" ", param2);
- UNIT_ASSERT_VALUES_EQUAL(param2,
- TString("&param=!@%23$%25^%26*%28%29%7B%7D%5B%5D%22+"));
-
- param2.append("&param_param=");
- AppendCgiEscaped("!@#$%^&*(){}[]\" ", param2);
- UNIT_ASSERT_VALUES_EQUAL(param2,
- TString("&param=!@%23$%25^%26*%28%29%7B%7D%5B%5D%22+&param_param=!@%23$%25^%26*%28%29%7B%7D%5B%5D%22+"));
- }
-
+
+ Y_UNIT_TEST(StrokaAppendRet) {
+ TString param;
+ AppendCgiEscaped("!@#$%^&*(){}[]\" ", param);
+ UNIT_ASSERT_VALUES_EQUAL(param, TString("!@%23$%25^%26*%28%29%7B%7D%5B%5D%22+"));
+
+ TString param2 = "&param=";
+ AppendCgiEscaped("!@#$%^&*(){}[]\" ", param2);
+ UNIT_ASSERT_VALUES_EQUAL(param2,
+ TString("&param=!@%23$%25^%26*%28%29%7B%7D%5B%5D%22+"));
+
+ param2.append("&param_param=");
+ AppendCgiEscaped("!@#$%^&*(){}[]\" ", param2);
+ UNIT_ASSERT_VALUES_EQUAL(param2,
+ TString("&param=!@%23$%25^%26*%28%29%7B%7D%5B%5D%22+&param_param=!@%23$%25^%26*%28%29%7B%7D%5B%5D%22+"));
+ }
+
}
Y_UNIT_TEST_SUITE(TCGIUnescapeTest) {