diff options
author | Lei Zhang <thestig@chromium.org> | 2015-12-14 18:34:00 -0800 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-12-14 18:34:00 -0800 |
commit | 412e908082a361d0fd9591eab939e96a882212f1 (patch) | |
tree | 11726052ae08f13dc5a05a82cbce870758580aeb /fpdfsdk/src/fpdfview.cpp | |
parent | 96660d6f382204339d6b1aadc3913303d436e252 (diff) | |
download | pdfium-412e908082a361d0fd9591eab939e96a882212f1.tar.xz |
Merge to XFA: Get rid of most instance of 'foo == NULL'
TBR=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1520063002 .
(cherry picked from commit e385244f8cd6ae376f6b3cf1265a0795d5d30eff)
Review URL: https://codereview.chromium.org/1528763003 .
Diffstat (limited to 'fpdfsdk/src/fpdfview.cpp')
-rw-r--r-- | fpdfsdk/src/fpdfview.cpp | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp index 3951d00a92..1ae1baf415 100644 --- a/fpdfsdk/src/fpdfview.cpp +++ b/fpdfsdk/src/fpdfview.cpp @@ -488,7 +488,7 @@ DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document, return pDoc->GetPage(page_index); #else // PDF_ENABLE_XFA CPDF_Dictionary* pDict = pDoc->GetPage(page_index); - if (pDict == NULL) + if (!pDict) return NULL; CPDF_Page* pPage = new CPDF_Page; pPage->Load(pDoc, pDict); @@ -602,7 +602,7 @@ DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, bmih.biWidth = width; pContext->m_hBitmap = CreateDIBSection(dc, (BITMAPINFO*)&bmih, DIB_RGB_COLORS, &pBuffer, NULL, 0); - if (pContext->m_hBitmap == NULL) { + if (!pContext->m_hBitmap) { #if defined(DEBUG) || defined(_DEBUG) char str[128]; memset(str, 0, sizeof(str)); @@ -640,7 +640,7 @@ DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, // Now output to real device HDC hMemDC = CreateCompatibleDC(dc); - if (hMemDC == NULL) { + if (!hMemDC) { #if defined(DEBUG) || defined(_DEBUG) char str[128]; memset(str, 0, sizeof(str)); @@ -763,7 +763,7 @@ DLLEXPORT void STDCALL FPDF_DeviceToPage(FPDF_PAGE page, int device_y, double* page_x, double* page_y) { - if (page == NULL || page_x == NULL || page_y == NULL) + if (!page || !page_x || !page_y) return; UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); #ifdef PDF_ENABLE_XFA @@ -856,7 +856,7 @@ DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap, int width, int height, FPDF_DWORD color) { - if (bitmap == NULL) + if (!bitmap) return; #ifdef _SKIA_SUPPORT_ CFX_SkiaDevice device; @@ -871,27 +871,19 @@ DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap, } DLLEXPORT void* STDCALL FPDFBitmap_GetBuffer(FPDF_BITMAP bitmap) { - if (bitmap == NULL) - return NULL; - return ((CFX_DIBitmap*)bitmap)->GetBuffer(); + return bitmap ? ((CFX_DIBitmap*)bitmap)->GetBuffer() : nullptr; } DLLEXPORT int STDCALL FPDFBitmap_GetWidth(FPDF_BITMAP bitmap) { - if (bitmap == NULL) - return 0; - return ((CFX_DIBitmap*)bitmap)->GetWidth(); + return bitmap ? ((CFX_DIBitmap*)bitmap)->GetWidth() : 0; } DLLEXPORT int STDCALL FPDFBitmap_GetHeight(FPDF_BITMAP bitmap) { - if (bitmap == NULL) - return 0; - return ((CFX_DIBitmap*)bitmap)->GetHeight(); + return bitmap ? ((CFX_DIBitmap*)bitmap)->GetHeight() : 0; } DLLEXPORT int STDCALL FPDFBitmap_GetStride(FPDF_BITMAP bitmap) { - if (bitmap == NULL) - return 0; - return ((CFX_DIBitmap*)bitmap)->GetPitch(); + return bitmap ? ((CFX_DIBitmap*)bitmap)->GetPitch() : 0; } DLLEXPORT void STDCALL FPDFBitmap_Destroy(FPDF_BITMAP bitmap) { |