Index: base/files/file_path.cc |
diff --git a/base/files/file_path.cc b/base/files/file_path.cc |
index 2c199e131a56ee1976dded1dd25af158ac1c6252..ca0d1d1bb951c32118c1c981c75c2f62a6eda03f 100644 |
--- a/base/files/file_path.cc |
+++ b/base/files/file_path.cc |
@@ -693,6 +693,10 @@ bool FilePath::ReadFromPickle(PickleIterator* iter) { |
int FilePath::CompareIgnoreCase(StringPieceType string1, |
StringPieceType string2) { |
+ static decltype(::CharUpperW)* const char_upper_api = |
+ reinterpret_cast<decltype(::CharUpperW)*>( |
+ ::GetProcAddress(::GetModuleHandle(L"user32.dll"), "CharUpperW")); |
+ CHECK(char_upper_api); |
// Perform character-wise upper case comparison rather than using the |
// fully Unicode-aware CompareString(). For details see: |
// http://blogs.msdn.com/michkap/archive/2005/10/17/481600.aspx |
@@ -702,9 +706,9 @@ int FilePath::CompareIgnoreCase(StringPieceType string1, |
StringPieceType::const_iterator string2end = string2.end(); |
for ( ; i1 != string1end && i2 != string2end; ++i1, ++i2) { |
wchar_t c1 = |
- (wchar_t)LOWORD(::CharUpperW((LPWSTR)(DWORD_PTR)MAKELONG(*i1, 0))); |
+ (wchar_t)LOWORD(char_upper_api((LPWSTR)(DWORD_PTR)MAKELONG(*i1, 0))); |
wchar_t c2 = |
- (wchar_t)LOWORD(::CharUpperW((LPWSTR)(DWORD_PTR)MAKELONG(*i2, 0))); |
+ (wchar_t)LOWORD(char_upper_api((LPWSTR)(DWORD_PTR)MAKELONG(*i2, 0))); |
if (c1 < c2) |
return -1; |
if (c1 > c2) |