summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/string_util.cc4
-rw-r--r--base/string_util.h35
-rw-r--r--chrome/installer/setup/uninstall.cc2
-rw-r--r--chrome/installer/util/shell_util.cc7
-rw-r--r--chrome_frame/test_utils.cc2
-rw-r--r--net/base/net_util.cc4
-rw-r--r--net/http/http_response_headers.cc4
-rw-r--r--net/http/http_util.cc2
-rw-r--r--net/url_request/url_request_unittest.cc2
9 files changed, 32 insertions, 30 deletions
diff --git a/base/string_util.cc b/base/string_util.cc
index b242329..fd8438a 100644
--- a/base/string_util.cc
+++ b/base/string_util.cc
@@ -568,7 +568,7 @@ bool StartsWithT(const STR& str, const STR& search, bool case_sensitive) {
if (search.size() > str.size())
return false;
return std::equal(search.begin(), search.end(), str.begin(),
- CaseInsensitiveCompare<typename STR::value_type>());
+ base::CaseInsensitiveCompare<typename STR::value_type>());
}
}
@@ -595,7 +595,7 @@ bool EndsWithT(const STR& str, const STR& search, bool case_sensitive) {
} else {
return std::equal(search.begin(), search.end(),
str.begin() + (str_length - search_length),
- CaseInsensitiveCompare<typename STR::value_type>());
+ base::CaseInsensitiveCompare<typename STR::value_type>());
}
}
diff --git a/base/string_util.h b/base/string_util.h
index 27de472..186679e 100644
--- a/base/string_util.h
+++ b/base/string_util.h
@@ -116,6 +116,24 @@ size_t wcslcpy(wchar_t* dst, const wchar_t* src, size_t dst_size);
// This function is intended to be called from base::vswprintf.
bool IsWprintfFormatPortable(const wchar_t* format);
+// Function objects to aid in comparing/searching strings.
+
+template<typename Char> struct CaseInsensitiveCompare {
+ public:
+ bool operator()(Char x, Char y) const {
+ // TODO(darin): Do we really want to do locale sensitive comparisons here?
+ // See http://crbug.com/24917
+ return tolower(x) == tolower(y);
+ }
+};
+
+template<typename Char> struct CaseInsensitiveCompareASCII {
+ public:
+ bool operator()(Char x, Char y) const {
+ return ToLowerASCII(x) == ToLowerASCII(y);
+ }
+};
+
} // namespace base
#if defined(OS_WIN)
@@ -468,23 +486,6 @@ inline typename string_type::value_type* WriteInto(string_type* str,
//-----------------------------------------------------------------------------
-// Function objects to aid in comparing/searching strings.
-
-template<typename Char> struct CaseInsensitiveCompare {
- public:
- bool operator()(Char x, Char y) const {
- // TODO(darin): Do we really want to do locale sensitive comparisons here?
- // See http://crbug.com/24917
- return tolower(x) == tolower(y);
- }
-};
-
-template<typename Char> struct CaseInsensitiveCompareASCII {
- public:
- bool operator()(Char x, Char y) const {
- return ToLowerASCII(x) == ToLowerASCII(y);
- }
-};
// Splits a string into its fields delimited by any of the characters in
// |delimiters|. Each field is added to the |tokens| vector. Returns the
diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc
index 92f22d1..1517946 100644
--- a/chrome/installer/setup/uninstall.cc
+++ b/chrome/installer/setup/uninstall.cc
@@ -94,7 +94,7 @@ bool CurrentUserHasDefaultBrowser(bool system_uninstall) {
reg_exe = reg_exe.substr(1, reg_exe.length() - 2);
if ((reg_exe.size() == chrome_exe.size()) &&
(std::equal(chrome_exe.begin(), chrome_exe.end(),
- reg_exe.begin(), CaseInsensitiveCompare<wchar_t>())))
+ reg_exe.begin(), base::CaseInsensitiveCompare<wchar_t>())))
return true;
}
diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc
index 343f434..3d2e7a6 100644
--- a/chrome/installer/util/shell_util.cc
+++ b/chrome/installer/util/shell_util.cc
@@ -201,7 +201,7 @@ class RegistryEntry {
found = (key.ReadValue(_name.c_str(), &read_value)) &&
(read_value.size() == _value.size()) &&
(std::equal(_value.begin(), _value.end(), read_value.begin(),
- CaseInsensitiveCompare<wchar_t>()));
+ base::CaseInsensitiveCompare<wchar_t>()));
} else {
DWORD read_value;
found = key.ReadValueDW(_name.c_str(), &read_value) &&
@@ -365,8 +365,9 @@ bool AnotherUserHasDefaultBrowser(const std::wstring& chrome_exe) {
if ((registry_chrome_exe.size() == chrome_exe.size()) &&
(std::equal(chrome_exe.begin(), chrome_exe.end(),
registry_chrome_exe.begin(),
- CaseInsensitiveCompare<wchar_t>())))
+ base::CaseInsensitiveCompare<wchar_t>()))) {
return false;
+ }
std::vector<std::wstring> v1, v2;
base::SplitString(registry_chrome_exe, L'\\', &v1);
@@ -383,7 +384,7 @@ bool AnotherUserHasDefaultBrowser(const std::wstring& chrome_exe) {
std::wstring s2 = *itr2;
if ((s1.size() != s2.size()) ||
(!std::equal(s1.begin(), s1.end(),
- s2.begin(), CaseInsensitiveCompare<wchar_t>()))) {
+ s2.begin(), base::CaseInsensitiveCompare<wchar_t>()))) {
if (one_mismatch)
return false;
else
diff --git a/chrome_frame/test_utils.cc b/chrome_frame/test_utils.cc
index fb46998..a059b35 100644
--- a/chrome_frame/test_utils.cc
+++ b/chrome_frame/test_utils.cc
@@ -278,7 +278,7 @@ class ArgumentFilter : public base::ProcessFilter {
command_line.end(),
argument_to_find_.begin(),
argument_to_find_.end(),
- CaseInsensitiveCompareASCII<wchar_t>());
+ base::CaseInsensitiveCompareASCII<wchar_t>());
found = (it != command_line.end());
}
return found;
diff --git a/net/base/net_util.cc b/net/base/net_util.cc
index 8f6b2af..550a939 100644
--- a/net/base/net_util.cc
+++ b/net/base/net_util.cc
@@ -176,7 +176,7 @@ STR GetSpecificHeaderT(const STR& headers, const STR& name) {
typename STR::const_iterator begin =
search(headers.begin(), headers.end(), match.begin(), match.end(),
- CaseInsensitiveCompareASCII<typename STR::value_type>());
+ base::CaseInsensitiveCompareASCII<typename STR::value_type>());
if (begin == headers.end())
return STR();
@@ -424,7 +424,7 @@ STR GetHeaderParamValueT(const STR& header, const STR& param_name) {
// This assumes args are formatted exactly like "bla; arg1=value; arg2=value".
typename STR::const_iterator param_begin =
search(header.begin(), header.end(), param_name.begin(), param_name.end(),
- CaseInsensitiveCompareASCII<typename STR::value_type>());
+ base::CaseInsensitiveCompareASCII<typename STR::value_type>());
if (param_begin == header.end())
return STR();
diff --git a/net/http/http_response_headers.cc b/net/http/http_response_headers.cc
index 7376fa0..c2d098c 100644
--- a/net/http/http_response_headers.cc
+++ b/net/http/http_response_headers.cc
@@ -484,7 +484,7 @@ bool HttpResponseHeaders::HasHeaderValue(const std::string& name,
while (EnumerateHeader(&iter, name, &temp)) {
if (value.size() == temp.size() &&
std::equal(temp.begin(), temp.end(), value.begin(),
- CaseInsensitiveCompare<char>()))
+ base::CaseInsensitiveCompare<char>()))
return true;
}
return false;
@@ -629,7 +629,7 @@ size_t HttpResponseHeaders::FindHeader(size_t from,
const std::string::const_iterator& name_end = parsed_[i].name_end;
if (static_cast<size_t>(name_end - name_begin) == search.size() &&
std::equal(name_begin, name_end, search.begin(),
- CaseInsensitiveCompare<char>()))
+ base::CaseInsensitiveCompare<char>()))
return i;
}
diff --git a/net/http/http_util.cc b/net/http/http_util.cc
index 641c43c..a3d1ec5 100644
--- a/net/http/http_util.cc
+++ b/net/http/http_util.cc
@@ -292,7 +292,7 @@ bool HttpUtil::HasHeader(const std::string& headers, const char* name) {
headers.end(),
name,
name + name_len,
- CaseInsensitiveCompareASCII<char>());
+ base::CaseInsensitiveCompareASCII<char>());
if (it == headers.end())
return false;
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc
index f3828dc..d0f488d 100644
--- a/net/url_request/url_request_unittest.cc
+++ b/net/url_request/url_request_unittest.cc
@@ -69,7 +69,7 @@ bool ContainsString(const std::string& haystack, const char* needle) {
haystack.end(),
needle,
needle + strlen(needle),
- CaseInsensitiveCompare<char>());
+ base::CaseInsensitiveCompare<char>());
return it != haystack.end();
}