diff options
Diffstat (limited to 'absl/strings/internal/escaping.h')
-rw-r--r-- | absl/strings/internal/escaping.h | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/absl/strings/internal/escaping.h b/absl/strings/internal/escaping.h index 6a9ce602..b04033ff 100644 --- a/absl/strings/internal/escaping.h +++ b/absl/strings/internal/escaping.h @@ -25,19 +25,17 @@ namespace strings_internal { ABSL_CONST_INIT extern const char kBase64Chars[]; -// Calculates how long a string will be when it is base64 encoded given its -// length and whether or not the result should be padded. +// Calculates the length of a Base64 encoding (RFC 4648) of a string of length +// `input_len`, with or without padding per `do_padding`. Note that 'web-safe' +// encoding (section 5 of the RFC) does not change this length. size_t CalculateBase64EscapedLenInternal(size_t input_len, bool do_padding); -// Base64-encodes `src` using the alphabet provided in `base64` and writes the -// result to `dest`. If `do_padding` is true, `dest` is padded with '=' chars -// until its length is a multiple of 3. Returns the length of `dest`. +// Base64-encodes `src` using the alphabet provided in `base64` (which +// determines whether to do web-safe encoding or not) and writes the result to +// `dest`. If `do_padding` is true, `dest` is padded with '=' chars until its +// length is a multiple of 3. Returns the length of `dest`. size_t Base64EscapeInternal(const unsigned char* src, size_t szsrc, char* dest, size_t szdest, const char* base64, bool do_padding); - -// Base64-encodes `src` using the alphabet provided in `base64` and writes the -// result to `dest`. If `do_padding` is true, `dest` is padded with '=' chars -// until its length is a multiple of 3. template <typename String> void Base64EscapeInternal(const unsigned char* src, size_t szsrc, String* dest, bool do_padding, const char* base64_chars) { |