diff options
author | yazevnul <yazevnul@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
commit | 8cbc307de0221f84c80c42dcbe07d40727537e2c (patch) | |
tree | 625d5a673015d1df891e051033e9fcde5c7be4e5 /library/cpp/string_utils/base64/base64.h | |
parent | 30d1ef3941e0dc835be7609de5ebee66958f215a (diff) | |
download | ydb-8cbc307de0221f84c80c42dcbe07d40727537e2c.tar.gz |
Restoring authorship annotation for <yazevnul@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/string_utils/base64/base64.h')
-rw-r--r-- | library/cpp/string_utils/base64/base64.h | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/library/cpp/string_utils/base64/base64.h b/library/cpp/string_utils/base64/base64.h index f778a6425a..57a121537d 100644 --- a/library/cpp/string_utils/base64/base64.h +++ b/library/cpp/string_utils/base64/base64.h @@ -4,26 +4,26 @@ #include <util/generic/strbuf.h> #include <util/generic/string.h> -/* @return Size of the buffer required to decode Base64 encoded data of size `len`. - */ -constexpr size_t Base64DecodeBufSize(const size_t len) noexcept { - return (len + 3) / 4 * 3; +/* @return Size of the buffer required to decode Base64 encoded data of size `len`. + */ +constexpr size_t Base64DecodeBufSize(const size_t len) noexcept { + return (len + 3) / 4 * 3; } -/* Decode Base64 encoded data. Can decode both regular Base64 and Base64URL encoded data. Can decode - * only valid Base64[URL] data, behaviour for invalid data is unspecified. - * - * @throws Throws exception in case of incorrect padding. - * - * @param dst memory for writing output. - * @param b pointer to the beginning of base64 encoded string. - * @param a pointer to the end of base64 encoded string - * - * @return Return number of bytes decoded. - */ +/* Decode Base64 encoded data. Can decode both regular Base64 and Base64URL encoded data. Can decode + * only valid Base64[URL] data, behaviour for invalid data is unspecified. + * + * @throws Throws exception in case of incorrect padding. + * + * @param dst memory for writing output. + * @param b pointer to the beginning of base64 encoded string. + * @param a pointer to the end of base64 encoded string + * + * @return Return number of bytes decoded. + */ size_t Base64Decode(void* dst, const char* b, const char* e); -inline TStringBuf Base64Decode(const TStringBuf src, void* dst) { +inline TStringBuf Base64Decode(const TStringBuf src, void* dst) { return TStringBuf((const char*)dst, Base64Decode(dst, src.begin(), src.end())); } @@ -63,7 +63,7 @@ size_t Base64StrictDecode(void* dst, const char* b, const char* e); /// /// @return Returns dst wrapped into TStringBuf. /// -inline TStringBuf Base64StrictDecode(const TStringBuf src, void* dst) { +inline TStringBuf Base64StrictDecode(const TStringBuf src, void* dst) { return TStringBuf((const char*)dst, Base64StrictDecode(dst, src.begin(), src.end())); } @@ -92,18 +92,18 @@ inline TString Base64StrictDecode(const TStringBuf src) { TString Base64DecodeUneven(const TStringBuf s); //encode -constexpr size_t Base64EncodeBufSize(const size_t len) noexcept { - return (len + 2) / 3 * 4 + 1; +constexpr size_t Base64EncodeBufSize(const size_t len) noexcept { + return (len + 2) / 3 * 4 + 1; } char* Base64Encode(char* outstr, const unsigned char* instr, size_t len); char* Base64EncodeUrl(char* outstr, const unsigned char* instr, size_t len); -inline TStringBuf Base64Encode(const TStringBuf src, void* tmp) { +inline TStringBuf Base64Encode(const TStringBuf src, void* tmp) { return TStringBuf((const char*)tmp, Base64Encode((char*)tmp, (const unsigned char*)src.data(), src.size())); } -inline TStringBuf Base64EncodeUrl(const TStringBuf src, void* tmp) { +inline TStringBuf Base64EncodeUrl(const TStringBuf src, void* tmp) { return TStringBuf((const char*)tmp, Base64EncodeUrl((char*)tmp, (const unsigned char*)src.data(), src.size())); } |