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

Side by Side Diff: base/hash.cc

Issue 1916193003: Change SuperFastHash signature to use size_t, not int. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « base/hash.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/hash.h" 5 #include "base/hash.h"
6 6
7 // Definition in base/third_party/superfasthash/superfasthash.c. (Third-party 7 // Definition in base/third_party/superfasthash/superfasthash.c. (Third-party
8 // code did not come with its own header file, so declaring the function here.) 8 // code did not come with its own header file, so declaring the function here.)
9 // Note: This algorithm is also in Blink under Source/wtf/StringHasher.h. 9 // Note: This algorithm is also in Blink under Source/wtf/StringHasher.h.
10 extern "C" uint32_t SuperFastHash(const char* data, int len); 10 extern "C" uint32_t SuperFastHash(const char* data, int len);
11 11
12 namespace base { 12 namespace base {
13 13
14 uint32_t SuperFastHash(const char* data, int len) { 14 uint32_t SuperFastHash(const char* data, size_t length) {
15 return ::SuperFastHash(data, len); 15 if (length > static_cast<size_t>(std::numeric_limits<int>::max())) {
16 NOTREACHED();
17 return 0;
18 }
19 return ::SuperFastHash(data, static_cast<int>(length));
16 } 20 }
17 21
18 } // namespace base 22 } // namespace base
OLDNEW
« no previous file with comments | « base/hash.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698