diff options
author | dobrokot <dobrokot@yandex-team.ru> | 2022-02-10 16:49:07 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:07 +0300 |
commit | 8d57b69dee81198a59c39e64704f7dc9f04b4fbf (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/string_utils/quote/quote.h | |
parent | 25d83bf841d8b3ce3886525078f1964ac3c293c5 (diff) | |
download | ydb-8d57b69dee81198a59c39e64704f7dc9f04b4fbf.tar.gz |
Restoring authorship annotation for <dobrokot@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/string_utils/quote/quote.h')
-rw-r--r-- | library/cpp/string_utils/quote/quote.h | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/library/cpp/string_utils/quote/quote.h b/library/cpp/string_utils/quote/quote.h index 55150d31f6..3b7221154e 100644 --- a/library/cpp/string_utils/quote/quote.h +++ b/library/cpp/string_utils/quote/quote.h @@ -3,11 +3,11 @@ #include <util/generic/strbuf.h> #include <util/generic/string.h> -//CGIEscape*: -// ' ' converted to '+', -// Some punctuation and chars outside [32, 126] range are converted to %xx -// Use function CgiEscapeBufLen to determine number of characters needed for 'char* to' parameter. -// Returns pointer to the end of the result string +//CGIEscape*: +// ' ' converted to '+', +// Some punctuation and chars outside [32, 126] range are converted to %xx +// Use function CgiEscapeBufLen to determine number of characters needed for 'char* to' parameter. +// Returns pointer to the end of the result string 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) { @@ -24,12 +24,12 @@ inline TStringBuf CgiEscape(void* tmp, const TStringBuf s) { return CgiEscapeBuf(static_cast<char*>(tmp), s); } -//CgiUnescape*: -// Decodes '%xx' to bytes, '+' to space. -// Use function CgiUnescapeBufLen to determine number of characters needed for 'char* to' parameter. -// If pointer returned, then this is pointer to the end of the result string. -char* CGIUnescape(char* to, const char* from); -char* CGIUnescape(char* to, const char* from, size_t len); +//CgiUnescape*: +// Decodes '%xx' to bytes, '+' to space. +// Use function CgiUnescapeBufLen to determine number of characters needed for 'char* to' parameter. +// If pointer returned, then this is pointer to the end of the result string. +char* CGIUnescape(char* to, const char* from); +char* CGIUnescape(char* to, const char* from, size_t len); void CGIUnescape(TString& url); TString CGIUnescapeRet(const TStringBuf from); @@ -40,29 +40,29 @@ inline TStringBuf CgiUnescape(void* tmp, const TStringBuf s) { return CgiUnescapeBuf(static_cast<char*>(tmp), s); } -//Quote: -// Is like CGIEscape, also skips encoding of user-supplied 'safe' characters. +//Quote: +// Is like CGIEscape, also skips encoding of user-supplied 'safe' characters. char* Quote(char* to, const char* from, const char* safe = "/"); char* Quote(char* to, const TStringBuf s, const char* safe = "/"); void Quote(TString& url, const char* safe = "/"); -//UrlEscape: -// Can't be used for cgi parameters ('&' character is not escaped)! +//UrlEscape: +// Can't be used for cgi parameters ('&' character is not escaped)! // escapes only '%' not followed by two hex-digits or if forceEscape set to ture, // and chars outside [32, 126] range. // Can't handle '\0'-chars in TString. char* UrlEscape(char* to, const char* from, bool forceEscape = false); void UrlEscape(TString& url, bool forceEscape = false); TString UrlEscapeRet(const TStringBuf from, bool forceEscape = false); - -//UrlUnescape: -// '+' is NOT converted to space! -// %xx converted to bytes, other characters are copied unchanged. + +//UrlUnescape: +// '+' is NOT converted to space! +// %xx converted to bytes, other characters are copied unchanged. char* UrlUnescape(char* to, TStringBuf from); void UrlUnescape(TString& url); TString UrlUnescapeRet(const TStringBuf from); -//*BufLen: how much characters you should allocate for 'char* to' buffers. +//*BufLen: how much characters you should allocate for 'char* to' buffers. constexpr size_t CgiEscapeBufLen(const size_t len) noexcept { return 3 * len + 1; } |