Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Unified Diff: fpdfsdk/src/fpdfview.cpp

Issue 1520063002: Get rid of most instance of 'foo == NULL' (Closed) Base URL: https://pdfium.googlesource.com/pdfium@bstr_isnull
Patch Set: rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/src/fpdftext.cpp ('k') | fpdfsdk/src/fsdk_baseannot.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/fpdfview.cpp
diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp
index 2f360ece356b98c7e3c6616799a77a2984354b51..c719cea9ecc8580b53487fed9797772327c9c586 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) {
« no previous file with comments | « fpdfsdk/src/fpdftext.cpp ('k') | fpdfsdk/src/fsdk_baseannot.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698