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

Side by Side Diff: components/query_parser/query_parser.cc

Issue 1551433002: Switch to standard integer types in components/, part 3 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 4 years, 12 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 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 "components/query_parser/query_parser.h" 5 #include "components/query_parser/query_parser.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/i18n/break_iterator.h" 10 #include "base/i18n/break_iterator.h"
11 #include "base/i18n/case_conversion.h" 11 #include "base/i18n/case_conversion.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/macros.h"
13 #include "base/stl_util.h" 14 #include "base/stl_util.h"
14 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
15 16
16 namespace query_parser { 17 namespace query_parser {
17 namespace { 18 namespace {
18 19
19 // Returns true if |mp1.first| is less than |mp2.first|. This is used to 20 // Returns true if |mp1.first| is less than |mp2.first|. This is used to
20 // sort match positions. 21 // sort match positions.
21 int CompareMatchPosition(const Snippet::MatchPosition& mp1, 22 int CompareMatchPosition(const Snippet::MatchPosition& mp1,
22 const Snippet::MatchPosition& mp2) { 23 const Snippet::MatchPosition& mp2) {
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 void QueryParser::SortAndCoalesceMatchPositions( 476 void QueryParser::SortAndCoalesceMatchPositions(
476 Snippet::MatchPositions* matches) { 477 Snippet::MatchPositions* matches) {
477 std::sort(matches->begin(), matches->end(), &CompareMatchPosition); 478 std::sort(matches->begin(), matches->end(), &CompareMatchPosition);
478 // WARNING: we don't use iterator here as CoalesceMatchesFrom may remove 479 // WARNING: we don't use iterator here as CoalesceMatchesFrom may remove
479 // from matches. 480 // from matches.
480 for (size_t i = 0; i < matches->size(); ++i) 481 for (size_t i = 0; i < matches->size(); ++i)
481 CoalesceMatchesFrom(i, matches); 482 CoalesceMatchesFrom(i, matches);
482 } 483 }
483 484
484 } // namespace query_parser 485 } // namespace query_parser
OLDNEW
« no previous file with comments | « components/query_parser/query_parser.h ('k') | components/query_parser/query_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698