diff options
author | joth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-16 12:31:26 +0000 |
---|---|---|
committer | joth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-16 12:31:26 +0000 |
commit | 9b742fbb3a44c7185d94e827b7573d552b9794ec (patch) | |
tree | f79f6894c93a89a0671e6a2ea876a9b4edc5ef9b | |
parent | 489199b97c93c1d9d3e82a7bf78b818cd87c4fc2 (diff) | |
download | chromium_src-9b742fbb3a44c7185d94e827b7573d552b9794ec.zip chromium_src-9b742fbb3a44c7185d94e827b7573d552b9794ec.tar.gz chromium_src-9b742fbb3a44c7185d94e827b7573d552b9794ec.tar.bz2 |
Move ToUpperASCII into base namespace, to make it consistent with ToLowerASCII
This mirrors the change made in http://src.chromium.org/viewvc/chrome?view=rev&revision=64879
BUG=None
TEST=everything builds; base unit tests pass
Review URL: http://codereview.chromium.org/5007001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66261 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/string_util.h | 14 | ||||
-rw-r--r-- | chrome/browser/chromeos/input_method/input_method_util.cc | 2 | ||||
-rw-r--r-- | chrome/browser/search_engines/template_url_prepopulate_data.cc | 3 |
3 files changed, 10 insertions, 9 deletions
diff --git a/base/string_util.h b/base/string_util.h index 5466403..498ccc5 100644 --- a/base/string_util.h +++ b/base/string_util.h @@ -122,6 +122,12 @@ template <class Char> inline Char ToLowerASCII(Char c) { return (c >= 'A' && c <= 'Z') ? (c + ('a' - 'A')) : c; } +// ASCII-specific toupper. The standard library's toupper is locale sensitive, +// so we don't want to use it here. +template <class Char> inline Char ToUpperASCII(Char c) { + return (c >= 'a' && c <= 'z') ? (c + ('A' - 'a')) : c; +} + // Function objects to aid in comparing/searching strings. template<typename Char> struct CaseInsensitiveCompare { @@ -295,17 +301,11 @@ template <class str> inline str StringToLowerASCII(const str& s) { return output; } -// ASCII-specific toupper. The standard library's toupper is locale sensitive, -// so we don't want to use it here. -template <class Char> inline Char ToUpperASCII(Char c) { - return (c >= 'a' && c <= 'z') ? (c + ('A' - 'a')) : c; -} - // Converts the elements of the given string. This version uses a pointer to // clearly differentiate it from the non-pointer variant. template <class str> inline void StringToUpperASCII(str* s) { for (typename str::iterator i = s->begin(); i != s->end(); ++i) - *i = ToUpperASCII(*i); + *i = base::ToUpperASCII(*i); } template <class str> inline str StringToUpperASCII(const str& s) { diff --git a/chrome/browser/chromeos/input_method/input_method_util.cc b/chrome/browser/chromeos/input_method/input_method_util.cc index abf4e321..49f9d5b 100644 --- a/chrome/browser/chromeos/input_method/input_method_util.cc +++ b/chrome/browser/chromeos/input_method/input_method_util.cc @@ -376,7 +376,7 @@ std::string NormalizeLanguageCode( } // Upcase the country code part. for (size_t i = 3; i < copied_language_code.size(); ++i) { - copied_language_code[i] = ToUpperASCII(copied_language_code[i]); + copied_language_code[i] = base::ToUpperASCII(copied_language_code[i]); } return copied_language_code; } diff --git a/chrome/browser/search_engines/template_url_prepopulate_data.cc b/chrome/browser/search_engines/template_url_prepopulate_data.cc index 127944a..b1fa624 100644 --- a/chrome/browser/search_engines/template_url_prepopulate_data.cc +++ b/chrome/browser/search_engines/template_url_prepopulate_data.cc @@ -2938,7 +2938,8 @@ int GetCurrentCountryID() { // The territory part must contain exactly two characters. if (end - begin == 2) { return CountryCharsToCountryIDWithUpdate( - ToUpperASCII(locale_str[begin]), ToUpperASCII(locale_str[begin + 1])); + base::ToUpperASCII(locale_str[begin]), + base::ToUpperASCII(locale_str[begin + 1])); } return kCountryIDUnknown; |