diff options
author | brucedawson <brucedawson@chromium.org> | 2016-01-06 13:46:59 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-06 21:48:14 +0000 |
commit | 3a6295635296b84b2ed83ceba6532ece3e23ca2c (patch) | |
tree | 5c3c8eae1f44cb1c0ba00eda39add35dcb40ed87 /sandbox | |
parent | 2837393c63b187eebc6207e39543d6842e5a6d47 (diff) | |
download | chromium_src-3a6295635296b84b2ed83ceba6532ece3e23ca2c.zip chromium_src-3a6295635296b84b2ed83ceba6532ece3e23ca2c.tar.gz chromium_src-3a6295635296b84b2ed83ceba6532ece3e23ca2c.tar.bz2 |
Fix 64-bit truncation found by VS 2015
VS 2015 64-bit builds warned that lpc_policy_test.cc is casting two
pointers to int, thus truncating the pointers. The problems are:
1) C style casts should not be used
2) Pointers should be cast to intptr_t instead of int
3) The cast is not actually needed
4) nullptr should be used instead of NULL
Removing the cast and changing NULL to nullptr fixes all.
Warnings were:
lpc_policy_test.cc(140): warning C4311: pointer truncation from 'HMODULE' to 'int'
lpc_policy_test.cc(140): warning C4302: truncation from 'HMODULE' to 'int'
lpc_policy_test.cc(144): warning C4311: pointer truncation from 'sandbox::GetUserDefaultLocaleNameFunction' to 'int'
lpc_policy_test.cc(144): warning C4302: truncation from 'sandbox::GetUserDefaultLocaleNameFunction' to 'int'
BUG=440500
Review URL: https://codereview.chromium.org/1565483002
Cr-Commit-Position: refs/heads/master@{#367925}
Diffstat (limited to 'sandbox')
-rw-r--r-- | sandbox/win/src/lpc_policy_test.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sandbox/win/src/lpc_policy_test.cc b/sandbox/win/src/lpc_policy_test.cc index ac7b39f..22db795 100644 --- a/sandbox/win/src/lpc_policy_test.cc +++ b/sandbox/win/src/lpc_policy_test.cc @@ -137,11 +137,11 @@ TEST(LpcPolicyTest, GetUserDefaultLocaleName) { // GetUserDefaultLocaleName is not available on WIN XP. So we'll // load it on-the-fly. HMODULE kernel32_dll = ::GetModuleHandle(kKernel32DllName); - EXPECT_NE(NULL, int(kernel32_dll)); + EXPECT_NE(nullptr, kernel32_dll); GetUserDefaultLocaleName_func = reinterpret_cast<GetUserDefaultLocaleNameFunction>( GetProcAddress(kernel32_dll, "GetUserDefaultLocaleName")); - EXPECT_NE(NULL, int(GetUserDefaultLocaleName_func)); + EXPECT_NE(nullptr, GetUserDefaultLocaleName_func); } wchar_t locale_name[LOCALE_NAME_MAX_LENGTH] = {0}; EXPECT_NE(0, GetUserDefaultLocaleName_func( |