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

Side by Side Diff: Source/core/platform/text/LocaleToScriptMappingDefault.cpp

Issue 23464095: WTF::notFound looks too much like a local variable. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 for (size_t i = 0; i < sizeof(localeScriptList) / sizeof(localeScriptLis t[0]); ++i) 384 for (size_t i = 0; i < sizeof(localeScriptList) / sizeof(localeScriptLis t[0]); ++i)
385 localeScriptMap.set(localeScriptList[i].locale, localeScriptList[i]. script); 385 localeScriptMap.set(localeScriptList[i].locale, localeScriptList[i]. script);
386 } 386 }
387 387
388 String canonicalLocale = locale.lower().replace('-', '_'); 388 String canonicalLocale = locale.lower().replace('-', '_');
389 while (!canonicalLocale.isEmpty()) { 389 while (!canonicalLocale.isEmpty()) {
390 HashMap<String, UScriptCode>::iterator it = localeScriptMap.find(canonic alLocale); 390 HashMap<String, UScriptCode>::iterator it = localeScriptMap.find(canonic alLocale);
391 if (it != localeScriptMap.end()) 391 if (it != localeScriptMap.end())
392 return it->value; 392 return it->value;
393 size_t pos = canonicalLocale.reverseFind('_'); 393 size_t pos = canonicalLocale.reverseFind('_');
394 if (pos == notFound) 394 if (pos == kNotFound)
395 break; 395 break;
396 UScriptCode code = scriptNameToCode(canonicalLocale.substring(pos + 1)); 396 UScriptCode code = scriptNameToCode(canonicalLocale.substring(pos + 1));
397 if (code != USCRIPT_INVALID_CODE && code != USCRIPT_UNKNOWN) 397 if (code != USCRIPT_INVALID_CODE && code != USCRIPT_UNKNOWN)
398 return code; 398 return code;
399 canonicalLocale = canonicalLocale.substring(0, pos); 399 canonicalLocale = canonicalLocale.substring(0, pos);
400 } 400 }
401 return USCRIPT_COMMON; 401 return USCRIPT_COMMON;
402 } 402 }
403 403
404 } // namespace WebCore 404 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/platform/text/DecodeEscapeSequences.h ('k') | Source/core/platform/text/mac/LocaleMac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698