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

Side by Side Diff: base/base64.cc

Issue 10795083: Enable some parts of base that were previously disabled in base_untrusted (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/base64.h" 5 #include "base/base64.h"
6 6
7 #include "base/compiler_specific.h"
8
9 MSVC_PUSH_DISABLE_WARNING(4267);
7 #include "third_party/modp_b64/modp_b64.h" 10 #include "third_party/modp_b64/modp_b64.h"
11 MSVC_POP_WARNING();
8 12
9 namespace base { 13 namespace base {
10 14
11 bool Base64Encode(const StringPiece& input, std::string* output) { 15 bool Base64Encode(const StringPiece& input, std::string* output) {
12 std::string temp; 16 std::string temp;
13 temp.resize(modp_b64_encode_len(input.size())); // makes room for null byte 17 temp.resize(modp_b64_encode_len(input.size())); // makes room for null byte
14 18
15 // null terminates result since result is base64 text! 19 // null terminates result since result is base64 text!
16 int input_size = static_cast<int>(input.size()); 20 int input_size = static_cast<int>(input.size());
17 21
(...skipping 16 matching lines...) Expand all
34 int output_size = modp_b64_decode(&(temp[0]), input.data(), input_size); 38 int output_size = modp_b64_decode(&(temp[0]), input.data(), input_size);
35 if (output_size < 0) 39 if (output_size < 0)
36 return false; 40 return false;
37 41
38 temp.resize(output_size); 42 temp.resize(output_size);
39 output->swap(temp); 43 output->swap(temp);
40 return true; 44 return true;
41 } 45 }
42 46
43 } // namespace base 47 } // namespace base
OLDNEW
« base/DEPS ('K') | « base/base.gypi ('k') | base/base_untrusted.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698