diff options
author | stanly <[email protected]> | 2022-02-10 16:46:49 +0300 |
---|---|---|
committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:46:49 +0300 |
commit | cde218e65dfef5ce03a48d641fd8f7913cf17b2d (patch) | |
tree | d3349caea4095825a55b5ba24fe758067b29ce6f /library/cpp/string_utils/quote/quote.cpp | |
parent | 9f813499b4ef585cb3c2bb93de93ef003daf4fc4 (diff) |
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/string_utils/quote/quote.cpp')
-rw-r--r-- | library/cpp/string_utils/quote/quote.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/library/cpp/string_utils/quote/quote.cpp b/library/cpp/string_utils/quote/quote.cpp index e523350b80a..672e122d3da 100644 --- a/library/cpp/string_utils/quote/quote.cpp +++ b/library/cpp/string_utils/quote/quote.cpp @@ -276,14 +276,14 @@ TString UrlUnescapeRet(const TStringBuf from) { return to; } -char* UrlEscape(char* to, const char* from, bool forceEscape) { +char* UrlEscape(char* to, const char* from, bool forceEscape) { from = FixZero(from); while (*from) { - const bool escapePercent = (*from == '%') && - (forceEscape || !((*(from + 1) && IsAsciiHex(*(from + 1)) && *(from + 2) && IsAsciiHex(*(from + 2))))); - - if (escapePercent || (unsigned char)*from <= ' ' || (unsigned char)*from > '~') { + const bool escapePercent = (*from == '%') && + (forceEscape || !((*(from + 1) && IsAsciiHex(*(from + 1)) && *(from + 2) && IsAsciiHex(*(from + 2))))); + + if (escapePercent || (unsigned char)*from <= ' ' || (unsigned char)*from > '~') { *to++ = '%'; *to++ = d2x((unsigned char)*from >> 4); *to++ = d2x((unsigned char)*from & 0xF); @@ -297,7 +297,7 @@ char* UrlEscape(char* to, const char* from, bool forceEscape) { return to; } -void UrlEscape(TString& url, bool forceEscape) { +void UrlEscape(TString& url, bool forceEscape) { TTempBuf tempBuf(CgiEscapeBufLen(url.size())); char* to = tempBuf.Data(); url.AssignNoAlias(to, UrlEscape(to, url.data(), forceEscape)); |