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

Side by Side Diff: base/lookup_string_in_fixed_set.cc

Issue 2784933002: Mitigate spoofing attempt using Latin letters. (Closed)
Patch Set: add similarity check unittests Created 3 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "net/base/lookup_string_in_fixed_set.h" 5 #include "base/lookup_string_in_fixed_set.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace net { 9 namespace base {
10 10
11 namespace { 11 namespace {
12 12
13 // Read next offset from |pos|, increment |offset| by that amount, and increment 13 // Read next offset from |pos|, increment |offset| by that amount, and increment
14 // |pos| either to point to the start of the next encoded offset in its node, or 14 // |pos| either to point to the start of the next encoded offset in its node, or
15 // nullptr, if there are no remaining offsets. 15 // nullptr, if there are no remaining offsets.
16 // 16 //
17 // Returns true if an offset could be read; false otherwise. 17 // Returns true if an offset could be read; false otherwise.
18 inline bool GetNextOffset(const unsigned char** pos, 18 inline bool GetNextOffset(const unsigned char** pos,
19 const unsigned char** offset) { 19 const unsigned char** offset) {
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 while (key != key_end) { 188 while (key != key_end) {
189 if (!lookup.Advance(*key)) 189 if (!lookup.Advance(*key))
190 return kDafsaNotFound; 190 return kDafsaNotFound;
191 key++; 191 key++;
192 } 192 }
193 // The entire input was consumed without reaching the end of the graph. Return 193 // The entire input was consumed without reaching the end of the graph. Return
194 // the result code (if present) for the current position, or kDafsaNotFound. 194 // the result code (if present) for the current position, or kDafsaNotFound.
195 return lookup.GetResultForCurrentSequence(); 195 return lookup.GetResultForCurrentSequence();
196 } 196 }
197 197
198 } // namespace net 198 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698