summaryrefslogtreecommitdiff
path: root/fpdfsdk/src
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/src')
-rw-r--r--fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp12
-rw-r--r--fpdfsdk/src/fpdf_dataavail.cpp2
-rw-r--r--fpdfsdk/src/fpdf_sysfontinfo.cpp4
-rw-r--r--fpdfsdk/src/fpdf_transformpage.cpp4
-rw-r--r--fpdfsdk/src/fpdftext.cpp4
-rw-r--r--fpdfsdk/src/fpdfview.cpp26
-rw-r--r--fpdfsdk/src/fsdk_baseannot.cpp7
-rw-r--r--fpdfsdk/src/fxedit/fxet_edit.cpp4
-rw-r--r--fpdfsdk/src/javascript/Document.cpp10
-rw-r--r--fpdfsdk/src/javascript/JS_Value.cpp2
10 files changed, 32 insertions, 43 deletions
diff --git a/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp b/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp
index 743c90e817..dd58180e61 100644
--- a/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp
+++ b/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp
@@ -122,7 +122,7 @@ CPDF_Font* CBA_FontMap::FindResFontSameCharset(CPDF_Dictionary* pResDict,
ASSERT(pDocument != NULL);
CPDF_Dictionary* pFonts = pResDict->GetDict("Font");
- if (pFonts == NULL)
+ if (!pFonts)
return NULL;
CPDF_Font* pFind = NULL;
@@ -132,7 +132,7 @@ CPDF_Font* CBA_FontMap::FindResFontSameCharset(CPDF_Dictionary* pResDict,
CPDF_Object* pObj = NULL;
CFX_ByteString csKey;
pObj = pFonts->GetNextElement(pos, csKey);
- if (pObj == NULL)
+ if (!pObj)
continue;
CPDF_Dictionary* pElement = ToDictionary(pObj->GetDirect());
@@ -142,10 +142,10 @@ CPDF_Font* CBA_FontMap::FindResFontSameCharset(CPDF_Dictionary* pResDict,
continue;
CPDF_Font* pFont = pDocument->LoadFont(pElement);
- if (pFont == NULL)
+ if (!pFont)
continue;
const CFX_SubstFont* pSubst = pFont->GetSubstFont();
- if (pSubst == NULL)
+ if (!pSubst)
continue;
if (pSubst->m_Charset == nCharset) {
sFontAlias = csKey;
@@ -170,7 +170,7 @@ void CBA_FontMap::AddFontToAnnotDict(CPDF_Font* pFont,
CPDF_Dictionary* pAPDict = m_pAnnotDict->GetDict("AP");
- if (pAPDict == NULL) {
+ if (!pAPDict) {
pAPDict = new CPDF_Dictionary;
m_pAnnotDict->SetAt("AP", pAPDict);
}
@@ -181,7 +181,7 @@ void CBA_FontMap::AddFontToAnnotDict(CPDF_Font* pFont,
return;
CPDF_Stream* pStream = pAPDict->GetStream(m_sAPType);
- if (pStream == NULL) {
+ if (!pStream) {
pStream = new CPDF_Stream(NULL, 0, NULL);
int32_t objnum = m_pDocument->AddIndirectObject(pStream);
pAPDict->SetAtReference(m_sAPType, m_pDocument, objnum);
diff --git a/fpdfsdk/src/fpdf_dataavail.cpp b/fpdfsdk/src/fpdf_dataavail.cpp
index 9fe2fa82b1..f4e235ccf5 100644
--- a/fpdfsdk/src/fpdf_dataavail.cpp
+++ b/fpdfsdk/src/fpdf_dataavail.cpp
@@ -122,7 +122,7 @@ FPDFAvail_IsDocAvail(FPDF_AVAIL avail, FX_DOWNLOADHINTS* hints) {
DLLEXPORT FPDF_DOCUMENT STDCALL
FPDFAvail_GetDocument(FPDF_AVAIL avail, FPDF_BYTESTRING password) {
- if (avail == NULL)
+ if (!avail)
return NULL;
CPDF_Parser* pParser = new CPDF_Parser;
pParser->SetPassword(password);
diff --git a/fpdfsdk/src/fpdf_sysfontinfo.cpp b/fpdfsdk/src/fpdf_sysfontinfo.cpp
index 71fa94472c..655c4a22bb 100644
--- a/fpdfsdk/src/fpdf_sysfontinfo.cpp
+++ b/fpdfsdk/src/fpdf_sysfontinfo.cpp
@@ -55,7 +55,7 @@ class CFX_ExternalFontInfo final : public IFX_SystemFontInfo {
}
FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) override {
- if (m_pInfo->GetFaceName == NULL)
+ if (!m_pInfo->GetFaceName)
return FALSE;
FX_DWORD size = m_pInfo->GetFaceName(m_pInfo, hFont, NULL, 0);
if (size == 0)
@@ -170,7 +170,7 @@ static void DefaultDeleteFont(struct _FPDF_SYSFONTINFO* pThis, void* hFont) {
DLLEXPORT FPDF_SYSFONTINFO* STDCALL FPDF_GetDefaultSystemFontInfo() {
IFX_SystemFontInfo* pFontInfo = IFX_SystemFontInfo::CreateDefault(nullptr);
- if (pFontInfo == NULL)
+ if (!pFontInfo)
return NULL;
FPDF_SYSFONTINFO_DEFAULT* pFontInfoExt =
diff --git a/fpdfsdk/src/fpdf_transformpage.cpp b/fpdfsdk/src/fpdf_transformpage.cpp
index b465b8387c..3f6ab972c8 100644
--- a/fpdfsdk/src/fpdf_transformpage.cpp
+++ b/fpdfsdk/src/fpdf_transformpage.cpp
@@ -195,7 +195,7 @@ FPDFPageObj_TransformClipPath(FPDF_PAGEOBJECT page_object,
double e,
double f) {
CPDF_PageObject* pPageObj = (CPDF_PageObject*)page_object;
- if (pPageObj == NULL)
+ if (!pPageObj)
return;
CFX_Matrix matrix((FX_FLOAT)a, (FX_FLOAT)b, (FX_FLOAT)c, (FX_FLOAT)d,
(FX_FLOAT)e, (FX_FLOAT)f);
@@ -226,7 +226,7 @@ DLLEXPORT void STDCALL FPDF_DestroyClipPath(FPDF_CLIPPATH clipPath) {
void OutputPath(CFX_ByteTextBuf& buf, CPDF_Path path) {
const CFX_PathData* pPathData = path;
- if (pPathData == NULL)
+ if (!pPathData)
return;
FX_PATHPOINT* pPoints = pPathData->GetPoints();
diff --git a/fpdfsdk/src/fpdftext.cpp b/fpdfsdk/src/fpdftext.cpp
index e91da7e210..9c5cdef057 100644
--- a/fpdfsdk/src/fpdftext.cpp
+++ b/fpdfsdk/src/fpdftext.cpp
@@ -166,7 +166,7 @@ DLLEXPORT int STDCALL FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page,
(FX_FLOAT)top);
CFX_WideString str = textpage->GetTextByRect(rect);
- if (buflen <= 0 || buffer == NULL) {
+ if (buflen <= 0 || !buffer) {
return str.GetLength();
}
@@ -253,7 +253,7 @@ DLLEXPORT int STDCALL FPDFLink_GetURL(FPDF_PAGELINK link_page,
CFX_ByteString cbUTF16URL = url.UTF16LE_Encode();
int len = cbUTF16URL.GetLength() / sizeof(unsigned short);
- if (buffer == NULL || buflen <= 0)
+ if (!buffer || buflen <= 0)
return len;
int size = len < buflen ? len : buflen;
if (size > 0) {
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) {
diff --git a/fpdfsdk/src/fsdk_baseannot.cpp b/fpdfsdk/src/fsdk_baseannot.cpp
index 0f2aaf42cd..629f35a1d2 100644
--- a/fpdfsdk/src/fsdk_baseannot.cpp
+++ b/fpdfsdk/src/fsdk_baseannot.cpp
@@ -570,7 +570,7 @@ FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid() {
FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode) {
CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDict("AP");
- if (pAP == NULL)
+ if (!pAP)
return FALSE;
// Choose the right sub-ap
@@ -584,10 +584,7 @@ FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode) {
// Get the AP stream or subdirectory
CPDF_Object* psub = pAP->GetElementValue(ap_entry);
- if (psub == NULL)
- return FALSE;
-
- return TRUE;
+ return !!psub;
}
void CPDFSDK_BAAnnot::DrawBorder(CFX_RenderDevice* pDevice,
diff --git a/fpdfsdk/src/fxedit/fxet_edit.cpp b/fpdfsdk/src/fxedit/fxet_edit.cpp
index 573a5723bd..b048787cc8 100644
--- a/fpdfsdk/src/fxedit/fxet_edit.cpp
+++ b/fpdfsdk/src/fxedit/fxet_edit.cpp
@@ -814,7 +814,7 @@ CFX_Edit::~CFX_Edit() {
m_pVTProvide = NULL;
delete m_pIterator;
m_pIterator = NULL;
- ASSERT(m_pGroupUndoItem == NULL);
+ ASSERT(!m_pGroupUndoItem);
}
// public methods
@@ -3089,7 +3089,7 @@ int32_t CFX_Edit::GetCharSetFromUnicode(FX_WORD word, int32_t nOldCharset) {
}
void CFX_Edit::BeginGroupUndo(const CFX_WideString& sTitle) {
- ASSERT(m_pGroupUndoItem == NULL);
+ ASSERT(!m_pGroupUndoItem);
m_pGroupUndoItem = new CFX_Edit_GroupUndoItem(sTitle);
}
diff --git a/fpdfsdk/src/javascript/Document.cpp b/fpdfsdk/src/javascript/Document.cpp
index b0ca69b5ba..f4a1090c3d 100644
--- a/fpdfsdk/src/javascript/Document.cpp
+++ b/fpdfsdk/src/javascript/Document.cpp
@@ -1259,14 +1259,14 @@ void IconTree::InsertIconElement(IconElement* pNewIcon) {
if (!pNewIcon)
return;
- if (m_pHead == NULL && m_pEnd == NULL) {
- m_pHead = m_pEnd = pNewIcon;
- m_iLength++;
- } else {
+ if (m_pHead || m_pEnd) {
m_pEnd->NextIcon = pNewIcon;
m_pEnd = pNewIcon;
- m_iLength++;
+ } else {
+ m_pHead = pNewIcon;
+ m_pEnd = pNewIcon;
}
+ m_iLength++;
}
void IconTree::DeleteIconTree() {
diff --git a/fpdfsdk/src/javascript/JS_Value.cpp b/fpdfsdk/src/javascript/JS_Value.cpp
index a5844c1d58..ea7bfda57a 100644
--- a/fpdfsdk/src/javascript/JS_Value.cpp
+++ b/fpdfsdk/src/javascript/JS_Value.cpp
@@ -611,7 +611,7 @@ int _getDaylightSavingTA(double d) {
return 0;
time_t t = (time_t)(d / 1000);
struct tm* tmp = localtime(&t);
- if (tmp == NULL)
+ if (!tmp)
return 0;
if (tmp->tm_isdst > 0)
// One hour.