mirror of
https://github.com/abseil/abseil-cpp.git
synced 2026-06-04 12:07:05 +08:00
Deprecate the versions of Base64Escape() and WebSafeBase64Escape()
that use an output parameter. These versions are clearly inferior to the versions that return a string. This is a response to https://github.com/abseil/abseil-cpp/issues/2015 Fixes #2015 PiperOrigin-RevId: 870281461 Change-Id: I92f23d51d05a243dde88c997c1e8448819c5bc77
This commit is contained in:
committed by
Copybara-Service
parent
5ec376e34b
commit
586a3fbe2a
@@ -954,19 +954,6 @@ bool WebSafeBase64Unescape(absl::string_view src,
|
||||
return Base64UnescapeInternal(src.data(), src.size(), dest, kUnWebSafeBase64);
|
||||
}
|
||||
|
||||
void Base64Escape(absl::string_view src, std::string* absl_nonnull dest) {
|
||||
strings_internal::Base64EscapeInternal(
|
||||
reinterpret_cast<const unsigned char*>(src.data()), src.size(), dest,
|
||||
true, strings_internal::kBase64Chars);
|
||||
}
|
||||
|
||||
void WebSafeBase64Escape(absl::string_view src,
|
||||
std::string* absl_nonnull dest) {
|
||||
strings_internal::Base64EscapeInternal(
|
||||
reinterpret_cast<const unsigned char*>(src.data()), src.size(), dest,
|
||||
false, strings_internal::kWebSafeBase64Chars);
|
||||
}
|
||||
|
||||
std::string Base64Escape(absl::string_view src) {
|
||||
std::string dest;
|
||||
strings_internal::Base64EscapeInternal(
|
||||
|
||||
@@ -126,16 +126,26 @@ std::string Utf8SafeCHexEscape(absl::string_view src);
|
||||
// Encodes a `src` string into a base64-encoded 'dest' string with padding
|
||||
// characters. This function conforms with RFC 4648 section 4 (base64) and RFC
|
||||
// 2045.
|
||||
void Base64Escape(absl::string_view src, std::string* absl_nonnull dest);
|
||||
std::string Base64Escape(absl::string_view src);
|
||||
[[deprecated(
|
||||
"Use the string-returning version of "
|
||||
"Base64Escape()")]] ABSL_REFACTOR_INLINE inline void
|
||||
Base64Escape(absl::string_view src, std::string* absl_nonnull dest) {
|
||||
*dest = Base64Escape(src);
|
||||
}
|
||||
|
||||
// WebSafeBase64Escape()
|
||||
//
|
||||
// Encodes a `src` string into a base64 string, like Base64Escape() does, but
|
||||
// outputs '-' instead of '+' and '_' instead of '/', and does not pad 'dest'.
|
||||
// This function conforms with RFC 4648 section 5 (base64url).
|
||||
void WebSafeBase64Escape(absl::string_view src, std::string* absl_nonnull dest);
|
||||
std::string WebSafeBase64Escape(absl::string_view src);
|
||||
[[deprecated(
|
||||
"Use the string-returning version of "
|
||||
"WebSafeBase64Escape()")]] ABSL_REFACTOR_INLINE inline void
|
||||
WebSafeBase64Escape(absl::string_view src, std::string* absl_nonnull dest) {
|
||||
*dest = WebSafeBase64Escape(src);
|
||||
}
|
||||
|
||||
// Base64Unescape()
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user