diff options
author | samoleg <samoleg@yandex-team.ru> | 2022-02-10 16:49:57 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:57 +0300 |
commit | 5dcbab5666d82d448111d17b7045c46b56ef5172 (patch) | |
tree | 7faed34125c4c1a9bf0e0707ec6daf9695d5135d /library/cpp/string_utils/quote/quote.cpp | |
parent | af7786701134cfc2bd577c1c39bbc39433b555d6 (diff) | |
download | ydb-5dcbab5666d82d448111d17b7045c46b56ef5172.tar.gz |
Restoring authorship annotation for <samoleg@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/string_utils/quote/quote.cpp')
-rw-r--r-- | library/cpp/string_utils/quote/quote.cpp | 46 |
1 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..a971d9baf7 100644 --- a/library/cpp/string_utils/quote/quote.cpp +++ b/library/cpp/string_utils/quote/quote.cpp @@ -223,16 +223,16 @@ char* CGIUnescape(char* to, const char* from, size_t len) { } void CGIUnescape(TString& url) { - if (url.empty()) { - return; - } - if (url.IsDetached()) { // in-place when refcount == 1 - char* resBegin = url.begin(); - const char* resEnd = CGIUnescape(resBegin, resBegin, url.size()); - url.resize(resEnd - resBegin); - } else { - url = CGIUnescapeRet(url); - } + if (url.empty()) { + return; + } + if (url.IsDetached()) { // in-place when refcount == 1 + char* resBegin = url.begin(); + const char* resEnd = CGIUnescape(resBegin, resBegin, url.size()); + url.resize(resEnd - resBegin); + } else { + url = CGIUnescapeRet(url); + } } TString CGIUnescapeRet(const TStringBuf from) { @@ -257,25 +257,25 @@ char* UrlUnescape(char* to, TStringBuf from) { } void UrlUnescape(TString& url) { - if (url.empty()) { - return; - } - if (url.IsDetached()) { // in-place when refcount == 1 - char* resBegin = url.begin(); - const char* resEnd = UrlUnescape(resBegin, url); - url.resize(resEnd - resBegin); - } else { - url = UrlUnescapeRet(url); - } + if (url.empty()) { + return; + } + if (url.IsDetached()) { // in-place when refcount == 1 + char* resBegin = url.begin(); + const char* resEnd = UrlUnescape(resBegin, url); + url.resize(resEnd - resBegin); + } else { + url = UrlUnescapeRet(url); + } } TString UrlUnescapeRet(const TStringBuf from) { TString to; to.ReserveAndResize(CgiUnescapeBufLen(from.size())); to.resize(UrlUnescape(to.begin(), from) - to.data()); - return to; -} - + return to; +} + char* UrlEscape(char* to, const char* from, bool forceEscape) { from = FixZero(from); |