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

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_util.cc

Issue 7823004: Convert SHA256_LENGTH from a constant-in-anonymous-enum to a static const. This defines the cons... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 3 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/safe_browsing/safe_browsing_util.h" 5 #include "chrome/browser/safe_browsing/safe_browsing_util.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 client_name.append("_csd"); 519 client_name.append("_csd");
520 520
521 GURL report_url(report_page + base::StringPrintf(kReportParams, 521 GURL report_url(report_page + base::StringPrintf(kReportParams,
522 client_name.c_str(), 522 client_name.c_str(),
523 continue_esc.c_str(), 523 continue_esc.c_str(),
524 current_esc.c_str())); 524 current_esc.c_str()));
525 return google_util::AppendGoogleLocaleParam(report_url); 525 return google_util::AppendGoogleLocaleParam(report_url);
526 } 526 }
527 527
528 void StringToSBFullHash(const std::string& hash_in, SBFullHash* hash_out) { 528 void StringToSBFullHash(const std::string& hash_in, SBFullHash* hash_out) {
529 DCHECK_EQ(static_cast<size_t>(crypto::SHA256_LENGTH), hash_in.size()); 529 DCHECK_EQ(crypto::kSHA256Length, hash_in.size());
530 memcpy(hash_out->full_hash, hash_in.data(), crypto::SHA256_LENGTH); 530 memcpy(hash_out->full_hash, hash_in.data(), crypto::kSHA256Length);
531 } 531 }
532 532
533 std::string SBFullHashToString(const SBFullHash& hash) { 533 std::string SBFullHashToString(const SBFullHash& hash) {
534 DCHECK_EQ(static_cast<size_t>(crypto::SHA256_LENGTH), sizeof(hash.full_hash)); 534 DCHECK_EQ(crypto::kSHA256Length, sizeof(hash.full_hash));
wtc 2011/09/02 17:08:42 The removal of these static_casts is good!
535 return std::string(hash.full_hash, sizeof(hash.full_hash)); 535 return std::string(hash.full_hash, sizeof(hash.full_hash));
536 } 536 }
537 } // namespace safe_browsing_util 537 } // namespace safe_browsing_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698