diff options
author | brettw <brettw@chromium.org> | 2015-07-13 19:24:50 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-14 02:25:27 +0000 |
commit | a2027fb609835a3f95557b39611e3d11b89fca03 (patch) | |
tree | 588e2007b546480bd3db40ab21be838386315f15 /chrome/installer/util | |
parent | 5b3151cd707dee82b947ae096b12967e3c4a7c26 (diff) | |
download | chromium_src-a2027fb609835a3f95557b39611e3d11b89fca03.zip chromium_src-a2027fb609835a3f95557b39611e3d11b89fca03.tar.gz chromium_src-a2027fb609835a3f95557b39611e3d11b89fca03.tar.bz2 |
Remove CaseInsensitiveCompare from string_util.h
There were a number of callers in net using this for HTTP headers. I think
these callers actually just need ASCII case-insensitive comparisons so these
were changed.
The omnibox code used this functor. I added a new omnibox-specific one which
does not have the locale issues of the old string_util one, but which still
has the UTF-16 and combining accent issues (described in great detail in
the comment for this).
The Windows installer code can't depend on ICU so it calls the Win32 function
to do case-insensitive comparisons. This should match the system comparison
for registry keys better anyway.
I also changed a caller of StartsWith to use this version. I wrote this
StartsWith call using ToLower in a previous patch, but it turns out that the
lengths of case-mapped strings do change in practice, making the offset
computations of the suyrrounding code incorrect. This new version will be
like the old version (will miss some cases of case-insensitive equality) but
will handle 0x80-0xFF properly.
BUG=24917
Review URL: https://codereview.chromium.org/1230583014
Cr-Commit-Position: refs/heads/master@{#338624}
Diffstat (limited to 'chrome/installer/util')
-rw-r--r-- | chrome/installer/util/shell_util.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc index 87a0d58..655d2f8 100644 --- a/chrome/installer/util/shell_util.cc +++ b/chrome/installer/util/shell_util.cc @@ -746,8 +746,12 @@ class RegistryEntry { found = key.ReadValue(name_.c_str(), &read_value) == ERROR_SUCCESS; if (found) { correct_value = read_value.size() == value_.size() && - std::equal(value_.begin(), value_.end(), read_value.begin(), - base::CaseInsensitiveCompare<wchar_t>()); + ::CompareString(LOCALE_USER_DEFAULT, NORM_IGNORECASE, + read_value.data(), + base::saturated_cast<int>(read_value.size()), + value_.data(), + base::saturated_cast<int>(value_.size())) + == CSTR_EQUAL; } } else { DWORD read_value; |