aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp
diff options
context:
space:
mode:
authorskalsin <skalsin@yandex-team.ru>2022-02-10 16:46:39 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:39 +0300
commit5036b5f2122001f9aef8a0e4cd85440d73ea6b9f (patch)
tree49e222ea1c5804306084bb3ae065bb702625360f /library/cpp
parent0ec5f3106fcb5e342ec13cdfad678bf4633580d5 (diff)
downloadydb-5036b5f2122001f9aef8a0e4cd85440d73ea6b9f.tar.gz
Restoring authorship annotation for <skalsin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp')
-rw-r--r--library/cpp/string_utils/quote/quote.cpp22
-rw-r--r--library/cpp/string_utils/quote/quote_ut.cpp10
2 files changed, 16 insertions, 16 deletions
diff --git a/library/cpp/string_utils/quote/quote.cpp b/library/cpp/string_utils/quote/quote.cpp
index 5b0d172874..e523350b80 100644
--- a/library/cpp/string_utils/quote/quote.cpp
+++ b/library/cpp/string_utils/quote/quote.cpp
@@ -180,9 +180,9 @@ TString& AppendCgiEscaped(const TStringBuf value, TString& to) {
// additional characters that should not be quoted — its default value is '/'.
// Also returns pointer to the end of result string.
-
-template <class It1, class It2, class It3>
-static inline It1 Quote(It1 to, It2 from, It3 end, const char* safe) {
+
+template <class It1, class It2, class It3>
+static inline It1 Quote(It1 to, It2 from, It3 end, const char* safe) {
bool escape_map[256];
memcpy(escape_map, chars_to_url_escape, 256);
// RFC 3986 Uniform Resource Identifiers (URI): Generic Syntax
@@ -196,22 +196,22 @@ static inline It1 Quote(It1 to, It2 from, It3 end, const char* safe) {
escape_map[(unsigned char)*p] = 0;
}
- return Escape(to, from, end, escape_map);
+ return Escape(to, from, end, escape_map);
+}
+
+char* Quote(char* to, const char* from, const char* safe) {
+ return Quote(to, FixZero(from), TCStringEndIterator(), safe);
}
-char* Quote(char* to, const char* from, const char* safe) {
- return Quote(to, FixZero(from), TCStringEndIterator(), safe);
-}
-
char* Quote(char* to, const TStringBuf s, const char* safe) {
return Quote(to, s.data(), s.data() + s.size(), safe);
-}
-
+}
+
void Quote(TString& url, const char* safe) {
TTempBuf tempBuf(CgiEscapeBufLen(url.size()));
char* to = tempBuf.Data();
- url.AssignNoAlias(to, Quote(to, url, safe));
+ url.AssignNoAlias(to, Quote(to, url, safe));
}
char* CGIUnescape(char* to, const char* from) {
diff --git a/library/cpp/string_utils/quote/quote_ut.cpp b/library/cpp/string_utils/quote/quote_ut.cpp
index 0f01b1beb8..6c552b279e 100644
--- a/library/cpp/string_utils/quote/quote_ut.cpp
+++ b/library/cpp/string_utils/quote/quote_ut.cpp
@@ -310,10 +310,10 @@ Y_UNIT_TEST_SUITE(TQuoteTest) {
Quote(s, ";,");
UNIT_ASSERT_VALUES_EQUAL("%2Fpath;tail%2Fpath,tail%2F", s.c_str());
}
-
+
Y_UNIT_TEST(StringBuf) {
- char r[100];
- char* end = Quote(r, "abc\0/path", "");
- UNIT_ASSERT_VALUES_EQUAL("abc\0%2Fpath", TStringBuf(r, end));
- }
+ char r[100];
+ char* end = Quote(r, "abc\0/path", "");
+ UNIT_ASSERT_VALUES_EQUAL("abc\0%2Fpath", TStringBuf(r, end));
+ }
}