summaryrefslogtreecommitdiff
path: root/abseil-cpp/absl/strings/internal/escaping.h
diff options
context:
space:
mode:
Diffstat (limited to 'abseil-cpp/absl/strings/internal/escaping.h')
-rw-r--r--abseil-cpp/absl/strings/internal/escaping.h17
1 files changed, 8 insertions, 9 deletions
diff --git a/abseil-cpp/absl/strings/internal/escaping.h b/abseil-cpp/absl/strings/internal/escaping.h
index 6a9ce60..2186f77 100644
--- a/abseil-cpp/absl/strings/internal/escaping.h
+++ b/abseil-cpp/absl/strings/internal/escaping.h
@@ -24,20 +24,19 @@ ABSL_NAMESPACE_BEGIN
namespace strings_internal {
ABSL_CONST_INIT extern const char kBase64Chars[];
+ABSL_CONST_INIT extern const char kWebSafeBase64Chars[];
-// 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) {