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

Side by Side Diff: content/common/android/address_parser_internal.cc

Issue 654403002: Convert ARRAYSIZE_UNSAFE -> arraysize in content/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 (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_internal.h" 5 #include "content/common/android/address_parser_internal.h"
6 6
7 #include <bitset> 7 #include <bitset>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 // Accumulative number of states for sorted names indexed by the first letter. 333 // Accumulative number of states for sorted names indexed by the first letter.
334 // Required a different one since there are codes that don't share their 334 // Required a different one since there are codes that don't share their
335 // first letter with the name of their state (MP = Northern Mariana Islands). 335 // first letter with the name of their state (MP = Northern Mariana Islands).
336 static const int state_names_accumulative[24] = { 336 static const int state_names_accumulative[24] = {
337 0, 5, 5, 8, 10, 10, 12, 14, 337 0, 5, 5, 8, 10, 10, 12, 14,
338 15, 19, 19, 21, 22, 31, 40, 43, 338 15, 19, 19, 21, 22, 31, 40, 43,
339 46, 46, 47, 49, 51, 52, 55, 59 339 46, 46, 47, 49, 51, 52, 55, 59
340 }; 340 };
341 341
342 DCHECK_EQ(state_names_accumulative[arraysize(state_names_accumulative) - 1], 342 DCHECK_EQ(state_names_accumulative[arraysize(state_names_accumulative) - 1],
343 static_cast<int>(ARRAYSIZE_UNSAFE(state_names))); 343 static_cast<int>(arraysize(state_names)));
344 344
345 const Word& first_word = words->at(state_first_word); 345 const Word& first_word = words->at(state_first_word);
346 int length = first_word.end - first_word.begin; 346 int length = first_word.end - first_word.begin;
347 if (length < 2 || !IsAsciiAlpha(*first_word.begin)) 347 if (length < 2 || !IsAsciiAlpha(*first_word.begin))
348 return false; 348 return false;
349 349
350 // No state names start with x, y, z. 350 // No state names start with x, y, z.
351 base::char16 first_letter = base::ToLowerASCII(*first_word.begin); 351 base::char16 first_letter = base::ToLowerASCII(*first_word.begin);
352 if (first_letter > 'w') 352 if (first_letter > 'w')
353 return false; 353 return false;
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 static const int location_names_accumulative[25] = { 583 static const int location_names_accumulative[25] = {
584 0, 7, 19, 40, 44, 584 0, 7, 19, 40, 44,
585 47, 57, 62, 68, 71, 585 47, 57, 62, 68, 71,
586 72, 74, 83, 92, 93, 586 72, 74, 83, 92, 93,
587 96, 109, 109, 121, 135, 587 96, 109, 109, 121, 135,
588 143, 145, 151, 155, 157 588 143, 145, 151, 155, 157
589 }; 589 };
590 590
591 DCHECK_EQ( 591 DCHECK_EQ(
592 location_names_accumulative[arraysize(location_names_accumulative) - 1], 592 location_names_accumulative[arraysize(location_names_accumulative) - 1],
593 static_cast<int>(ARRAYSIZE_UNSAFE(location_names))); 593 static_cast<int>(arraysize(location_names)));
594 594
595 if (!IsAsciiAlpha(*word.begin)) 595 if (!IsAsciiAlpha(*word.begin))
596 return false; 596 return false;
597 597
598 // No location names start with y, z. 598 // No location names start with y, z.
599 base::char16 first_letter = base::ToLowerASCII(*word.begin); 599 base::char16 first_letter = base::ToLowerASCII(*word.begin);
600 if (first_letter > 'x') 600 if (first_letter > 'x')
601 return false; 601 return false;
602 602
603 DCHECK(first_letter >= 'a'); 603 DCHECK(first_letter >= 'a');
(...skipping 15 matching lines...) Expand all
619 } 619 }
620 620
621 return false; 621 return false;
622 } 622 }
623 623
624 } // namespace internal 624 } // namespace internal
625 625
626 } // namespace address_parser 626 } // namespace address_parser
627 627
628 } // namespace content 628 } // namespace content
OLDNEW
« no previous file with comments | « content/child/webcrypto/test/test_helpers.cc ('k') | content/common/database_identifier_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698