Commit 85fd8b54 authored by scottmg's avatar scottmg Committed by Commit bot

Fix truncation warning in PEImage on VS2015

d:\src\cr3\src\base\win\pe_image.h(250): error C2220: warning treated as error - no 'object' file generated
d:\src\cr3\src\base\win\pe_image.h(250): warning C4302: 'reinterpret_cast': truncation from 'LPCSTR' to 'WORD'

Separate ptr->int from truncation to WORD.

Also, while we're here, fix a cast in IsOrdinal.

R=cpu@chromium.org
BUG=440500

Review URL: https://codereview.chromium.org/883873002

Cr-Commit-Position: refs/heads/master@{#313543}
parent f7a80a7a
...@@ -239,15 +239,11 @@ class PEImageAsData : public PEImage { ...@@ -239,15 +239,11 @@ class PEImageAsData : public PEImage {
}; };
inline bool PEImage::IsOrdinal(LPCSTR name) { inline bool PEImage::IsOrdinal(LPCSTR name) {
#pragma warning(push) return reinterpret_cast<uintptr_t>(name) <= 0xFFFF;
#pragma warning(disable: 4311)
// This cast generates a warning because it is 32 bit specific.
return reinterpret_cast<DWORD>(name) <= 0xFFFF;
#pragma warning(pop)
} }
inline WORD PEImage::ToOrdinal(LPCSTR name) { inline WORD PEImage::ToOrdinal(LPCSTR name) {
return reinterpret_cast<WORD>(name); return static_cast<WORD>(reinterpret_cast<intptr_t>(name));
} }
inline HMODULE PEImage::module() const { inline HMODULE PEImage::module() const {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment