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

Side by Side Diff: chrome/common/visitedlink_common.cc

Issue 384103: This patch is the rest of the lint cleanup minus the other open issue. (Closed)
Patch Set: Created 11 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 unified diff | Download patch
« no previous file with comments | « chrome/common/visitedlink_common.h ('k') | chrome/common/web_resource/web_resource_unpacker.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/common/visitedlink_common.h" 5 #include "chrome/common/visitedlink_common.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/md5.h" 8 #include "base/md5.h"
9 9
10 const VisitedLinkCommon::Fingerprint VisitedLinkCommon::null_fingerprint_ = 0; 10 const VisitedLinkCommon::Fingerprint VisitedLinkCommon::null_fingerprint_ = 0;
11 const VisitedLinkCommon::Hash VisitedLinkCommon::null_hash_ = -1; 11 const VisitedLinkCommon::Hash VisitedLinkCommon::null_hash_ = -1;
12 12
13 VisitedLinkCommon::VisitedLinkCommon() : 13 VisitedLinkCommon::VisitedLinkCommon()
14 hash_table_(NULL), 14 : hash_table_(NULL),
15 table_length_(0) { 15 table_length_(0) {
16 } 16 }
17 17
18 VisitedLinkCommon::~VisitedLinkCommon() { 18 VisitedLinkCommon::~VisitedLinkCommon() {
19 } 19 }
20 20
21 // FIXME: this uses linear probing, it should be replaced with quadratic 21 // FIXME: this uses linear probing, it should be replaced with quadratic
22 // probing or something better. See VisitedLinkMaster::AddFingerprint 22 // probing or something better. See VisitedLinkMaster::AddFingerprint
23 bool VisitedLinkCommon::IsVisited(const char* canonical_url, 23 bool VisitedLinkCommon::IsVisited(const char* canonical_url,
24 size_t url_len) const { 24 size_t url_len) const {
25 if (url_len == 0) 25 if (url_len == 0)
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 MD5Final(&digest, &ctx); 80 MD5Final(&digest, &ctx);
81 81
82 // This is the same as "return *(Fingerprint*)&digest.a;" but if we do that 82 // This is the same as "return *(Fingerprint*)&digest.a;" but if we do that
83 // direct cast the alignment could be wrong, and we can't access a 64-bit int 83 // direct cast the alignment could be wrong, and we can't access a 64-bit int
84 // on arbitrary alignment on some processors. This reinterpret_casts it 84 // on arbitrary alignment on some processors. This reinterpret_casts it
85 // down to a char array of the same size as fingerprint, and then does the 85 // down to a char array of the same size as fingerprint, and then does the
86 // bit cast, which amounts to a memcpy. This does not handle endian issues. 86 // bit cast, which amounts to a memcpy. This does not handle endian issues.
87 return bit_cast<Fingerprint, uint8[8]>( 87 return bit_cast<Fingerprint, uint8[8]>(
88 *reinterpret_cast<uint8(*)[8]>(&digest.a)); 88 *reinterpret_cast<uint8(*)[8]>(&digest.a));
89 } 89 }
OLDNEW
« no previous file with comments | « chrome/common/visitedlink_common.h ('k') | chrome/common/web_resource/web_resource_unpacker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698