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

Side by Side Diff: trunk/src/content/common/android/address_parser.cc

Issue 474483002: Revert 289312 "Move StringToUpperASCII and LowerCaseEqualsASCII ..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 4 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/common/android/address_parser.h" 5 #include "content/common/android/address_parser.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "content/common/android/address_parser_internal.h" 9 #include "content/common/android/address_parser_internal.h"
10 10
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 &tokenizer, &state_index)) { 164 &tokenizer, &state_index)) {
165 165
166 // A location name should have been found at this point. 166 // A location name should have been found at this point.
167 if (!found_location_name) 167 if (!found_location_name)
168 break; 168 break;
169 169
170 // Explicitly exclude "et al", as "al" is a valid state code. 170 // Explicitly exclude "et al", as "al" is a valid state code.
171 if (current_word_length == 2 && words.size() > 2) { 171 if (current_word_length == 2 && words.size() > 2) {
172 const Word& previous_word = words[state_first_word - 1]; 172 const Word& previous_word = words[state_first_word - 1];
173 if (previous_word.end - previous_word.begin == 2 && 173 if (previous_word.end - previous_word.begin == 2 &&
174 base::LowerCaseEqualsASCII(previous_word.begin, 174 LowerCaseEqualsASCII(previous_word.begin, previous_word.end,
175 previous_word.end, 175 "et") &&
176 "et") && 176 LowerCaseEqualsASCII(current_word.begin, current_word.end,
177 base::LowerCaseEqualsASCII(current_word.begin, 177 "al"))
178 current_word.end,
179 "al"))
180 break; 178 break;
181 } 179 }
182 180
183 // Extract one more word from the tokenizer if not already available. 181 // Extract one more word from the tokenizer if not already available.
184 size_t zip_word = state_last_word + 1; 182 size_t zip_word = state_last_word + 1;
185 if (zip_word == words.size()) { 183 if (zip_word == words.size()) {
186 do { 184 do {
187 if (!tokenizer.GetNext()) 185 if (!tokenizer.GetNext())
188 return false; 186 return false;
189 } while (tokenizer.token_is_delim()); 187 } while (tokenizer.token_is_delim());
(...skipping 23 matching lines...) Expand all
213 it = words[next_word].end; 211 it = words[next_word].end;
214 } 212 }
215 } 213 }
216 214
217 return false; 215 return false;
218 } 216 }
219 217
220 } // namespace address_parser 218 } // namespace address_parser
221 219
222 } // namespace content 220 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698