From 97da97662417085774f75c26e535c6fbe70266ae Mon Sep 17 00:00:00 2001 From: Wei Li Date: Fri, 11 Mar 2016 17:00:48 -0800 Subject: Re-enable MSVC warning 4800 for compiling with chromium_code Mainly change the code to avoid the warnings; in a few cases we have to use explicit casts. BUG=pdfium:29 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1783023002 . --- core/include/fxcrt/fx_ext.h | 12 ++++-------- core/include/fxcrt/fx_string.h | 2 +- core/include/fxcrt/fx_system.h | 10 ++++++---- 3 files changed, 11 insertions(+), 13 deletions(-) (limited to 'core/include/fxcrt') diff --git a/core/include/fxcrt/fx_ext.h b/core/include/fxcrt/fx_ext.h index 689d8e8fc4..dda6a5c72b 100644 --- a/core/include/fxcrt/fx_ext.h +++ b/core/include/fxcrt/fx_ext.h @@ -60,23 +60,19 @@ inline int FXSYS_toHexDigit(const FX_CHAR c) { } inline bool FXSYS_isDecimalDigit(const FX_CHAR c) { - return std::isdigit(c); + return !!std::isdigit(c); } inline bool FXSYS_isDecimalDigit(const FX_WCHAR c) { - return std::iswdigit(c); + return !!std::iswdigit(c); } inline int FXSYS_toDecimalDigit(const FX_CHAR c) { - if (!std::isdigit(c)) - return 0; - return c - '0'; + return std::isdigit(c) ? c - '0' : 0; } inline int FXSYS_toDecimalDigit(const FX_WCHAR c) { - if (!std::iswdigit(c)) - return 0; - return c - L'0'; + return std::iswdigit(c) ? c - L'0' : 0; } FX_DWORD FX_HashCode_String_GetA(const FX_CHAR* pStr, diff --git a/core/include/fxcrt/fx_string.h b/core/include/fxcrt/fx_string.h index ca29e1321a..d68fc2cb36 100644 --- a/core/include/fxcrt/fx_string.h +++ b/core/include/fxcrt/fx_string.h @@ -577,7 +577,7 @@ class CFX_WideString { void Empty(); - FX_BOOL IsEmpty() const { return !GetLength(); } + bool IsEmpty() const { return !GetLength(); } FX_STRSIZE GetLength() const { return m_pData ? m_pData->m_nDataLength : 0; } diff --git a/core/include/fxcrt/fx_system.h b/core/include/fxcrt/fx_system.h index 76c413e7e3..f62e126fbb 100644 --- a/core/include/fxcrt/fx_system.h +++ b/core/include/fxcrt/fx_system.h @@ -258,10 +258,12 @@ wchar_t* FXSYS_wcsupr(wchar_t* str); #define FXDWORD_FROM_MSBFIRST(i) \ (((uint8_t)(i) << 24) | ((uint8_t)((i) >> 8) << 16) | \ ((uint8_t)((i) >> 16) << 8) | (uint8_t)((i) >> 24)) -#define FXDWORD_GET_LSBFIRST(p) \ - ((p[3] << 24) | (p[2] << 16) | (p[1] << 8) | (p[0])) -#define FXDWORD_GET_MSBFIRST(p) \ - ((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | (p[3])) +#define FXDWORD_GET_LSBFIRST(p) \ + ((static_cast(p[3]) << 24) | (static_cast(p[2]) << 16) | \ + (static_cast(p[1]) << 8) | (static_cast(p[0]))) +#define FXDWORD_GET_MSBFIRST(p) \ + ((static_cast(p[0]) << 24) | (static_cast(p[1]) << 16) | \ + (static_cast(p[2]) << 8) | (static_cast(p[3]))) #define FXSYS_HIBYTE(word) ((uint8_t)((word) >> 8)) #define FXSYS_LOBYTE(word) ((uint8_t)(word)) #define FXSYS_HIWORD(dword) ((FX_WORD)((dword) >> 16)) -- cgit v1.2.3