Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Unified Diff: base/base64.cc

Issue 86913002: Make base::Base64Encode() return void (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: One more chromeos-specific fix. Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/base64.h ('k') | base/base64_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/base64.cc
diff --git a/base/base64.cc b/base/base64.cc
index 9514b0a5c2ca7d44d5d24b692cb7ab8a004aeeeb..8ed1249257d6fd7de3472a5cc3e87a69edbe3e28 100644
--- a/base/base64.cc
+++ b/base/base64.cc
@@ -8,21 +8,15 @@
namespace base {
-bool Base64Encode(const StringPiece& input, std::string* output) {
+void Base64Encode(const StringPiece& input, std::string* output) {
std::string temp;
temp.resize(modp_b64_encode_len(input.size())); // makes room for null byte
- // null terminates result since result is base64 text!
- int input_size = static_cast<int>(input.size());
-
// modp_b64_encode_len() returns at least 1, so temp[0] is safe to use.
- size_t output_size = modp_b64_encode(&(temp[0]), input.data(), input_size);
- if (output_size == MODP_B64_ERROR)
- return false;
+ size_t output_size = modp_b64_encode(&(temp[0]), input.data(), input.size());
temp.resize(output_size); // strips off null byte
output->swap(temp);
- return true;
}
bool Base64Decode(const StringPiece& input, std::string* output) {
« no previous file with comments | « base/base64.h ('k') | base/base64_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698