From 96660d6f382204339d6b1aadc3913303d436e252 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 14 Dec 2015 18:27:25 -0800 Subject: Merge to XFA: Get rid of most instance of 'foo != NULL' TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1512763013 . (cherry picked from commit e3c7c2b54348da4a6939f6672f6c6bff126815a7) Review URL: https://codereview.chromium.org/1529553003 . --- core/src/fxge/dib/fx_dib_main.cpp | 3 +-- core/src/fxge/ge/fx_ge_device.cpp | 1 - core/src/fxge/ge/fx_ge_ps.cpp | 4 ++-- core/src/fxge/ge/fx_ge_text.cpp | 2 +- core/src/fxge/win32/fx_win32_device.cpp | 2 +- core/src/fxge/win32/fx_win32_dwrite.cpp | 4 ++-- core/src/fxge/win32/fx_win32_gdipext.cpp | 10 +++++----- core/src/fxge/win32/fx_win32_print.cpp | 2 +- 8 files changed, 13 insertions(+), 15 deletions(-) (limited to 'core/src/fxge') diff --git a/core/src/fxge/dib/fx_dib_main.cpp b/core/src/fxge/dib/fx_dib_main.cpp index 6d37db9680..44d6c5022c 100644 --- a/core/src/fxge/dib/fx_dib_main.cpp +++ b/core/src/fxge/dib/fx_dib_main.cpp @@ -844,7 +844,6 @@ FX_BOOL CFX_DIBitmap::MultiplyAlpha(const CFX_DIBSource* pSrcBitmap) { if (pSrcBitmap->GetWidth() != m_Width || pSrcBitmap->GetHeight() != m_Height) { pSrcClone = pSrcBitmap->StretchTo(m_Width, m_Height); - ASSERT(pSrcClone != NULL); if (pSrcClone == NULL) { return FALSE; } @@ -1340,7 +1339,7 @@ FX_BOOL CFX_DIBitmap::DitherFS(const FX_DWORD* pPalette, if (m_pBuffer == NULL) { return FALSE; } - if (m_bpp != 8 && m_pPalette != NULL && m_AlphaFlag != 0) { + if (m_bpp != 8 && m_pPalette && m_AlphaFlag != 0) { return FALSE; } if (m_Width < 4 && m_Height < 4) { diff --git a/core/src/fxge/ge/fx_ge_device.cpp b/core/src/fxge/ge/fx_ge_device.cpp index 94efd864c0..37204268f2 100644 --- a/core/src/fxge/ge/fx_ge_device.cpp +++ b/core/src/fxge/ge/fx_ge_device.cpp @@ -19,7 +19,6 @@ void CFX_RenderDevice::SetDeviceDriver(IFX_RenderDeviceDriver* pDriver) { InitDeviceInfo(); } void CFX_RenderDevice::InitDeviceInfo() { - ASSERT(m_pDeviceDriver != NULL); m_Width = m_pDeviceDriver->GetDeviceCaps(FXDC_PIXEL_WIDTH); m_Height = m_pDeviceDriver->GetDeviceCaps(FXDC_PIXEL_HEIGHT); m_bpp = m_pDeviceDriver->GetDeviceCaps(FXDC_BITS_PIXEL); diff --git a/core/src/fxge/ge/fx_ge_ps.cpp b/core/src/fxge/ge/fx_ge_ps.cpp index 6ce8f4635b..ceb2acf2bc 100644 --- a/core/src/fxge/ge/fx_ge_ps.cpp +++ b/core/src/fxge/ge/fx_ge_ps.cpp @@ -417,7 +417,7 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, pConverted = pSource->CloneConvert(FXDIB_Rgb); break; case FXDIB_8bppRgb: - if (pSource->GetPalette() != NULL) { + if (pSource->GetPalette()) { pConverted = pSource->CloneConvert(FXDIB_Rgb); } break; @@ -425,7 +425,7 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, pConverted = pSource->CloneConvert(FXDIB_Cmyk); break; case FXDIB_8bppCmyk: - if (pSource->GetPalette() != NULL) { + if (pSource->GetPalette()) { pConverted = pSource->CloneConvert(FXDIB_Cmyk); } break; diff --git a/core/src/fxge/ge/fx_ge_text.cpp b/core/src/fxge/ge/fx_ge_text.cpp index d330576433..cd6b690a12 100644 --- a/core/src/fxge/ge/fx_ge_text.cpp +++ b/core/src/fxge/ge/fx_ge_text.cpp @@ -229,7 +229,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, if (FXSYS_fabs(char2device.a) + FXSYS_fabs(char2device.b) > 50 * 1.0f || ((m_DeviceClass == FXDC_PRINTER && !m_pDeviceDriver->IsPSPrintDriver()) && !(text_flags & FXTEXT_PRINTIMAGETEXT))) { - if (pFont->GetFace() != NULL || + if (pFont->GetFace() || (pFont->GetSubstFont()->m_SubstFlags & FXFONT_SUBST_GLYPHPATH)) { int nPathFlags = (text_flags & FXTEXT_NOSMOOTH) == 0 ? 0 : FXFILL_NOPATHSMOOTH; diff --git a/core/src/fxge/win32/fx_win32_device.cpp b/core/src/fxge/win32/fx_win32_device.cpp index 4ca4316c2e..6d520468a3 100644 --- a/core/src/fxge/win32/fx_win32_device.cpp +++ b/core/src/fxge/win32/fx_win32_device.cpp @@ -1186,7 +1186,7 @@ FX_BOOL CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource, int alpha_flag, void* pIccTransform, int blend_type) { - ASSERT(pSource != NULL && pClipRect != NULL); + ASSERT(pSource && pClipRect); if (flags || dest_width > 10000 || dest_width < -10000 || dest_height > 10000 || dest_height < -10000) { return UseFoxitStretchEngine(pSource, color, dest_left, dest_top, diff --git a/core/src/fxge/win32/fx_win32_dwrite.cpp b/core/src/fxge/win32/fx_win32_dwrite.cpp index ab50f3cf38..83924f23e7 100644 --- a/core/src/fxge/win32/fx_win32_dwrite.cpp +++ b/core/src/fxge/win32/fx_win32_dwrite.cpp @@ -18,14 +18,14 @@ typedef HRESULT(__stdcall* FuncType_DWriteCreateFactory)( __out IUnknown**); template inline void SafeRelease(InterfaceType** currentObject) { - if (*currentObject != NULL) { + if (*currentObject) { (*currentObject)->Release(); *currentObject = NULL; } } template inline InterfaceType* SafeAcquire(InterfaceType* newObject) { - if (newObject != NULL) { + if (newObject) { newObject->AddRef(); } return newObject; diff --git a/core/src/fxge/win32/fx_win32_gdipext.cpp b/core/src/fxge/win32/fx_win32_gdipext.cpp index 2886ee81d0..e79a88cb81 100644 --- a/core/src/fxge/win32/fx_win32_gdipext.cpp +++ b/core/src/fxge/win32/fx_win32_gdipext.cpp @@ -1295,7 +1295,7 @@ class GpStream final : public IStream { ULONG* pcbRead) { size_t bytes_left; size_t bytes_out; - if (pcbRead != NULL) { + if (pcbRead) { *pcbRead = 0; } if (m_ReadPos == m_InterStream.GetLength()) { @@ -1305,7 +1305,7 @@ class GpStream final : public IStream { bytes_out = FX_MIN(cb, bytes_left); FXSYS_memcpy(Output, m_InterStream.GetBuffer() + m_ReadPos, bytes_out); m_ReadPos += (int32_t)bytes_out; - if (pcbRead != NULL) { + if (pcbRead) { *pcbRead = (ULONG)bytes_out; } return S_OK; @@ -1314,13 +1314,13 @@ class GpStream final : public IStream { ULONG cb, ULONG* pcbWritten) { if (cb <= 0) { - if (pcbWritten != NULL) { + if (pcbWritten) { *pcbWritten = 0; } return S_OK; } m_InterStream.InsertBlock(m_InterStream.GetLength(), Input, cb); - if (pcbWritten != NULL) { + if (pcbWritten) { *pcbWritten = cb; } return S_OK; @@ -1374,7 +1374,7 @@ class GpStream final : public IStream { return STG_E_SEEKERROR; } m_ReadPos = new_read_position; - if (lpNewFilePointer != NULL) { + if (lpNewFilePointer) { lpNewFilePointer->QuadPart = m_ReadPos; } return S_OK; diff --git a/core/src/fxge/win32/fx_win32_print.cpp b/core/src/fxge/win32/fx_win32_print.cpp index c829a438b9..39828b14d8 100644 --- a/core/src/fxge/win32/fx_win32_print.cpp +++ b/core/src/fxge/win32/fx_win32_print.cpp @@ -49,7 +49,7 @@ FX_BOOL CGdiPrinterDriver::SetDIBits(const CFX_DIBSource* pSource, pSource->GetHeight(), &clip_rect, 0, alpha_flag, pIccTransform, FXDIB_BLEND_NORMAL); } - ASSERT(pSource != NULL && !pSource->IsAlphaMask() && pSrcRect != NULL); + ASSERT(pSource && !pSource->IsAlphaMask() && pSrcRect); ASSERT(blend_type == FXDIB_BLEND_NORMAL); if (pSource->HasAlpha()) { return FALSE; -- cgit v1.2.3