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

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: Created 7 years, 1 month 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
« base/base64.h ('K') | « base/base64.h ('k') | no next file » | 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..84f5f548c80d059c4efc321ee02a6bffb1175611 100644
--- a/base/base64.cc
+++ b/base/base64.cc
@@ -12,13 +12,8 @@ bool 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);
« base/base64.h ('K') | « base/base64.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698