summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-20 20:12:12 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-20 20:14:00 +0000
commitff5f0891b52216b18bd7cd5dd692c420ee95a6cb (patch)
treef49b0d832ab6bf7e928cb05e3641a74aa842a524
parent650a7816318f2f16bda96a699a688baa6e060670 (diff)
downloadchromium_src-ff5f0891b52216b18bd7cd5dd692c420ee95a6cb.zip
chromium_src-ff5f0891b52216b18bd7cd5dd692c420ee95a6cb.tar.gz
chromium_src-ff5f0891b52216b18bd7cd5dd692c420ee95a6cb.tar.bz2
win: Fix a 64bit warning.
clang warns: ..\..\base\files\file_path.cc(695,47) : warning(clang): cast to 'wchar_t *' from smaller integer type 'LONG' (aka 'long') [-Wint-to-pointer-cast] wchar_t c1 = (wchar_t)LOWORD(::CharUpperW((LPWSTR)MAKELONG(*i1, 0))); ^ CharUpper() is a pretty whacko: It takes a pointer, but: """ A null-terminated string, or a single character. If the high-order word of this parameter is zero, the low-order word must contain a single character to be converted.""" (!) It's not clear to me what this means on 64bit, but the code as-is casted a 32bit int (a DWORD) to a pointer, which I think doesn't guarantee that the upper 4 byte of the 8 byte pointer are zero. So insert a cast to a pointer-wide int type to guarantee this, and to fix this warning. BUG=82385 R=brettw@chromium.org Review URL: https://codereview.chromium.org/491883003 Cr-Commit-Position: refs/heads/master@{#290905} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@290905 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/files/file_path.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/base/files/file_path.cc b/base/files/file_path.cc
index a8b2713..ebc2d6d 100644
--- a/base/files/file_path.cc
+++ b/base/files/file_path.cc
@@ -692,8 +692,10 @@ int FilePath::CompareIgnoreCase(const StringType& string1,
StringType::const_iterator string1end = string1.end();
StringType::const_iterator string2end = string2.end();
for ( ; i1 != string1end && i2 != string2end; ++i1, ++i2) {
- wchar_t c1 = (wchar_t)LOWORD(::CharUpperW((LPWSTR)MAKELONG(*i1, 0)));
- wchar_t c2 = (wchar_t)LOWORD(::CharUpperW((LPWSTR)MAKELONG(*i2, 0)));
+ wchar_t c1 =
+ (wchar_t)LOWORD(::CharUpperW((LPWSTR)(DWORD_PTR)MAKELONG(*i1, 0)));
+ wchar_t c2 =
+ (wchar_t)LOWORD(::CharUpperW((LPWSTR)(DWORD_PTR)MAKELONG(*i2, 0)));
if (c1 < c2)
return -1;
if (c1 > c2)