aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/string_utils/base64/base64.h
diff options
context:
space:
mode:
authoryazevnul <yazevnul@yandex-team.ru>2022-02-10 16:46:48 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:48 +0300
commit9abfb1a53b7f7b791444d1378e645d8fad9b06ed (patch)
tree49e222ea1c5804306084bb3ae065bb702625360f /library/cpp/string_utils/base64/base64.h
parent8cbc307de0221f84c80c42dcbe07d40727537e2c (diff)
downloadydb-9abfb1a53b7f7b791444d1378e645d8fad9b06ed.tar.gz
Restoring authorship annotation for <yazevnul@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/string_utils/base64/base64.h')
-rw-r--r--library/cpp/string_utils/base64/base64.h42
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 57a121537d..f778a6425a 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()));
}