diff options
author | scottmg <scottmg@chromium.org> | 2015-04-28 17:36:18 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-29 00:37:00 +0000 |
commit | 1f59a1eadbc6a3ab6d03b3c8380a5bc0f83c9eba (patch) | |
tree | 9001e85567d273c3c669f199910835d8ce9950f1 /base | |
parent | 4800fc26e63ee53d9c1532e1519c738a85f34f86 (diff) | |
download | chromium_src-1f59a1eadbc6a3ab6d03b3c8380a5bc0f83c9eba.zip chromium_src-1f59a1eadbc6a3ab6d03b3c8380a5bc0f83c9eba.tar.gz chromium_src-1f59a1eadbc6a3ab6d03b3c8380a5bc0f83c9eba.tar.bz2 |
vs2015: fix pvoid->dword truncation warning
FAILED: ninja -t msvc -e environment.x64 -- "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\cl.exe" /nologo /showIncludes /FC @obj\base\win\base_static_win64.pe_image.obj.rsp /c ..\..\base\win\pe_image.cc /Foobj\base\win\base_static_win64.pe_image.obj /Fdobj\base\base_static_win64.cc.pdb
d:\src\cr2\src\base\win\pe_image.cc(571): error C2220: warning treated as error - no 'object' file generated
d:\src\cr2\src\base\win\pe_image.cc(571): warning C4311: 'reinterpret_cast': pointer truncation from 'LPVOID' to 'DWORD'
d:\src\cr2\src\base\win\pe_image.cc(571): warning C4302: 'reinterpret_cast': truncation from 'LPVOID' to 'DWORD'
d:\src\cr2\src\base\win\pe_image.cc(573): warning C4311: 'reinterpret_cast': pointer truncation from 'PVOID' to 'DWORD'
d:\src\cr2\src\base\win\pe_image.cc(573): warning C4302: 'reinterpret_cast': truncation from 'PVOID' to 'DWORD'
R=cpu@chromium.org
BUG=440500
Review URL: https://codereview.chromium.org/1117433003
Cr-Commit-Position: refs/heads/master@{#327404}
Diffstat (limited to 'base')
-rw-r--r-- | base/win/pe_image.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/base/win/pe_image.cc b/base/win/pe_image.cc index 19b381d..692b7b6 100644 --- a/base/win/pe_image.cc +++ b/base/win/pe_image.cc @@ -568,12 +568,11 @@ bool PEImage::ImageAddrToOnDiskOffset(LPVOID address, if (NULL == section_header) return false; -#pragma warning(suppress : 4302) // pointer truncation - // These casts generate warnings because they are 32 bit specific. // Don't follow the virtual RVAToAddr, use the one on the base. - DWORD offset_within_section = reinterpret_cast<DWORD>(address) - - reinterpret_cast<DWORD>(PEImage::RVAToAddr( - section_header->VirtualAddress)); + DWORD offset_within_section = + static_cast<DWORD>(reinterpret_cast<uintptr_t>(address)) - + static_cast<DWORD>(reinterpret_cast<uintptr_t>( + PEImage::RVAToAddr(section_header->VirtualAddress))); *on_disk_offset = section_header->PointerToRawData + offset_within_section; return true; |