From e91afbabec3b7c891b464efd221748edaba3c2bc Mon Sep 17 00:00:00 2001 From: Wei Li Date: Tue, 22 Mar 2016 19:19:01 -0700 Subject: Re-enable MSVC warning 4702 BUG=pdfium:29 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1821423002 . --- core/fpdfapi/fpdf_font/fpdf_font_cid.cpp | 3 ++- core/fxcodec/jbig2/JBig2_GsidProc.cpp | 5 ++--- core/fxcrt/fx_basic_memmgr.cpp | 2 ++ core/fxge/dib/fx_dib_convert.cpp | 1 - fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp | 2 -- fpdfsdk/fpdfxfa/fpdfxfa_page.cpp | 2 -- fpdfsdk/javascript/JS_EventHandler.cpp | 4 ---- pdfium.gyp | 2 -- third_party/base/logging.h | 15 +++++++++++---- 9 files changed, 17 insertions(+), 19 deletions(-) diff --git a/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp index 97a3d4dbc1..351df608d2 100644 --- a/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp +++ b/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp @@ -1052,12 +1052,13 @@ FX_WCHAR CPDF_CIDFont::GetUnicodeFromCharCode(FX_DWORD charcode) const { return 0; } return unicode; -#endif +#else if (m_pCMap->m_pEmbedMap) { return EmbeddedUnicodeFromCharcode(m_pCMap->m_pEmbedMap, m_pCMap->m_Charset, charcode); } return 0; +#endif } return m_pCID2UnicodeMap->UnicodeFromCID(CIDFromCharCode(charcode)); } diff --git a/core/fxcodec/jbig2/JBig2_GsidProc.cpp b/core/fxcodec/jbig2/JBig2_GsidProc.cpp index 92532d7238..f1a566a5db 100644 --- a/core/fxcodec/jbig2/JBig2_GsidProc.cpp +++ b/core/fxcodec/jbig2/JBig2_GsidProc.cpp @@ -96,10 +96,9 @@ FX_DWORD* CJBig2_GSIDProc::decode_MMR(CJBig2_BitStream* pStream, pGRD->Continue_decode(pPause); } if (!GSPLANES.get()[J]) { - for (int32_t K = GSBPP - 1; K > J; --K) { + for (int32_t K = GSBPP - 1; K > J; --K) delete GSPLANES.get()[K]; - return nullptr; - } + return nullptr; } pStream->alignByte(); pStream->offset(3); diff --git a/core/fxcrt/fx_basic_memmgr.cpp b/core/fxcrt/fx_basic_memmgr.cpp index a0af6aef6d..1cbd293006 100644 --- a/core/fxcrt/fx_basic_memmgr.cpp +++ b/core/fxcrt/fx_basic_memmgr.cpp @@ -21,5 +21,7 @@ void FXMEM_DefaultFree(void* pointer, int flags) { NEVER_INLINE void FX_OutOfMemoryTerminate() { // Termimate cleanly if we can, else crash at a specific address (0xbd). abort(); +#ifndef _WIN32 reinterpret_cast(0xbd)(); +#endif } diff --git a/core/fxge/dib/fx_dib_convert.cpp b/core/fxge/dib/fx_dib_convert.cpp index 210e6f1e18..9335800f9b 100644 --- a/core/fxge/dib/fx_dib_convert.cpp +++ b/core/fxge/dib/fx_dib_convert.cpp @@ -949,7 +949,6 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format, default: return FALSE; } - return FALSE; } CFX_DIBitmap* CFX_DIBSource::CloneConvert(FXDIB_Format dest_format, const FX_RECT* pClip, diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp index e530797539..cee81daa62 100644 --- a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp +++ b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp @@ -144,8 +144,6 @@ int CPDFXFA_Document::GetPageCount() { default: return 0; } - - return 0; } CPDFXFA_Page* CPDFXFA_Document::GetPage(int page_index) { diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp index 89638c0e82..8c977635e7 100644 --- a/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp +++ b/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp @@ -102,8 +102,6 @@ FX_BOOL CPDFXFA_Page::LoadPage() { default: return FALSE; } - - return FALSE; } FX_BOOL CPDFXFA_Page::LoadPDFPage(CPDF_Dictionary* pageDict) { diff --git a/fpdfsdk/javascript/JS_EventHandler.cpp b/fpdfsdk/javascript/JS_EventHandler.cpp index 697cfeb208..0dffa7de54 100644 --- a/fpdfsdk/javascript/JS_EventHandler.cpp +++ b/fpdfsdk/javascript/JS_EventHandler.cpp @@ -514,8 +514,6 @@ const FX_WCHAR* CJS_EventHandler::Name() { default: return L""; } - - return L""; } const FX_WCHAR* CJS_EventHandler::Type() { @@ -571,8 +569,6 @@ const FX_WCHAR* CJS_EventHandler::Type() { default: return L""; } - - return L""; } FX_BOOL& CJS_EventHandler::Rc() { diff --git a/pdfium.gyp b/pdfium.gyp index a5a70a8033..f43f58d985 100644 --- a/pdfium.gyp +++ b/pdfium.gyp @@ -95,8 +95,6 @@ ], 'msvs_disabled_warnings': [ 4005, 4018, 4146, 4333, 4345, 4267, - # TODO(thestig): Fix all instances, remove this, pdfium:29 - 4702, ], 'variables': { 'clang_warning_flags': [ diff --git a/third_party/base/logging.h b/third_party/base/logging.h index 98ed9c5da0..bf4faea57e 100644 --- a/third_party/base/logging.h +++ b/third_party/base/logging.h @@ -8,10 +8,17 @@ #include #include -#define CHECK(condition) \ - if (!(condition)) { \ - abort(); \ - *(reinterpret_cast(NULL) + 42) = 0x42; \ +#ifndef _WIN32 +#define NULL_DEREF_IF_POSSIBLE \ + *(reinterpret_cast(NULL) + 42) = 0x42; +#else +#define NULL_DEREF_IF_POSSIBLE +#endif + +#define CHECK(condition) \ + if (!(condition)) { \ + abort(); \ + NULL_DEREF_IF_POSSIBLE \ } #define NOTREACHED() assert(false) -- cgit v1.2.3