summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fpdfview.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-12-14 18:29:28 -0800
committerLei Zhang <thestig@chromium.org>2015-12-14 18:29:28 -0800
commite385244f8cd6ae376f6b3cf1265a0795d5d30eff (patch)
tree4bdd7c459f167ee56ae35f3b87222c2557f501f8 /fpdfsdk/src/fpdfview.cpp
parente3c7c2b54348da4a6939f6672f6c6bff126815a7 (diff)
downloadpdfium-e385244f8cd6ae376f6b3cf1265a0795d5d30eff.tar.xz
Get rid of most instance of 'foo == NULL'
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1520063002 .
Diffstat (limited to 'fpdfsdk/src/fpdfview.cpp')
-rw-r--r--fpdfsdk/src/fpdfview.cpp26
1 files changed, 9 insertions, 17 deletions
diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp
index 2f360ece35..c719cea9ec 100644
--- a/fpdfsdk/src/fpdfview.cpp
+++ b/fpdfsdk/src/fpdfview.cpp
@@ -292,7 +292,7 @@ DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document,
return nullptr;
CPDF_Dictionary* pDict = pDoc->GetPage(page_index);
- if (pDict == NULL)
+ if (!pDict)
return NULL;
CPDF_Page* pPage = new CPDF_Page;
pPage->Load(pDoc, pDict);
@@ -405,7 +405,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));
@@ -443,7 +443,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));
@@ -558,7 +558,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);
@@ -646,7 +646,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;
@@ -661,27 +661,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) {