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

Unified Diff: content/child/webcrypto/webcrypto_util.cc

Issue 410743002: [refactor] Replace custom utility function with base's "vector_as_array()" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase onto master Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/child/webcrypto/webcrypto_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/webcrypto/webcrypto_util.cc
diff --git a/content/child/webcrypto/webcrypto_util.cc b/content/child/webcrypto/webcrypto_util.cc
index b94cbea2208b3100edbb36cfcc02b9ee1e835f6a..929b491c4481be4667fce86c11fa5ec2c586a663 100644
--- a/content/child/webcrypto/webcrypto_util.cc
+++ b/content/child/webcrypto/webcrypto_util.cc
@@ -6,6 +6,7 @@
#include "base/base64.h"
#include "base/logging.h"
+#include "base/stl_util.h"
#include "base/strings/stringprintf.h"
#include "content/child/webcrypto/status.h"
#include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h"
@@ -16,18 +17,6 @@ namespace content {
namespace webcrypto {
-const uint8_t* Uint8VectorStart(const std::vector<uint8_t>& data) {
- if (data.empty())
- return NULL;
- return &data[0];
-}
-
-uint8_t* Uint8VectorStart(std::vector<uint8_t>* data) {
- if (data->empty())
- return NULL;
- return &(*data)[0];
-}
-
// This function decodes unpadded 'base64url' encoded data, as described in
// RFC4648 (http://www.ietf.org/rfc/rfc4648.txt) Section 5. To do this, first
// change the incoming data to 'base64' encoding by applying the appropriate
@@ -54,7 +43,7 @@ std::string Base64EncodeUrlSafe(const base::StringPiece& input) {
std::string Base64EncodeUrlSafe(const std::vector<uint8_t>& input) {
const base::StringPiece string_piece(
- reinterpret_cast<const char*>(Uint8VectorStart(input)), input.size());
+ reinterpret_cast<const char*>(vector_as_array(&input)), input.size());
return Base64EncodeUrlSafe(string_piece);
}
« no previous file with comments | « content/child/webcrypto/webcrypto_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698