summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fpdfapi')
-rw-r--r--core/src/fpdfapi/fpdf_cmaps/fpdf_cmaps.cpp2
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp4
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp16
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp14
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp4
-rw-r--r--core/src/fpdfapi/fpdf_font/fpdf_font.cpp31
-rw-r--r--core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp32
-rw-r--r--core/src/fpdfapi/fpdf_font/ttgsubtable.cpp4
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page.cpp17
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp42
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp8
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp8
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp36
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp14
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp6
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp4
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp37
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp10
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp6
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp8
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp48
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp10
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render.cpp14
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp8
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp22
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp24
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp12
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp26
28 files changed, 228 insertions, 239 deletions
diff --git a/core/src/fpdfapi/fpdf_cmaps/fpdf_cmaps.cpp b/core/src/fpdfapi/fpdf_cmaps/fpdf_cmaps.cpp
index fba3a2b031..90091deaac 100644
--- a/core/src/fpdfapi/fpdf_cmaps/fpdf_cmaps.cpp
+++ b/core/src/fpdfapi/fpdf_cmaps/fpdf_cmaps.cpp
@@ -105,7 +105,7 @@ FX_WORD FPDFAPI_CIDFromCharCode(const FXCMAP_CMap* pMap, FX_DWORD charcode) {
}
FX_WORD code = (FX_WORD)charcode;
while (1) {
- if (pMap->m_pWordMap == NULL) {
+ if (!pMap->m_pWordMap) {
return 0;
}
if (pMap->m_WordMapType == FXCMAP_CMap::Single) {
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp
index eda51deb3b..5810da572b 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp
@@ -56,13 +56,13 @@ void CPDF_PageContentGenerate::GenerateContent() {
CFX_ByteString CPDF_PageContentGenerate::RealizeResource(
CPDF_Object* pResourceObj,
const FX_CHAR* szType) {
- if (m_pPage->m_pResources == NULL) {
+ if (!m_pPage->m_pResources) {
m_pPage->m_pResources = new CPDF_Dictionary;
int objnum = m_pDocument->AddIndirectObject(m_pPage->m_pResources);
m_pPage->m_pFormDict->SetAtReference("Resources", m_pDocument, objnum);
}
CPDF_Dictionary* pResList = m_pPage->m_pResources->GetDict(szType);
- if (pResList == NULL) {
+ if (!pResList) {
pResList = new CPDF_Dictionary;
m_pPage->m_pResources->SetAt(szType, pResList);
}
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
index a797332727..b200b8d37d 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
@@ -17,7 +17,7 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj,
CFX_FileBufferArchive* pFile,
FX_FILESIZE& offset) {
int32_t len = 0;
- if (pObj == NULL) {
+ if (!pObj) {
if (pFile->AppendString(" null") < 0) {
return -1;
}
@@ -416,7 +416,7 @@ FX_BOOL CPDF_Encryptor::Initialize(CPDF_CryptoHandler* pHandler,
if (src_size == 0) {
return TRUE;
}
- if (pHandler == NULL) {
+ if (!pHandler) {
m_pData = (uint8_t*)src_data;
m_dwSize = src_size;
m_bNewBuf = FALSE;
@@ -1071,7 +1071,7 @@ int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum,
const CPDF_Object* pObj,
FX_BOOL bEncrypt) {
int32_t len = 0;
- if (pObj == NULL) {
+ if (!pObj) {
if (m_File.AppendString(" null") < 0) {
return -1;
}
@@ -1098,7 +1098,7 @@ int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum,
case PDFOBJ_STRING: {
CFX_ByteString str = pObj->GetString();
FX_BOOL bHex = pObj->AsString()->IsHex();
- if (m_pCryptoHandler == NULL || !bEncrypt) {
+ if (!m_pCryptoHandler || !bEncrypt) {
CFX_ByteString content = PDF_EncodeString(str, bHex);
if ((len = m_File.AppendString(content)) < 0) {
return -1;
@@ -1200,7 +1200,7 @@ int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum,
break;
}
case PDFOBJ_DICTIONARY: {
- if (m_pCryptoHandler == NULL || pObj == m_pEncryptDict) {
+ if (!m_pCryptoHandler || pObj == m_pEncryptDict) {
return PDF_CreatorAppendObject(pObj, &m_File, m_Offset);
}
if (m_File.AppendString("<<") < 0) {
@@ -1263,7 +1263,7 @@ int32_t CPDF_Creator::WriteOldIndirectObject(FX_DWORD objnum) {
if (m_pParser->m_bVersionUpdated || m_bSecurityChanged || bExistInMap ||
bObjStm) {
CPDF_Object* pObj = m_pDocument->GetIndirectObject(objnum);
- if (pObj == NULL) {
+ if (!pObj) {
m_ObjectOffset[objnum] = 0;
m_ObjectSize[objnum] = 0;
return 0;
@@ -1278,7 +1278,7 @@ int32_t CPDF_Creator::WriteOldIndirectObject(FX_DWORD objnum) {
uint8_t* pBuffer;
FX_DWORD size;
m_pParser->GetIndirectBinary(objnum, pBuffer, size);
- if (pBuffer == NULL) {
+ if (!pBuffer) {
return 0;
}
if (m_pParser->m_V5Type[objnum] == 2) {
@@ -1477,7 +1477,7 @@ void CPDF_Creator::AppendNewObjNum(FX_DWORD objbum) {
int32_t CPDF_Creator::WriteDoc_Stage1(IFX_Pause* pPause) {
FXSYS_assert(m_iStage > -1 || m_iStage < 20);
if (m_iStage == 0) {
- if (m_pParser == NULL) {
+ if (!m_pParser) {
m_dwFlags &= ~FPDFCREATE_INCREMENTAL;
}
if (m_bSecurityChanged && (m_dwFlags & FPDFCREATE_NO_ORIGINAL) == 0) {
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
index 7febc7932f..9c96a3027c 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
@@ -20,7 +20,7 @@ CPDF_Document::CPDF_Document() : CPDF_IndirectObjects(NULL) {
m_pDocRender = CPDF_ModuleMgr::Get()->GetRenderModule()->CreateDocData(this);
}
void CPDF_Document::CreateNewDoc() {
- ASSERT(m_pRootDict == NULL && m_pInfoDict == NULL);
+ ASSERT(!m_pRootDict && !m_pInfoDict);
m_pRootDict = new CPDF_Dictionary;
m_pRootDict->SetAtName("Type", "Catalog");
int objnum = AddIndirectObject(m_pRootDict);
@@ -550,7 +550,7 @@ CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont,
FX_BOOL bTranslateName) {
CTFontRef font = (CTFontRef)pFont;
CTFontDescriptorRef descriptor = CTFontCopyFontDescriptor(font);
- if (descriptor == NULL) {
+ if (!descriptor) {
return NULL;
}
CFX_ByteString basefont;
@@ -560,7 +560,7 @@ CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont,
FXSYS_memset(bbox, 0, sizeof(int) * 4);
CFArrayRef languages = (CFArrayRef)CTFontDescriptorCopyAttribute(
descriptor, kCTFontLanguagesAttribute);
- if (languages == NULL) {
+ if (!languages) {
CFRelease(descriptor);
return NULL;
}
@@ -574,7 +574,7 @@ CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont,
}
CFRelease(descriptor);
CFDictionaryRef traits = (CFDictionaryRef)CTFontCopyTraits(font);
- if (traits == NULL) {
+ if (!traits) {
CFRelease(languages);
return NULL;
}
@@ -825,7 +825,7 @@ static void _InsertWidthArray1(CFX_Font* pFont,
}
CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) {
- if (pFont == NULL) {
+ if (!pFont) {
return NULL;
}
FX_BOOL bCJK = charset == FXFONT_CHINESEBIG5_CHARSET ||
@@ -1118,11 +1118,11 @@ CPDF_Font* CPDF_Document::AddStandardFont(const FX_CHAR* font,
void CPDF_Document::DeletePage(int iPage) {
CPDF_Dictionary* pRoot = GetRoot();
- if (pRoot == NULL) {
+ if (!pRoot) {
return;
}
CPDF_Dictionary* pPages = pRoot->GetDict("Pages");
- if (pPages == NULL) {
+ if (!pPages) {
return;
}
int nPages = pPages->GetInteger("Count");
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp
index 640e8671f8..10b0272b52 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp
@@ -51,7 +51,7 @@ CPDF_Dictionary* CPDF_Image::InitJPEG(uint8_t* pData, FX_DWORD size) {
m_bIsMask = FALSE;
m_Width = width;
m_Height = height;
- if (m_pStream == NULL) {
+ if (!m_pStream) {
m_pStream = new CPDF_Stream(NULL, 0, NULL);
}
return pDict;
@@ -367,7 +367,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap,
dest_buf = NULL;
}
}
- if (m_pStream == NULL) {
+ if (!m_pStream) {
m_pStream = new CPDF_Stream(NULL, 0, NULL);
}
if (!bStream) {
diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp
index 4a71382da4..3170b55e20 100644
--- a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp
+++ b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp
@@ -351,7 +351,7 @@ void CPDF_Font::CheckFontMetrics() {
void CPDF_Font::LoadUnicodeMap() {
m_bToUnicodeLoaded = TRUE;
CPDF_Stream* pStream = m_pFontDict->GetStream("ToUnicode");
- if (pStream == NULL) {
+ if (!pStream) {
return;
}
m_pToUnicodeMap = new CPDF_ToUnicodeMap;
@@ -425,7 +425,7 @@ CPDF_Font* CPDF_Font::CreateFontF(CPDF_Document* pDoc,
}
if (i < count) {
CPDF_Dictionary* pFontDesc = pFontDict->GetDict("FontDescriptor");
- if (pFontDesc == NULL || !pFontDesc->KeyExist("FontFile2")) {
+ if (!pFontDesc || !pFontDesc->KeyExist("FontFile2")) {
pFont = new CPDF_CIDFont;
pFont->m_pFontDict = pFontDict;
pFont->m_pDocument = pDoc;
@@ -455,7 +455,7 @@ CPDF_Font* CPDF_Font::CreateFontF(CPDF_Document* pDoc,
return pFont;
}
FX_BOOL CPDF_Font::Load() {
- if (m_pFontDict == NULL) {
+ if (!m_pFontDict) {
return FALSE;
}
CFX_ByteString type = m_pFontDict->GetString("Subtype");
@@ -488,7 +488,7 @@ CFX_WideString CPDF_ToUnicodeMap::Lookup(FX_DWORD charcode) {
}
const FX_WCHAR* buf = m_MultiCharBuf.GetBuffer();
FX_DWORD buf_len = m_MultiCharBuf.GetLength();
- if (buf == NULL || buf_len == 0) {
+ if (!buf || buf_len == 0) {
return CFX_WideString();
}
FX_DWORD index = value >> 16;
@@ -704,7 +704,7 @@ void CPDF_Font::LoadPDFEncoding(CPDF_Object* pEncoding,
CFX_ByteString*& pCharNames,
FX_BOOL bEmbedded,
FX_BOOL bTrueType) {
- if (pEncoding == NULL) {
+ if (!pEncoding) {
if (m_BaseFont == "Symbol") {
iBaseEncoding = bTrueType ? PDFFONT_ENCODING_MS_SYMBOL
: PDFFONT_ENCODING_ADOBE_SYMBOL;
@@ -748,7 +748,7 @@ void CPDF_Font::LoadPDFEncoding(CPDF_Object* pEncoding,
iBaseEncoding = PDFFONT_ENCODING_STANDARD;
}
CPDF_Array* pDiffs = pDict->GetArray("Differences");
- if (pDiffs == NULL) {
+ if (!pDiffs) {
return;
}
pCharNames = new CFX_ByteString[256];
@@ -879,13 +879,10 @@ const FX_CHAR* GetAdobeCharName(int iBaseEncoding,
if (pCharNames) {
name = pCharNames[charcode];
}
- if ((name == NULL || name[0] == 0) && iBaseEncoding) {
+ if ((!name || name[0] == 0) && iBaseEncoding) {
name = PDF_CharNameFromPredefinedCharSet(iBaseEncoding, charcode);
}
- if (name == NULL || name[0] == 0) {
- return NULL;
- }
- return name;
+ return name && name[0] ? name : nullptr;
}
FX_BOOL CPDF_SimpleFont::LoadCommon() {
CPDF_Dictionary* pFontDesc = m_pFontDict->GetDict("FontDescriptor");
@@ -1127,7 +1124,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
for (int charcode = 0; charcode < 256; charcode++) {
const FX_CHAR* name =
GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode);
- if (name == NULL) {
+ if (!name) {
continue;
}
m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name);
@@ -1228,7 +1225,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
for (int charcode = 0; charcode < 256; charcode++) {
const FX_CHAR* name =
GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode);
- if (name == NULL) {
+ if (!name) {
continue;
}
m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name);
@@ -1328,7 +1325,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
for (int charcode = 0; charcode < 256; charcode++) {
const FX_CHAR* name =
GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode);
- if (name == NULL) {
+ if (!name) {
continue;
}
m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name);
@@ -1453,7 +1450,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() {
}
if (((baseEncoding == PDFFONT_ENCODING_MACROMAN ||
baseEncoding == PDFFONT_ENCODING_WINANSI) &&
- m_pCharNames == NULL) ||
+ !m_pCharNames) ||
(m_Flags & PDFFONT_NONSYMBOLIC)) {
if (!FXFT_Has_Glyph_Names(m_Font.GetFace()) &&
(!m_Font.GetFace()->num_charmaps || !m_Font.GetFace()->charmaps)) {
@@ -1486,7 +1483,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() {
for (int charcode = 0; charcode < 256; charcode++) {
const FX_CHAR* name =
GetAdobeCharName(baseEncoding, m_pCharNames, charcode);
- if (name == NULL) {
+ if (!name) {
m_GlyphIndex[charcode] =
m_pFontFile ? FXFT_Get_Char_Index(m_Font.GetFace(), charcode) : -1;
continue;
@@ -1562,7 +1559,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() {
for (int charcode = 0; charcode < 256; charcode++) {
const FX_CHAR* name =
GetAdobeCharName(baseEncoding, m_pCharNames, charcode);
- if (name == NULL) {
+ if (!name) {
continue;
}
m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name);
diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
index 89004fee55..6e7a051b34 100644
--- a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
+++ b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
@@ -848,14 +848,14 @@ FX_WORD CPDF_CMap::CIDFromCharCode(FX_DWORD charcode) const {
if (m_pEmbedMap) {
return FPDFAPI_CIDFromCharCode(m_pEmbedMap, charcode);
}
- if (m_pMapping == NULL) {
+ if (!m_pMapping) {
return (FX_WORD)charcode;
}
if (charcode >> 16) {
if (m_pAddMapping) {
void* found = FXSYS_bsearch(&charcode, m_pAddMapping + 4,
*(FX_DWORD*)m_pAddMapping, 8, CompareCID);
- if (found == NULL) {
+ if (!found) {
if (m_pUseMap) {
return m_pUseMap->CIDFromCharCode(charcode);
}
@@ -1058,7 +1058,7 @@ CPDF_CIDFont::~CPDF_CIDFont() {
delete m_pTTGSUBTable;
}
FX_WORD CPDF_CIDFont::CIDFromCharCode(FX_DWORD charcode) const {
- if (m_pCMap == NULL) {
+ if (!m_pCMap) {
return (FX_WORD)charcode;
}
return m_pCMap->CIDFromCharCode(charcode);
@@ -1073,12 +1073,12 @@ FX_WCHAR CPDF_CIDFont::_UnicodeFromCharCode(FX_DWORD charcode) const {
case CIDCODING_UTF16:
return (FX_WCHAR)charcode;
case CIDCODING_CID:
- if (m_pCID2UnicodeMap == NULL || !m_pCID2UnicodeMap->IsLoaded()) {
+ if (!m_pCID2UnicodeMap || !m_pCID2UnicodeMap->IsLoaded()) {
return 0;
}
return m_pCID2UnicodeMap->UnicodeFromCID((FX_WORD)charcode);
}
- if (!m_pCMap->IsLoaded() || m_pCID2UnicodeMap == NULL ||
+ if (!m_pCMap->IsLoaded() || !m_pCID2UnicodeMap ||
!m_pCID2UnicodeMap->IsLoaded()) {
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
FX_WCHAR unicode;
@@ -1111,7 +1111,7 @@ FX_DWORD CPDF_CIDFont::_CharCodeFromUnicode(FX_WCHAR unicode) const {
case CIDCODING_UTF16:
return unicode;
case CIDCODING_CID: {
- if (m_pCID2UnicodeMap == NULL || !m_pCID2UnicodeMap->IsLoaded()) {
+ if (!m_pCID2UnicodeMap || !m_pCID2UnicodeMap->IsLoaded()) {
return 0;
}
FX_DWORD CID = 0;
@@ -1157,14 +1157,14 @@ FX_BOOL CPDF_CIDFont::_Load() {
return LoadGB2312();
}
CPDF_Array* pFonts = m_pFontDict->GetArray("DescendantFonts");
- if (pFonts == NULL) {
+ if (!pFonts) {
return FALSE;
}
if (pFonts->GetCount() != 1) {
return FALSE;
}
CPDF_Dictionary* pCIDFontDict = pFonts->GetDict(0);
- if (pCIDFontDict == NULL) {
+ if (!pCIDFontDict) {
return FALSE;
}
m_BaseFont = pCIDFontDict->GetString("BaseFont");
@@ -1180,7 +1180,7 @@ FX_BOOL CPDF_CIDFont::_Load() {
LoadFontDescriptor(pFontDesc);
}
CPDF_Object* pEncoding = m_pFontDict->GetElementValue("Encoding");
- if (pEncoding == NULL) {
+ if (!pEncoding) {
return FALSE;
}
CFX_ByteString subtype = pCIDFontDict->GetString("Subtype");
@@ -1201,7 +1201,7 @@ FX_BOOL CPDF_CIDFont::_Load() {
} else {
return FALSE;
}
- if (m_pCMap == NULL) {
+ if (!m_pCMap) {
return FALSE;
}
m_Charset = m_pCMap->m_Charset;
@@ -1218,8 +1218,8 @@ FX_BOOL CPDF_CIDFont::_Load() {
->GetFontGlobals()
->m_CMapManager.GetCID2UnicodeMap(
m_Charset,
- m_pFontFile == NULL && (m_pCMap->m_Coding == CIDCODING_CID ||
- pCIDFontDict->KeyExist("W")));
+ !m_pFontFile && (m_pCMap->m_Coding == CIDCODING_CID ||
+ pCIDFontDict->KeyExist("W")));
if (m_Font.GetFace()) {
if (m_bType1) {
FXFT_Select_Charmap(m_Font.GetFace(), FXFT_ENCODING_UNICODE);
@@ -1333,7 +1333,7 @@ void CPDF_CIDFont::GetCharBBox(FX_DWORD charcode, FX_RECT& rect, int level) {
} else {
rect = FX_RECT(0, 0, 0, 0);
}
- if (m_pFontFile == NULL && m_Charset == CIDSET_JAPAN1) {
+ if (!m_pFontFile && m_Charset == CIDSET_JAPAN1) {
FX_WORD CID = CIDFromCharCode(charcode);
const uint8_t* pTransform = GetCIDTransform(CID);
if (pTransform && !bVert) {
@@ -1458,7 +1458,7 @@ int CPDF_CIDFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL* pVertGlyph) {
if (pVertGlyph) {
*pVertGlyph = FALSE;
}
- if (m_pFontFile == NULL && m_pCIDToGIDMap == NULL) {
+ if (!m_pFontFile && !m_pCIDToGIDMap) {
FX_WORD cid = CIDFromCharCode(charcode);
FX_WCHAR unicode = 0;
if (m_bCIDIsGID) {
@@ -1504,7 +1504,7 @@ int CPDF_CIDFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL* pVertGlyph) {
iBaseEncoding = PDFFONT_ENCODING_MACROMAN;
}
const FX_CHAR* name = GetAdobeCharName(iBaseEncoding, NULL, charcode);
- if (name == NULL) {
+ if (!name) {
return charcode == 0 ? -1 : (int)charcode;
}
FX_WORD unicode = PDF_UnicodeFromAdobeName(name);
@@ -1616,7 +1616,7 @@ int CPDF_CIDFont::AppendChar(FX_CHAR* str, FX_DWORD charcode) const {
return m_pCMap->AppendChar(str, charcode);
}
FX_BOOL CPDF_CIDFont::IsUnicodeCompatible() const {
- if (!m_pCMap->IsLoaded() || m_pCID2UnicodeMap == NULL ||
+ if (!m_pCMap->IsLoaded() || !m_pCID2UnicodeMap ||
!m_pCID2UnicodeMap->IsLoaded()) {
return m_pCMap->m_Coding != CIDCODING_UNKNOWN;
}
diff --git a/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp b/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp
index 4786b8be94..035ea8a0ff 100644
--- a/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp
+++ b/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp
@@ -47,7 +47,7 @@ FX_BOOL CFX_GlyphMap::Lookup(int key, int& value) {
void* pResult = FXSYS_bsearch(&key, m_Buffer.GetBuffer(),
m_Buffer.GetSize() / sizeof(_IntPair),
sizeof(_IntPair), _CompareInt);
- if (pResult == NULL) {
+ if (!pResult) {
return FALSE;
}
value = ((FX_DWORD*)pResult)[1];
@@ -158,7 +158,7 @@ bool CFX_CTTGSUBTable::GetVerticalGlyphSub2(uint32_t glyphnum,
int CFX_CTTGSUBTable::GetCoverageIndex(struct TCoverageFormatBase* Coverage,
uint32_t g) {
int i = 0;
- if (Coverage == NULL) {
+ if (!Coverage) {
return -1;
}
switch (Coverage->CoverageFormat) {
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
index f37dd770ca..1fef74b99b 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
@@ -689,7 +689,7 @@ CPDF_PageObjects::~CPDF_PageObjects() {
}
}
void CPDF_PageObjects::ContinueParse(IFX_Pause* pPause) {
- if (m_pParser == NULL) {
+ if (!m_pParser) {
return;
}
m_pParser->Continue(pPause);
@@ -720,10 +720,7 @@ int CPDF_PageObjects::GetObjectIndex(CPDF_PageObject* pObj) const {
}
CPDF_PageObject* CPDF_PageObjects::GetObjectByIndex(int index) const {
FX_POSITION pos = m_ObjectList.FindIndex(index);
- if (pos == NULL) {
- return NULL;
- }
- return (CPDF_PageObject*)m_ObjectList.GetAt(pos);
+ return pos ? static_cast<CPDF_PageObject*>(m_ObjectList.GetAt(pos)) : nullptr;
}
void CPDF_PageObjects::Transform(const CFX_Matrix& matrix) {
FX_POSITION pos = m_ObjectList.GetHeadPosition();
@@ -758,11 +755,11 @@ CFX_FloatRect CPDF_PageObjects::CalcBoundingBox() const {
return CFX_FloatRect(left, bottom, right, top);
}
void CPDF_PageObjects::LoadTransInfo() {
- if (m_pFormDict == NULL) {
+ if (!m_pFormDict) {
return;
}
CPDF_Dictionary* pGroup = m_pFormDict->GetDict("Group");
- if (pGroup == NULL) {
+ if (!pGroup) {
return;
}
if (pGroup->GetString("S") != "Transparency") {
@@ -800,7 +797,7 @@ void CPDF_Page::Load(CPDF_Document* pDocument,
m_pPageRender =
CPDF_ModuleMgr::Get()->GetRenderModule()->CreatePageCache(this);
}
- if (pPageDict == NULL) {
+ if (!pPageDict) {
m_PageWidth = m_PageHeight = 100 * 1.0f;
m_pPageResources = m_pResources = NULL;
return;
@@ -912,10 +909,10 @@ CPDF_Form::CPDF_Form(CPDF_Document* pDoc,
m_pFormDict = pFormStream ? pFormStream->GetDict() : NULL;
m_pResources = m_pFormDict->GetDict("Resources");
m_pPageResources = pPageResources;
- if (m_pResources == NULL) {
+ if (!m_pResources) {
m_pResources = pParentResources;
}
- if (m_pResources == NULL) {
+ if (!m_pResources) {
m_pResources = pPageResources;
}
m_Transparency = 0;
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
index 8deeb66deb..c9eee8e380 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
@@ -688,7 +688,7 @@ CPDF_ICCBasedCS::~CPDF_ICCBasedCS() {
FX_BOOL CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
CPDF_Stream* pStream = pArray->GetStream(1);
- if (pStream == NULL) {
+ if (!pStream) {
return FALSE;
}
m_pProfile = pDoc->LoadIccProfile(pStream);
@@ -699,7 +699,7 @@ FX_BOOL CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
m_pProfile
->GetComponents(); // Try using the nComponents from ICC profile
CPDF_Dictionary* pDict = pStream->GetDict();
- if (m_pProfile->m_pTransform == NULL) { // No valid ICC profile or using sRGB
+ if (!m_pProfile->m_pTransform) { // No valid ICC profile or using sRGB
CPDF_Object* pAlterCSObj =
pDict ? pDict->GetElementValue("Alternate") : NULL;
if (pAlterCSObj) {
@@ -764,7 +764,7 @@ FX_BOOL CPDF_ICCBasedCS::GetRGB(FX_FLOAT* pBuf,
return TRUE;
}
ICodec_IccModule* pIccModule = CPDF_ModuleMgr::Get()->GetIccModule();
- if (m_pProfile->m_pTransform == NULL || pIccModule == NULL) {
+ if (!m_pProfile->m_pTransform || !pIccModule) {
if (m_pAlterCS) {
return m_pAlterCS->GetRGB(pBuf, R, G, B);
}
@@ -822,7 +822,7 @@ void CPDF_ICCBasedCS::TranslateImageLine(uint8_t* pDestBuf,
CPDF_ModuleMgr::Get()->GetIccModule()->TranslateScanline(
m_pProfile->m_pTransform, pDestBuf, pSrcBuf, pixels);
} else {
- if (m_pCache == NULL) {
+ if (!m_pCache) {
((CPDF_ICCBasedCS*)this)->m_pCache = FX_Alloc2D(uint8_t, nMaxColors, 3);
uint8_t* temp_src = FX_Alloc2D(uint8_t, nMaxColors, m_nComponents);
uint8_t* pSrc = temp_src;
@@ -897,7 +897,7 @@ FX_BOOL CPDF_IndexedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
}
CPDF_DocPageData* pDocPageData = pDoc->GetPageData();
m_pBaseCS = pDocPageData->GetColorSpace(pBaseObj, NULL);
- if (m_pBaseCS == NULL) {
+ if (!m_pBaseCS) {
return FALSE;
}
m_pCountedBaseCS = pDocPageData->FindColorSpacePtr(m_pBaseCS->GetArray());
@@ -1078,8 +1078,8 @@ FX_BOOL CPDF_SeparationCS::GetRGB(FX_FLOAT* pBuf,
if (m_Type == None) {
return FALSE;
}
- if (m_pFunc == NULL) {
- if (m_pAltCS == NULL) {
+ if (!m_pFunc) {
+ if (!m_pAltCS) {
return FALSE;
}
int nComps = m_pAltCS->CountComponents();
@@ -1154,7 +1154,7 @@ FX_BOOL CPDF_DeviceNCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
}
m_pAltCS = Load(pDoc, pAltCS);
m_pFunc = CPDF_Function::Load(pArray->GetElementValue(3));
- if (m_pAltCS == NULL || m_pFunc == NULL) {
+ if (!m_pAltCS || !m_pFunc) {
return FALSE;
}
if (m_pFunc->CountOutputs() < m_pAltCS->CountComponents()) {
@@ -1166,7 +1166,7 @@ FX_BOOL CPDF_DeviceNCS::GetRGB(FX_FLOAT* pBuf,
FX_FLOAT& R,
FX_FLOAT& G,
FX_FLOAT& B) const {
- if (m_pFunc == NULL) {
+ if (!m_pFunc) {
return FALSE;
}
CFX_FixedBufGrow<FX_FLOAT, 16> results(m_pFunc->CountOutputs());
@@ -1331,7 +1331,7 @@ FX_BOOL CPDF_ColorSpace::SetCMYK(FX_FLOAT* pBuf,
return SetRGB(pBuf, R, G, B);
}
void CPDF_ColorSpace::GetDefaultColor(FX_FLOAT* buf) const {
- if (buf == NULL || m_Family == PDFCS_PATTERN) {
+ if (!buf || m_Family == PDFCS_PATTERN) {
return;
}
FX_FLOAT min, max;
@@ -1418,7 +1418,7 @@ void CPDF_Color::ReleaseColorSpace() {
}
void CPDF_Color::SetColorSpace(CPDF_ColorSpace* pCS) {
if (m_pCS == pCS) {
- if (m_pBuffer == NULL) {
+ if (!m_pBuffer) {
m_pBuffer = pCS->CreateBuf();
}
ReleaseColorSpace();
@@ -1434,7 +1434,7 @@ void CPDF_Color::SetColorSpace(CPDF_ColorSpace* pCS) {
}
}
void CPDF_Color::SetValue(FX_FLOAT* comps) {
- if (m_pBuffer == NULL) {
+ if (!m_pBuffer) {
return;
}
if (m_pCS->GetFamily() != PDFCS_PATTERN) {
@@ -1445,7 +1445,7 @@ void CPDF_Color::SetValue(CPDF_Pattern* pPattern, FX_FLOAT* comps, int ncomps) {
if (ncomps > MAX_PATTERN_COLORCOMPS) {
return;
}
- if (m_pCS == NULL || m_pCS->GetFamily() != PDFCS_PATTERN) {
+ if (!m_pCS || m_pCS->GetFamily() != PDFCS_PATTERN) {
FX_Free(m_pBuffer);
m_pCS = CPDF_ColorSpace::GetStockCS(PDFCS_PATTERN);
m_pBuffer = m_pCS->CreateBuf();
@@ -1482,7 +1482,7 @@ void CPDF_Color::Copy(const CPDF_Color* pSrc) {
m_pCS = m_pCS->m_pDocument->GetPageData()->GetCopiedColorSpace(pArray);
}
}
- if (m_pCS == NULL) {
+ if (!m_pCS) {
return;
}
m_pBuffer = m_pCS->CreateBuf();
@@ -1498,7 +1498,7 @@ void CPDF_Color::Copy(const CPDF_Color* pSrc) {
}
}
FX_BOOL CPDF_Color::GetRGB(int& R, int& G, int& B) const {
- if (m_pCS == NULL || m_pBuffer == NULL) {
+ if (!m_pCS || !m_pBuffer) {
return FALSE;
}
FX_FLOAT r = 0.0f, g = 0.0f, b = 0.0f;
@@ -1511,28 +1511,26 @@ FX_BOOL CPDF_Color::GetRGB(int& R, int& G, int& B) const {
return TRUE;
}
CPDF_Pattern* CPDF_Color::GetPattern() const {
- if (m_pBuffer == NULL || m_pCS->GetFamily() != PDFCS_PATTERN) {
+ if (!m_pBuffer || m_pCS->GetFamily() != PDFCS_PATTERN) {
return NULL;
}
PatternValue* pvalue = (PatternValue*)m_pBuffer;
return pvalue->m_pPattern;
}
CPDF_ColorSpace* CPDF_Color::GetPatternCS() const {
- if (m_pBuffer == NULL || m_pCS->GetFamily() != PDFCS_PATTERN) {
+ if (!m_pBuffer || m_pCS->GetFamily() != PDFCS_PATTERN) {
return NULL;
}
return m_pCS->GetBaseCS();
}
FX_FLOAT* CPDF_Color::GetPatternColor() const {
- if (m_pBuffer == NULL || m_pCS->GetFamily() != PDFCS_PATTERN) {
+ if (!m_pBuffer || m_pCS->GetFamily() != PDFCS_PATTERN) {
return NULL;
}
PatternValue* pvalue = (PatternValue*)m_pBuffer;
return pvalue->m_nComps ? pvalue->m_Comps : NULL;
}
FX_BOOL CPDF_Color::IsEqual(const CPDF_Color& other) const {
- if (m_pCS != other.m_pCS || m_pCS == NULL) {
- return FALSE;
- }
- return FXSYS_memcmp(m_pBuffer, other.m_pBuffer, m_pCS->GetBufSize()) == 0;
+ return m_pCS && m_pCS == other.m_pCS &&
+ FXSYS_memcmp(m_pBuffer, other.m_pBuffer, m_pCS->GetBufSize()) == 0;
}
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
index 5f9d038626..118f1cd5a3 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
@@ -207,7 +207,7 @@ FX_BOOL CPDF_PSProc::Parse(CPDF_SimpleParser& parser) {
}
i++;
}
- if (_PDF_PSOpNames[i].name == NULL) {
+ if (!_PDF_PSOpNames[i].name) {
FX_FLOAT* pd = FX_Alloc(FX_FLOAT, 1);
*pd = FX_atof(word);
m_Operators.Add((void*)PSOP_CONST);
@@ -683,7 +683,7 @@ CPDF_ExpIntFunc::~CPDF_ExpIntFunc() {
}
FX_BOOL CPDF_ExpIntFunc::v_Init(CPDF_Object* pObj) {
CPDF_Dictionary* pDict = pObj->GetDict();
- if (pDict == NULL) {
+ if (!pDict) {
return FALSE;
}
CPDF_Array* pArray0 = pDict->GetArray("C0");
@@ -813,7 +813,7 @@ FX_BOOL CPDF_StitchFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* outputs) const {
if (input < m_pBounds[i + 1]) {
break;
}
- if (m_pSubFunctions[i] == NULL) {
+ if (!m_pSubFunctions[i]) {
return FALSE;
}
input = PDF_Interpolate(input, m_pBounds[i], m_pBounds[i + 1],
@@ -823,7 +823,7 @@ FX_BOOL CPDF_StitchFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* outputs) const {
return TRUE;
}
CPDF_Function* CPDF_Function::Load(CPDF_Object* pFuncObj) {
- if (pFuncObj == NULL) {
+ if (!pFuncObj) {
return NULL;
}
CPDF_Function* pFunc = NULL;
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
index 63f957a838..d8f21c692d 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
@@ -103,7 +103,7 @@ CPDF_Rect CPDF_ClipPath::GetClipBox() const {
FX_BOOL bLayerStarted = FALSE;
for (int i = 0; i < count; i++) {
CPDF_TextObject* pTextObj = GetText(i);
- if (pTextObj == NULL) {
+ if (!pTextObj) {
if (!bStarted) {
rect = layer_rect;
bStarted = TRUE;
@@ -637,7 +637,7 @@ void CPDF_ContentMarkData::AddMark(const CFX_ByteString& name,
FX_BOOL bDirect) {
CPDF_ContentMarkItem& item = m_Marks.Add();
item.SetName(name);
- if (pDict == NULL) {
+ if (!pDict) {
return;
}
item.SetParam(bDirect ? CPDF_ContentMarkItem::DirectDict
@@ -652,7 +652,7 @@ void CPDF_ContentMarkData::DeleteLastMark() {
m_Marks.RemoveAt(size - 1);
}
FX_BOOL CPDF_ContentMark::HasMark(const CFX_ByteStringC& mark) const {
- if (m_pObject == NULL) {
+ if (!m_pObject) {
return FALSE;
}
for (int i = 0; i < m_pObject->CountItems(); i++) {
@@ -665,7 +665,7 @@ FX_BOOL CPDF_ContentMark::HasMark(const CFX_ByteStringC& mark) const {
}
FX_BOOL CPDF_ContentMark::LookupMark(const CFX_ByteStringC& mark,
CPDF_Dictionary*& pDict) const {
- if (m_pObject == NULL) {
+ if (!m_pObject) {
return FALSE;
}
for (int i = 0; i < m_pObject->CountItems(); i++) {
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
index 1df0c605e4..e90c53c956 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
@@ -117,7 +117,7 @@ void CPDF_StreamContentParser::AddNameParam(const FX_CHAR* name, int len) {
CPDF_Name::Create(PDF_NameDecode(CFX_ByteStringC(name, len)));
} else {
m_ParamBuf1[index].m_Type = PDFOBJ_NAME;
- if (FXSYS_memchr(name, '#', len) == NULL) {
+ if (!FXSYS_memchr(name, '#', len)) {
FXSYS_memcpy(m_ParamBuf1[index].m_Name.m_Buffer, name, len);
m_ParamBuf1[index].m_Name.m_Len = len;
} else {
@@ -410,7 +410,7 @@ void CPDF_StreamContentParser::Handle_BeginMarkedContent_Dictionary() {
}
CFX_ByteString tag = GetString(1);
CPDF_Object* pProperty = GetObject(0);
- if (pProperty == NULL) {
+ if (!pProperty) {
return;
}
FX_BOOL bDirect = TRUE;
@@ -631,7 +631,7 @@ void CPDF_StreamContentParser::Handle_SetColorSpace_Fill() {
}
CFX_ByteString csname = GetString(0);
CPDF_ColorSpace* pCS = FindColorSpace(csname);
- if (pCS == NULL) {
+ if (!pCS) {
return;
}
m_pCurStates->m_ColorState.GetModify()->m_FillColor.SetColorSpace(pCS);
@@ -642,7 +642,7 @@ void CPDF_StreamContentParser::Handle_SetColorSpace_Stroke() {
}
CFX_ByteString csname = GetString(0);
CPDF_ColorSpace* pCS = FindColorSpace(csname);
- if (pCS == NULL) {
+ if (!pCS) {
return;
}
m_pCurStates->m_ColorState.GetModify()->m_StrokeColor.SetColorSpace(pCS);
@@ -652,7 +652,7 @@ void CPDF_StreamContentParser::Handle_SetDash() {
return;
}
CPDF_Array* pArray = GetObject(1) ? GetObject(1)->GetArray() : NULL;
- if (pArray == NULL) {
+ if (!pArray) {
return;
}
m_pCurStates->SetLineDash(pArray, GetNumber(0), 1.0f);
@@ -771,7 +771,7 @@ void CPDF_StreamContentParser::AddForm(CPDF_Stream* pStream) {
CPDF_ImageObject* CPDF_StreamContentParser::AddImage(CPDF_Stream* pStream,
CPDF_Image* pImage,
FX_BOOL bInline) {
- if (pStream == NULL && pImage == NULL) {
+ if (!pStream && !pImage) {
return NULL;
}
CFX_Matrix ImageMatrix;
@@ -1032,7 +1032,7 @@ void CPDF_StreamContentParser::Handle_SetColorPS_Fill() {
return;
}
CPDF_Object* pLastParam = GetObject(0);
- if (pLastParam == NULL) {
+ if (!pLastParam) {
return;
}
int nargs = m_ParamCount;
@@ -1062,7 +1062,7 @@ void CPDF_StreamContentParser::Handle_SetColorPS_Stroke() {
return;
}
CPDF_Object* pLastParam = GetObject(0);
- if (pLastParam == NULL) {
+ if (!pLastParam) {
return;
}
int nargs = m_ParamCount;
@@ -1099,7 +1099,7 @@ void CPDF_StreamContentParser::Handle_ShadeFill() {
return;
}
CPDF_Pattern* pPattern = FindPattern(GetString(0), TRUE);
- if (pPattern == NULL) {
+ if (!pPattern) {
return;
}
if (pPattern->m_PatternType != PATTERN_SHADING) {
@@ -1162,24 +1162,24 @@ void CPDF_StreamContentParser::Handle_SetFont() {
CPDF_Object* CPDF_StreamContentParser::FindResourceObj(
const CFX_ByteStringC& type,
const CFX_ByteString& name) {
- if (m_pResources == NULL) {
+ if (!m_pResources) {
return NULL;
}
if (m_pResources == m_pPageResources) {
CPDF_Dictionary* pList = m_pResources->GetDict(type);
- if (pList == NULL) {
+ if (!pList) {
return NULL;
}
CPDF_Object* pRes = pList->GetElementValue(name);
return pRes;
}
CPDF_Dictionary* pList = m_pResources->GetDict(type);
- if (pList == NULL) {
- if (m_pPageResources == NULL) {
+ if (!pList) {
+ if (!m_pPageResources) {
return NULL;
}
CPDF_Dictionary* pList = m_pPageResources->GetDict(type);
- if (pList == NULL) {
+ if (!pList) {
return NULL;
}
CPDF_Object* pRes = pList->GetElementValue(name);
@@ -1211,7 +1211,7 @@ CPDF_ColorSpace* CPDF_StreamContentParser::FindColorSpace(
CFX_ByteString defname = "Default";
defname += name.Mid(7);
CPDF_Object* pDefObj = FindResourceObj("ColorSpace", defname);
- if (pDefObj == NULL) {
+ if (!pDefObj) {
if (name == "DeviceGray") {
return CPDF_ColorSpace::GetStockCS(PDFCS_DEVICEGRAY);
}
@@ -1223,7 +1223,7 @@ CPDF_ColorSpace* CPDF_StreamContentParser::FindColorSpace(
return m_pDocument->LoadColorSpace(pDefObj);
}
CPDF_Object* pCSObj = FindResourceObj("ColorSpace", name);
- if (pCSObj == NULL) {
+ if (!pCSObj) {
m_bResourceMissing = TRUE;
return NULL;
}
@@ -1253,7 +1253,7 @@ void CPDF_StreamContentParser::AddTextObject(CFX_ByteString* pStrs,
FX_FLOAT* pKerning,
int nsegs) {
CPDF_Font* pFont = m_pCurStates->m_TextState.GetFont();
- if (pFont == NULL) {
+ if (!pFont) {
return;
}
if (fInitKerning != 0) {
@@ -1324,7 +1324,7 @@ void CPDF_StreamContentParser::Handle_ShowText() {
}
void CPDF_StreamContentParser::Handle_ShowText_Positioning() {
CPDF_Array* pArray = GetObject(0) ? GetObject(0)->GetArray() : NULL;
- if (pArray == NULL) {
+ if (!pArray) {
return;
}
int n = pArray->GetCount();
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
index fbe6faa471..2f68d78808 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
@@ -249,7 +249,7 @@ CPDF_StreamParser::~CPDF_StreamParser() {
FX_DWORD _DecodeAllScanlines(ICodec_ScanlineDecoder* pDecoder,
uint8_t*& dest_buf,
FX_DWORD& dest_size) {
- if (pDecoder == NULL) {
+ if (!pDecoder) {
return (FX_DWORD)-1;
}
int ncomps = pDecoder->CountComps();
@@ -353,7 +353,7 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc,
FX_DWORD bpc = pDict->GetInteger("BitsPerComponent");
FX_DWORD nComponents = 1;
CPDF_ColorSpace* pCS = pDoc->LoadColorSpace(pCSObj);
- if (pCS == NULL) {
+ if (!pCS) {
nComponents = 3;
} else {
nComponents = pCS->CountComponents();
@@ -634,7 +634,7 @@ CPDF_Object* CPDF_StreamParser::ReadNextObject(FX_BOOL bAllowNestedArray,
CFX_ByteString key =
PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1, m_WordSize - 1));
CPDF_Object* pObj = ReadNextObject(TRUE);
- if (pObj == NULL) {
+ if (!pObj) {
if (pDict) {
pDict->Release();
}
@@ -655,7 +655,7 @@ CPDF_Object* CPDF_StreamParser::ReadNextObject(FX_BOOL bAllowNestedArray,
CPDF_Array* pArray = CPDF_Array::Create();
while (1) {
CPDF_Object* pObj = ReadNextObject(bAllowNestedArray, TRUE);
- if (pObj == NULL) {
+ if (!pObj) {
if (m_WordSize == 0 || m_WordBuffer[0] == ']') {
return pArray;
}
@@ -924,8 +924,8 @@ void CPDF_ContentParser::Clear() {
m_Status = Ready;
}
void CPDF_ContentParser::Start(CPDF_Page* pPage, CPDF_ParseOptions* pOptions) {
- if (m_Status != Ready || pPage == NULL || pPage->m_pDocument == NULL ||
- pPage->m_pFormDict == NULL) {
+ if (m_Status != Ready || !pPage || !pPage->m_pDocument ||
+ !pPage->m_pFormDict) {
m_Status = Done;
return;
}
@@ -938,7 +938,7 @@ void CPDF_ContentParser::Start(CPDF_Page* pPage, CPDF_ParseOptions* pOptions) {
m_InternalStage = PAGEPARSE_STAGE_GETCONTENT;
m_CurrentOffset = 0;
CPDF_Object* pContent = pPage->m_pFormDict->GetElementValue("Contents");
- if (pContent == NULL) {
+ if (!pContent) {
m_Status = Done;
return;
}
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
index 5ead9a5bea..fc050b9369 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
@@ -129,7 +129,7 @@ FX_BOOL CPDF_ShadingPattern::Load() {
CPDF_Dictionary* pShadingDict =
m_pShadingObj ? m_pShadingObj->GetDict() : NULL;
- if (pShadingDict == NULL) {
+ if (!pShadingDict) {
return FALSE;
}
if (m_nFuncs) {
@@ -151,7 +151,7 @@ FX_BOOL CPDF_ShadingPattern::Load() {
}
}
CPDF_Object* pCSObj = pShadingDict->GetElementValue("ColorSpace");
- if (pCSObj == NULL) {
+ if (!pCSObj) {
return FALSE;
}
CPDF_DocPageData* pDocPageData = m_pDocument->GetPageData();
@@ -199,7 +199,7 @@ FX_BOOL CPDF_MeshStream::Load(CPDF_Stream* pShadingStream,
m_CoordMax = m_nCoordBits == 32 ? -1 : (1 << m_nCoordBits) - 1;
m_CompMax = (1 << m_nCompBits) - 1;
CPDF_Array* pDecode = pDict->GetArray("Decode");
- if (pDecode == NULL || pDecode->GetCount() != 4 + m_nComps * 2) {
+ if (!pDecode || pDecode->GetCount() != 4 + m_nComps * 2) {
return FALSE;
}
m_xmin = pDecode->GetNumber(0);
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
index 5fbdcc634c..c855a7c5c2 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
@@ -454,7 +454,7 @@ CFX_WideString PDF_DecodeText(const uint8_t* src_data,
}
}
result.ReleaseBuffer(dest_pos);
- } else if (pCharMap == NULL) {
+ } else if (!pCharMap) {
FX_WCHAR* dest_buf = result.GetBuffer(src_len);
for (FX_DWORD i = 0; i < src_len; i++) {
dest_buf[i] = PDFDocEncoding[src_data[i]];
@@ -473,7 +473,7 @@ CFX_ByteString PDF_EncodeText(const FX_WCHAR* pString,
len = FXSYS_wcslen(pString);
}
CFX_ByteString result;
- if (pCharMap == NULL) {
+ if (!pCharMap) {
FX_CHAR* dest_buf1 = result.GetBuffer(len);
int i;
for (i = 0; i < len; i++) {
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
index 6625cce2e6..bf94185720 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
@@ -35,11 +35,11 @@ CPDF_DocRenderData* CPDF_Document::GetValidateRenderData() {
void CPDF_Document::LoadDoc() {
m_LastObjNum = m_pParser->GetLastObjNum();
CPDF_Object* pRootObj = GetIndirectObject(m_pParser->GetRootObjNum());
- if (pRootObj == NULL) {
+ if (!pRootObj) {
return;
}
m_pRootDict = pRootObj->GetDict();
- if (m_pRootDict == NULL) {
+ if (!m_pRootDict) {
return;
}
CPDF_Object* pInfoObj = GetIndirectObject(m_pParser->GetInfoObjNum());
@@ -58,7 +58,7 @@ void CPDF_Document::LoadAsynDoc(CPDF_Dictionary* pLinearized) {
m_LastObjNum = m_pParser->GetLastObjNum();
CPDF_Object* indirectObj = GetIndirectObject(m_pParser->GetRootObjNum());
m_pRootDict = indirectObj ? indirectObj->GetDict() : NULL;
- if (m_pRootDict == NULL) {
+ if (!m_pRootDict) {
return;
}
indirectObj = GetIndirectObject(m_pParser->GetInfoObjNum());
@@ -100,7 +100,7 @@ CPDF_Dictionary* CPDF_Document::_FindPDFPage(CPDF_Dictionary* pPages,
int nPagesToGo,
int level) {
CPDF_Array* pKidList = pPages->GetArray("Kids");
- if (pKidList == NULL) {
+ if (!pKidList) {
if (nPagesToGo == 0) {
return pPages;
}
@@ -112,7 +112,7 @@ CPDF_Dictionary* CPDF_Document::_FindPDFPage(CPDF_Dictionary* pPages,
int nKids = pKidList->GetCount();
for (int i = 0; i < nKids; i++) {
CPDF_Dictionary* pKid = pKidList->GetDict(i);
- if (pKid == NULL) {
+ if (!pKid) {
nPagesToGo--;
continue;
}
@@ -175,7 +175,7 @@ int CPDF_Document::_FindPageIndex(CPDF_Dictionary* pNode,
int level) {
if (pNode->KeyExist("Kids")) {
CPDF_Array* pKidList = pNode->GetArray("Kids");
- if (pKidList == NULL) {
+ if (!pKidList) {
return -1;
}
if (level >= FX_MAX_PAGE_LEVEL) {
@@ -199,7 +199,7 @@ int CPDF_Document::_FindPageIndex(CPDF_Dictionary* pNode,
}
for (FX_DWORD i = 0; i < pKidList->GetCount(); i++) {
CPDF_Dictionary* pKid = pKidList->GetDict(i);
- if (pKid == NULL) {
+ if (!pKid) {
continue;
}
if (pKid == pNode) {
@@ -237,11 +237,11 @@ int CPDF_Document::GetPageIndex(FX_DWORD objnum) {
}
}
CPDF_Dictionary* pRoot = GetRoot();
- if (pRoot == NULL) {
+ if (!pRoot) {
return -1;
}
CPDF_Dictionary* pPages = pRoot->GetDict("Pages");
- if (pPages == NULL) {
+ if (!pPages) {
return -1;
}
int index = 0;
@@ -259,13 +259,13 @@ static int _CountPages(CPDF_Dictionary* pPages, int level) {
return count;
}
CPDF_Array* pKidList = pPages->GetArray("Kids");
- if (pKidList == NULL) {
+ if (!pKidList) {
return 0;
}
count = 0;
for (FX_DWORD i = 0; i < pKidList->GetCount(); i++) {
CPDF_Dictionary* pKid = pKidList->GetDict(i);
- if (pKid == NULL) {
+ if (!pKid) {
continue;
}
if (!pKid->KeyExist("Kids")) {
@@ -279,11 +279,11 @@ static int _CountPages(CPDF_Dictionary* pPages, int level) {
}
int CPDF_Document::_GetPageCount() const {
CPDF_Dictionary* pRoot = GetRoot();
- if (pRoot == NULL) {
+ if (!pRoot) {
return 0;
}
CPDF_Dictionary* pPages = pRoot->GetDict("Pages");
- if (pPages == NULL) {
+ if (!pPages) {
return 0;
}
if (!pPages->KeyExist("Kids")) {
@@ -300,7 +300,7 @@ FX_BOOL CPDF_Document::IsContentUsedElsewhere(FX_DWORD objnum,
}
CPDF_Object* pContents =
pPageDict ? pPageDict->GetElement("Contents") : NULL;
- if (pContents == NULL) {
+ if (!pContents) {
continue;
}
if (pContents->GetDirectType() == PDFOBJ_ARRAY) {
@@ -317,16 +317,13 @@ FX_BOOL CPDF_Document::IsContentUsedElsewhere(FX_DWORD objnum,
return FALSE;
}
FX_DWORD CPDF_Document::GetUserPermissions(FX_BOOL bCheckRevision) const {
- if (m_pParser == NULL) {
+ if (!m_pParser) {
return (FX_DWORD)-1;
}
return m_pParser->GetPermissions(bCheckRevision);
}
FX_BOOL CPDF_Document::IsOwner() const {
- if (m_pParser == NULL) {
- return TRUE;
- }
- return m_pParser->IsOwner();
+ return !m_pParser || m_pParser->IsOwner();
}
FX_BOOL CPDF_Document::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) const {
{
@@ -337,7 +334,7 @@ FX_BOOL CPDF_Document::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) const {
return TRUE;
}
}
- if (m_pParser == NULL) {
+ if (!m_pParser) {
bForm = FALSE;
return TRUE;
}
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
index d2379fea6c..0ee0d9a3e8 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
@@ -115,14 +115,14 @@ static FX_BOOL _LoadCryptInfo(CPDF_Dictionary* pEncryptDict,
keylen = 0;
if (Version >= 4) {
CPDF_Dictionary* pCryptFilters = pEncryptDict->GetDict("CF");
- if (pCryptFilters == NULL) {
+ if (!pCryptFilters) {
return FALSE;
}
if (name == "Identity") {
cipher = FXCIPHER_NONE;
} else {
CPDF_Dictionary* pDefFilter = pCryptFilters->GetDict(name);
- if (pDefFilter == NULL) {
+ if (!pDefFilter) {
return FALSE;
}
int nKeyBits = 0;
@@ -329,7 +329,7 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(
if (FXSYS_memcmp(digest, pkey, 32) != 0) {
return FALSE;
}
- if (key == NULL) {
+ if (!key) {
return TRUE;
}
if (m_Revision >= 6) {
@@ -399,7 +399,7 @@ int CPDF_StandardSecurityHandler::CheckPassword(const uint8_t* password,
return AES256_CheckPassword(password, size, bOwner, key);
}
uint8_t keybuf[32];
- if (key == NULL) {
+ if (!key) {
key = keybuf;
}
if (bOwner) {
@@ -541,7 +541,7 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
if (!LoadDict(pEncryptDict, type, cipher, key_len)) {
return;
}
- if (bDefault && (owner_pass == NULL || owner_size == 0)) {
+ if (bDefault && (!owner_pass || owner_size == 0)) {
owner_pass = user_pass;
owner_size = user_size;
}
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp
index f61036aef6..df7b7a33cb 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp
@@ -30,7 +30,7 @@ CFDF_Document* CFDF_Document::ParseFile(IFX_FileRead* pFile, FX_BOOL bOwnFile) {
}
CFDF_Document* pDoc = new CFDF_Document;
pDoc->ParseStream(pFile, bOwnFile);
- if (pDoc->m_pRootDict == NULL) {
+ if (!pDoc->m_pRootDict) {
delete pDoc;
return NULL;
}
@@ -59,7 +59,7 @@ void CFDF_Document::ParseStream(IFX_FileRead* pFile, FX_BOOL bOwnFile) {
break;
}
CPDF_Object* pObj = parser.GetObject(this, objnum, 0, 0);
- if (pObj == NULL) {
+ if (!pObj) {
break;
}
InsertIndirectObject(objnum, pObj);
@@ -81,7 +81,7 @@ void CFDF_Document::ParseStream(IFX_FileRead* pFile, FX_BOOL bOwnFile) {
}
}
FX_BOOL CFDF_Document::WriteBuf(CFX_ByteTextBuf& buf) const {
- if (m_pRootDict == NULL) {
+ if (!m_pRootDict) {
return FALSE;
}
buf << "%FDF-1.2\r\n";
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
index 58b03c1887..c503277f87 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
@@ -582,7 +582,7 @@ FX_POSITION CPDF_Dictionary::GetStartPos() const {
}
CPDF_Object* CPDF_Dictionary::GetNextElement(FX_POSITION& pos,
CFX_ByteString& key) const {
- if (pos == NULL) {
+ if (!pos) {
return NULL;
}
CPDF_Object* p;
@@ -736,7 +736,7 @@ void CPDF_Dictionary::RemoveAt(const CFX_ByteStringC& key) {
ASSERT(m_Type == PDFOBJ_DICTIONARY);
CPDF_Object* p = NULL;
m_Map.Lookup(key, (void*&)p);
- if (p == NULL) {
+ if (!p) {
return;
}
p->Release();
@@ -747,14 +747,14 @@ void CPDF_Dictionary::ReplaceKey(const CFX_ByteStringC& oldkey,
ASSERT(m_Type == PDFOBJ_DICTIONARY);
CPDF_Object* p = NULL;
m_Map.Lookup(oldkey, (void*&)p);
- if (p == NULL) {
+ if (!p) {
return;
}
m_Map.RemoveKey(oldkey);
m_Map.SetAt(newkey, p);
}
FX_BOOL CPDF_Dictionary::Identical(CPDF_Dictionary* pOther) const {
- if (pOther == NULL) {
+ if (!pOther) {
return FALSE;
}
if (m_Map.GetCount() != pOther->m_Map.GetCount()) {
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
index fcb1c2ed86..f18b733ab7 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -273,7 +273,7 @@ FX_DWORD CPDF_Parser::StartParse(IFX_FileRead* pFileAccess,
FX_DWORD CPDF_Parser::SetEncryptHandler() {
ReleaseEncryptHandler();
SetEncryptDictionary(NULL);
- if (m_pTrailer == NULL) {
+ if (!m_pTrailer) {
return PDFPARSE_ERROR_FORMAT;
}
CPDF_Object* pEncryptObj = m_pTrailer->GetElement("Encrypt");
@@ -348,7 +348,7 @@ FX_BOOL CPDF_Parser::LoadAllCrossRefV4(FX_FILESIZE xrefpos) {
return FALSE;
}
m_pTrailer = LoadTrailerV4();
- if (m_pTrailer == NULL) {
+ if (!m_pTrailer) {
return FALSE;
}
int32_t xrefsize = GetDirectInteger(m_pTrailer, "Size");
@@ -399,7 +399,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedAllCrossRefV4(FX_FILESIZE xrefpos,
return FALSE;
}
m_pTrailer = LoadTrailerV4();
- if (m_pTrailer == NULL) {
+ if (!m_pTrailer) {
return FALSE;
}
int32_t xrefsize = GetDirectInteger(m_pTrailer, "Size");
@@ -414,7 +414,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedAllCrossRefV4(FX_FILESIZE xrefpos,
CrossRefList.InsertAt(0, xrefpos);
LoadCrossRefV4(xrefpos, 0, TRUE, FALSE);
CPDF_Dictionary* pDict = LoadTrailerV4();
- if (pDict == NULL) {
+ if (!pDict) {
return FALSE;
}
xrefpos = GetDirectInteger(pDict, "Prev");
@@ -434,7 +434,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos,
void* pResult =
FXSYS_bsearch(&pos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(),
sizeof(FX_FILESIZE), CompareFileSize);
- if (pResult == NULL) {
+ if (!pResult) {
m_SortedOffset.Add(pos);
}
FX_DWORD start_objnum = 0;
@@ -478,7 +478,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos,
void* pResult = FXSYS_bsearch(
&m_CrossRef[objnum], m_SortedOffset.GetData(),
m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), CompareFileSize);
- if (pResult == NULL) {
+ if (!pResult) {
m_SortedOffset.Add(m_CrossRef[objnum]);
}
}
@@ -778,7 +778,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() {
FXSYS_bsearch(&obj_pos, m_SortedOffset.GetData(),
m_SortedOffset.GetSize(), sizeof(FX_FILESIZE),
CompareFileSize);
- if (pResult == NULL) {
+ if (!pResult) {
m_SortedOffset.Add(obj_pos);
}
FX_FILESIZE obj_end = 0;
@@ -980,7 +980,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() {
void* pResult =
FXSYS_bsearch(&offset, m_SortedOffset.GetData(), m_SortedOffset.GetSize(),
sizeof(FX_FILESIZE), CompareFileSize);
- if (pResult == NULL) {
+ if (!pResult) {
m_SortedOffset.Add(offset);
}
FX_Free(buffer);
@@ -1043,7 +1043,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) {
arrIndex.push_back(std::make_pair(0, size));
}
pArray = pStream->GetDict()->GetArray("W");
- if (pArray == NULL) {
+ if (!pArray) {
pStream->Release();
return FALSE;
}
@@ -1100,7 +1100,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) {
void* pResult = FXSYS_bsearch(&offset, m_SortedOffset.GetData(),
m_SortedOffset.GetSize(),
sizeof(FX_FILESIZE), CompareFileSize);
- if (pResult == NULL) {
+ if (!pResult) {
m_SortedOffset.Add(offset);
}
continue;
@@ -1119,7 +1119,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) {
void* pResult = FXSYS_bsearch(&offset, m_SortedOffset.GetData(),
m_SortedOffset.GetSize(),
sizeof(FX_FILESIZE), CompareFileSize);
- if (pResult == NULL) {
+ if (!pResult) {
m_SortedOffset.Add(offset);
}
} else {
@@ -1172,7 +1172,7 @@ FX_BOOL CPDF_Parser::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) {
void* pResult =
FXSYS_bsearch(&pos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(),
sizeof(FX_FILESIZE), CompareFileSize);
- if (pResult == NULL) {
+ if (!pResult) {
return TRUE;
}
if ((FX_FILESIZE*)pResult - (FX_FILESIZE*)m_SortedOffset.GetData() ==
@@ -1261,7 +1261,7 @@ FX_FILESIZE CPDF_Parser::GetObjectSize(FX_DWORD objnum) {
void* pResult = FXSYS_bsearch(&offset, m_SortedOffset.GetData(),
m_SortedOffset.GetSize(), sizeof(FX_FILESIZE),
CompareFileSize);
- if (pResult == NULL) {
+ if (!pResult) {
return 0;
}
if ((FX_FILESIZE*)pResult - (FX_FILESIZE*)m_SortedOffset.GetData() ==
@@ -1344,7 +1344,7 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum,
void* pResult =
FXSYS_bsearch(&pos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(),
sizeof(FX_FILESIZE), CompareFileSize);
- if (pResult == NULL) {
+ if (!pResult) {
m_Syntax.RestorePos(SavedPos);
return;
}
@@ -1490,7 +1490,7 @@ FX_DWORD CPDF_Parser::GetPermissions(FX_BOOL bCheckRevision) {
return dwPermission;
}
FX_BOOL CPDF_Parser::IsOwner() {
- return m_pSecurityHandler == NULL ? TRUE : m_pSecurityHandler->IsOwner();
+ return !m_pSecurityHandler || m_pSecurityHandler->IsOwner();
}
void CPDF_Parser::SetSecurityHandler(CPDF_SecurityHandler* pSecurityHandler,
FX_BOOL bForced) {
@@ -1584,7 +1584,7 @@ FX_DWORD CPDF_Parser::StartAsynParse(IFX_FileRead* pFileAccess,
}
if (bLoadV4) {
m_pTrailer = LoadTrailerV4();
- if (m_pTrailer == NULL) {
+ if (!m_pTrailer) {
return FALSE;
}
int32_t xrefsize = GetDirectInteger(m_pTrailer, "Size");
@@ -1598,7 +1598,7 @@ FX_DWORD CPDF_Parser::StartAsynParse(IFX_FileRead* pFileAccess,
return dwRet;
}
m_pDocument->LoadAsynDoc(m_pLinearized->GetDict());
- if (m_pDocument->GetRoot() == NULL || m_pDocument->GetPageCount() == 0) {
+ if (!m_pDocument->GetRoot() || m_pDocument->GetPageCount() == 0) {
if (bXRefRebuilt) {
return PDFPARSE_ERROR_FORMAT;
}
@@ -1611,7 +1611,7 @@ FX_DWORD CPDF_Parser::StartAsynParse(IFX_FileRead* pFileAccess,
return dwRet;
}
m_pDocument->LoadAsynDoc(m_pLinearized->GetDict());
- if (m_pDocument->GetRoot() == NULL) {
+ if (!m_pDocument->GetRoot()) {
return PDFPARSE_ERROR_FORMAT;
}
}
@@ -2984,7 +2984,7 @@ void CPDF_DataAvail::SetDocument(CPDF_Document* pDoc) {
}
FX_DWORD CPDF_DataAvail::GetObjectSize(FX_DWORD objnum, FX_FILESIZE& offset) {
CPDF_Parser* pParser = (CPDF_Parser*)(m_pDocument->GetParser());
- if (pParser == NULL) {
+ if (!pParser) {
return 0;
}
if (objnum >= (FX_DWORD)pParser->m_CrossRef.GetSize()) {
@@ -3001,7 +3001,7 @@ FX_DWORD CPDF_DataAvail::GetObjectSize(FX_DWORD objnum, FX_FILESIZE& offset) {
void* pResult = FXSYS_bsearch(&offset, pParser->m_SortedOffset.GetData(),
pParser->m_SortedOffset.GetSize(),
sizeof(FX_FILESIZE), CompareFileSize);
- if (pResult == NULL) {
+ if (!pResult) {
return 0;
}
if ((FX_FILESIZE*)pResult -
@@ -3255,13 +3255,13 @@ CPDF_Object* CPDF_DataAvail::GetObject(FX_DWORD objnum,
if (pExistInFile)
*pExistInFile = TRUE;
- if (m_pDocument == NULL) {
+ if (m_pDocument) {
+ size = GetObjectSize(objnum, offset);
+ pParser = (CPDF_Parser*)(m_pDocument->GetParser());
+ } else {
size = (FX_DWORD)m_parser.GetObjectSize(objnum);
offset = m_parser.GetObjectOffset(objnum);
pParser = &m_parser;
- } else {
- size = GetObjectSize(objnum, offset);
- pParser = (CPDF_Parser*)(m_pDocument->GetParser());
}
if (!IsDataAvail(offset, size, pHints)) {
return nullptr;
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
index 121b2f4a04..6e20b582fc 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
@@ -284,7 +284,7 @@ FX_BOOL CPDF_SimpleParser::FindTagParam(const CFX_ByteStringC& token,
CFX_ByteString PDF_NameDecode(const CFX_ByteStringC& bstr) {
int size = bstr.GetLength();
const FX_CHAR* pSrc = bstr.GetCStr();
- if (FXSYS_memchr(pSrc, '#', size) == NULL) {
+ if (!FXSYS_memchr(pSrc, '#', size)) {
return bstr;
}
CFX_ByteString result;
@@ -303,7 +303,7 @@ CFX_ByteString PDF_NameDecode(const CFX_ByteStringC& bstr) {
return result;
}
CFX_ByteString PDF_NameDecode(const CFX_ByteString& orig) {
- if (FXSYS_memchr(orig.c_str(), '#', orig.GetLength()) == NULL) {
+ if (!FXSYS_memchr(orig.c_str(), '#', orig.GetLength())) {
return orig;
}
return PDF_NameDecode(CFX_ByteStringC(orig));
@@ -344,7 +344,7 @@ CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig) {
return res;
}
CFX_ByteTextBuf& operator<<(CFX_ByteTextBuf& buf, const CPDF_Object* pObj) {
- if (pObj == NULL) {
+ if (!pObj) {
buf << " null";
return buf;
}
@@ -444,12 +444,12 @@ static CPDF_Object* SearchNumberNode(CPDF_Dictionary* pNode, int num) {
return NULL;
}
CPDF_Array* pKids = pNode->GetArray("Kids");
- if (pKids == NULL) {
+ if (!pKids) {
return NULL;
}
for (FX_DWORD i = 0; i < pKids->GetCount(); i++) {
CPDF_Dictionary* pKid = pKids->GetDict(i);
- if (pKid == NULL) {
+ if (!pKid) {
continue;
}
CPDF_Object* pFound = SearchNumberNode(pKid, num);
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp
index 801f9e737c..bee188e049 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp
@@ -258,7 +258,7 @@ void CPDF_RenderStatus::RenderObjectList(const CPDF_PageObjects* pObjs,
if (!pCurObj) {
continue;
}
- if (pCurObj == NULL || pCurObj->m_Left > clip_rect.right ||
+ if (!pCurObj || pCurObj->m_Left > clip_rect.right ||
pCurObj->m_Right < clip_rect.left ||
pCurObj->m_Bottom > clip_rect.top ||
pCurObj->m_Top < clip_rect.bottom) {
@@ -358,7 +358,7 @@ FX_BOOL CPDF_RenderStatus::GetObjectClippedRect(const CPDF_PageObject* pObj,
void CPDF_RenderStatus::DitherObjectArea(const CPDF_PageObject* pObj,
const CFX_Matrix* pObj2Device) {
CFX_DIBitmap* pBitmap = m_pDevice->GetBitmap();
- if (pBitmap == NULL) {
+ if (!pBitmap) {
return;
}
FX_RECT rect;
@@ -684,7 +684,7 @@ void CPDF_RenderStatus::DrawClipPath(CPDF_ClipPath ClipPath,
int i;
for (i = 0; i < nClipPath; i++) {
const CFX_PathData* pPathData = ClipPath.GetPath(i);
- if (pPathData == NULL) {
+ if (!pPathData) {
continue;
}
CFX_GraphStateData stroke_state;
@@ -780,8 +780,8 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj,
pDocument->GetPageData()->ReleaseColorSpace(pCSObj);
}
}
- if (pSMaskDict == NULL && group_alpha == 1.0f &&
- blend_type == FXDIB_BLEND_NORMAL && !bTextClip && !bGroupTransparent) {
+ if (!pSMaskDict && group_alpha == 1.0f && blend_type == FXDIB_BLEND_NORMAL &&
+ !bTextClip && !bGroupTransparent) {
return FALSE;
}
FX_BOOL isolated = Transparency & PDFTRANS_ISOLATED;
@@ -838,7 +838,7 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj,
text_device.Attach(pTextMask.get());
for (FX_DWORD i = 0; i < pPageObj->m_ClipPath.GetTextCount(); i++) {
CPDF_TextObject* textobj = pPageObj->m_ClipPath.GetText(i);
- if (textobj == NULL) {
+ if (!textobj) {
break;
}
CFX_Matrix text_matrix;
@@ -1079,7 +1079,7 @@ void CPDF_ProgressiveRenderer::Continue(IFX_Pause* pPause) {
for (; m_LayerIndex < nLayers; m_LayerIndex++) {
_PDF_RenderItem* pItem = m_pContext->m_ContentList.GetDataPtr(m_LayerIndex);
FX_POSITION LastPos = pItem->m_pObjectList->GetLastObjectPosition();
- if (m_ObjectPos == NULL) {
+ if (!m_ObjectPos) {
if (LastPos == m_PrevLastPos) {
if (!pItem->m_pObjectList->IsParsed()) {
pItem->m_pObjectList->ContinueParse(pPause);
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp
index 7a28ddc782..babf70396b 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp
@@ -74,7 +74,7 @@ void CPDF_PageRenderCache::CacheOptimization(int32_t dwLimitCacheSize) {
}
void CPDF_PageRenderCache::ClearImageCache(CPDF_Stream* pStream) {
void* value = m_ImageCaches.GetValueAt(pStream);
- if (value == NULL) {
+ if (!value) {
m_ImageCaches.RemoveKey(pStream);
return;
}
@@ -95,7 +95,7 @@ FX_DWORD CPDF_PageRenderCache::EstimateSize() {
return dwSize;
}
FX_DWORD CPDF_PageRenderCache::GetCachedSize(CPDF_Stream* pStream) const {
- if (pStream == NULL) {
+ if (!pStream) {
return m_nCacheSize;
}
CPDF_ImageCache* pImageCache;
@@ -175,7 +175,7 @@ void CPDF_PageRenderCache::ResetBitmap(CPDF_Stream* pStream,
const CFX_DIBitmap* pBitmap) {
CPDF_ImageCache* pImageCache;
if (!m_ImageCaches.Lookup(pStream, (void*&)pImageCache)) {
- if (pBitmap == NULL) {
+ if (!pBitmap) {
return;
}
pImageCache = new CPDF_ImageCache(m_pPage->m_pDocument, pStream);
@@ -220,7 +220,7 @@ void CPDF_PageRenderCache::ClearImageData() {
}
}
void CPDF_ImageCache::ClearImageData() {
- if (m_pCachedBitmap && m_pCachedBitmap->GetBuffer() == NULL) {
+ if (m_pCachedBitmap && !m_pCachedBitmap->GetBuffer()) {
((CPDF_DIBSource*)m_pCachedBitmap)->ClearImageData();
}
}
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp
index 938a495eb1..d3390517e9 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp
@@ -29,7 +29,7 @@ void CPDF_RenderStatus::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap,
int bitmap_alpha,
int blend_mode,
int Transparency) {
- if (pDIBitmap == NULL) {
+ if (!pDIBitmap) {
return;
}
FX_BOOL bIsolated = Transparency & PDFTRANS_ISOLATED;
@@ -353,7 +353,7 @@ FX_BOOL CPDF_ImageRenderer::StartLoadDIBSource() {
return FALSE;
}
FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource() {
- if (m_Loader.m_pBitmap == NULL) {
+ if (!m_Loader.m_pBitmap) {
return FALSE;
}
m_BitmapAlpha = 255;
@@ -363,7 +363,7 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource() {
}
m_pDIBSource = m_Loader.m_pBitmap;
if (m_pRenderStatus->m_Options.m_ColorMode == RENDER_COLOR_ALPHA &&
- m_Loader.m_pMask == NULL) {
+ !m_Loader.m_pMask) {
return StartBitmapAlpha();
}
if (pGeneralState && pGeneralState->m_pTR) {
@@ -844,7 +844,7 @@ FX_BOOL CPDF_ImageRenderer::Continue(IFX_Pause* pPause) {
return TRUE;
}
CFX_DIBitmap* pBitmap = m_pTransformer->m_Storer.Detach();
- if (pBitmap == NULL) {
+ if (!pBitmap) {
return FALSE;
}
if (pBitmap->IsAlphaMask()) {
@@ -934,11 +934,11 @@ FX_BOOL CPDF_QuickStretcher::Start(CPDF_ImageObject* pImageObj,
m_pCS = NULL;
m_Bpp = 3;
CPDF_Object* pCSObj = pDict->GetElementValue("ColorSpace");
- if (pCSObj == NULL) {
+ if (!pCSObj) {
return FALSE;
}
m_pCS = CPDF_ColorSpace::Load(pImageObj->m_pImage->GetDocument(), pCSObj);
- if (m_pCS == NULL) {
+ if (!m_pCS) {
return FALSE;
}
if (!_IsSupported(m_pCS)) {
@@ -995,12 +995,12 @@ FX_BOOL CPDF_QuickStretcher::Continue(IFX_Pause* pPause) {
const uint8_t* src_scan;
if (m_pDecoder) {
src_scan = m_pDecoder->GetScanline(src_y);
- if (src_scan == NULL) {
+ if (!src_scan) {
break;
}
} else {
src_scan = m_StreamAcc.GetData();
- if (src_scan == NULL) {
+ if (!src_scan) {
break;
}
src_scan += src_y * src_pitch;
@@ -1011,7 +1011,7 @@ FX_BOOL CPDF_QuickStretcher::Continue(IFX_Pause* pPause) {
int src_x = (m_bFlipX ? (m_DestWidth - dest_x - 1) : dest_x) * src_width /
m_DestWidth;
const uint8_t* src_pixel = src_scan + src_x * m_Bpp;
- if (m_pCS == NULL) {
+ if (!m_pCS) {
*result_scan = src_pixel[2];
result_scan++;
*result_scan = src_pixel[1];
@@ -1040,7 +1040,7 @@ FX_BOOL CPDF_QuickStretcher::Continue(IFX_Pause* pPause) {
CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict,
FX_RECT* pClipRect,
const CFX_Matrix* pMatrix) {
- if (pSMaskDict == NULL) {
+ if (!pSMaskDict) {
return NULL;
}
int width = pClipRect->right - pClipRect->left;
@@ -1048,7 +1048,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict,
FX_BOOL bLuminosity = FALSE;
bLuminosity = pSMaskDict->GetConstString("S") != "Alpha";
CPDF_Stream* pGroup = pSMaskDict->GetStream("G");
- if (pGroup == NULL) {
+ if (!pGroup) {
return NULL;
}
nonstd::unique_ptr<CPDF_Function> pFunc;
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
index 521ec16be1..7b34c5721a 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
@@ -212,12 +212,12 @@ FX_BOOL CPDF_DIBSource::Load(CPDF_Document* pDoc,
FX_BOOL bStdCS,
FX_DWORD GroupFamily,
FX_BOOL bLoadMask) {
- if (pStream == NULL) {
+ if (!pStream) {
return FALSE;
}
m_pDocument = pDoc;
m_pDict = pStream->GetDict();
- if (m_pDict == NULL) {
+ if (!m_pDict) {
return FALSE;
}
m_pStream = pStream;
@@ -243,7 +243,7 @@ FX_BOOL CPDF_DIBSource::Load(CPDF_Document* pDoc,
}
m_pStreamAcc = new CPDF_StreamAcc;
m_pStreamAcc->LoadAllData(pStream, FALSE, src_size.ValueOrDie(), TRUE);
- if (m_pStreamAcc->GetSize() == 0 || m_pStreamAcc->GetData() == NULL) {
+ if (m_pStreamAcc->GetSize() == 0 || !m_pStreamAcc->GetData()) {
return FALSE;
}
if (!CreateDecoder()) {
@@ -333,7 +333,7 @@ int CPDF_DIBSource::StartLoadDIBSource(CPDF_Document* pDoc,
FX_BOOL bStdCS,
FX_DWORD GroupFamily,
FX_BOOL bLoadMask) {
- if (pStream == NULL) {
+ if (!pStream) {
return 0;
}
m_pDocument = pDoc;
@@ -363,7 +363,7 @@ int CPDF_DIBSource::StartLoadDIBSource(CPDF_Document* pDoc,
}
m_pStreamAcc = new CPDF_StreamAcc;
m_pStreamAcc->LoadAllData(pStream, FALSE, src_size.ValueOrDie(), TRUE);
- if (m_pStreamAcc->GetSize() == 0 || m_pStreamAcc->GetData() == NULL) {
+ if (m_pStreamAcc->GetSize() == 0 || !m_pStreamAcc->GetData()) {
return 0;
}
int ret = CreateDecoder();
@@ -401,7 +401,7 @@ int CPDF_DIBSource::ContinueLoadDIBSource(IFX_Pause* pPause) {
return 0;
}
ICodec_Jbig2Module* pJbig2Module = CPDF_ModuleMgr::Get()->GetJbig2Module();
- if (m_pJbig2Context == NULL) {
+ if (!m_pJbig2Context) {
m_pJbig2Context = pJbig2Module->CreateJbig2Context();
if (m_pStreamAcc->GetImageParam()) {
CPDF_Stream* pGlobals =
@@ -531,7 +531,7 @@ bool CPDF_DIBSource::LoadColorInfo(const CPDF_Dictionary* pFormResources,
DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode,
FX_BOOL& bColorKey) {
- if (m_pColorSpace == NULL) {
+ if (!m_pColorSpace) {
return NULL;
}
DIB_COMP_DATA* pCompData = FX_Alloc(DIB_COMP_DATA, m_nComponents);
@@ -565,7 +565,7 @@ DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode,
}
if (!m_pDict->KeyExist("SMask")) {
CPDF_Object* pMask = m_pDict->GetElementValue("Mask");
- if (pMask == NULL) {
+ if (!pMask) {
return pCompData;
}
if (CPDF_Array* pArray = pMask->AsArray()) {
@@ -628,7 +628,7 @@ int CPDF_DIBSource::CreateDecoder() {
return 0;
}
m_pCompData = GetDecodeAndMaskArray(m_bDefaultDecode, m_bColorKey);
- if (m_pCompData == NULL) {
+ if (!m_pCompData) {
return 0;
}
}
@@ -807,7 +807,7 @@ int CPDF_DIBSource::StratLoadMask() {
return m_pMaskStream ? StartLoadMaskDIB() : 1;
}
int CPDF_DIBSource::ContinueLoadMaskDIB(IFX_Pause* pPause) {
- if (m_pMask == NULL) {
+ if (!m_pMask) {
return 1;
}
int ret = m_pMask->ContinueLoadDIBSource(pPause);
@@ -860,7 +860,7 @@ void CPDF_DIBSource::LoadPalette() {
if (m_bpc * m_nComponents > 8) {
return;
}
- if (m_pColorSpace == NULL) {
+ if (!m_pColorSpace) {
return;
}
if (m_bpc * m_nComponents == 1) {
@@ -1606,7 +1606,7 @@ FX_BOOL CPDF_ImageLoader::Load(const CPDF_ImageObject* pImage,
FX_DWORD GroupFamily,
FX_BOOL bLoadMask,
CPDF_RenderStatus* pRenderStatus) {
- if (pImage == NULL) {
+ if (!pImage) {
return FALSE;
}
if (pCache) {
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
index 8b6c0d1fd1..9076b7ba20 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
@@ -21,7 +21,7 @@ static void DrawAxialShading(CFX_DIBitmap* pBitmap,
int alpha) {
ASSERT(pBitmap->GetFormat() == FXDIB_Argb);
CPDF_Array* pCoords = pDict->GetArray("Coords");
- if (pCoords == NULL) {
+ if (!pCoords) {
return;
}
FX_FLOAT start_x = pCoords->GetNumber(0);
@@ -112,7 +112,7 @@ static void DrawRadialShading(CFX_DIBitmap* pBitmap,
int alpha) {
ASSERT(pBitmap->GetFormat() == FXDIB_Argb);
CPDF_Array* pCoords = pDict->GetArray("Coords");
- if (pCoords == NULL) {
+ if (!pCoords) {
return;
}
FX_FLOAT start_x = pCoords->GetNumber(0);
@@ -834,7 +834,7 @@ void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern,
int nFuncs = pPattern->m_nFuncs;
CPDF_Dictionary* pDict = pPattern->m_pShadingObj->GetDict();
CPDF_ColorSpace* pColorSpace = pPattern->m_pCS;
- if (pColorSpace == NULL) {
+ if (!pColorSpace) {
return;
}
FX_ARGB background = 0;
@@ -864,7 +864,7 @@ void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern,
CFX_Matrix FinalMatrix = *pMatrix;
FinalMatrix.Concat(*buffer.GetMatrix());
CFX_DIBitmap* pBitmap = buffer.GetBitmap();
- if (pBitmap->GetBuffer() == NULL) {
+ if (!pBitmap->GetBuffer()) {
return;
}
pBitmap->Clear(background);
@@ -1121,7 +1121,7 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern,
m_pContext->m_pDocument, m_pContext->m_pPageCache, pPattern,
pObj2Device, width, height, m_Options.m_Flags);
}
- if (pPatternBitmap == NULL) {
+ if (!pPatternBitmap) {
m_pDevice->RestoreState();
return;
}
@@ -1185,7 +1185,7 @@ void CPDF_RenderStatus::DrawPathWithPattern(CPDF_PathObject* pPathObj,
CPDF_Color* pColor,
FX_BOOL bStroke) {
CPDF_Pattern* pattern = pColor->GetPattern();
- if (pattern == NULL) {
+ if (!pattern) {
return;
}
if (pattern->m_PatternType == PATTERN_TILING) {
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp
index 774e749322..05a5e040e3 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp
@@ -163,11 +163,11 @@ CFX_GlyphBitmap* CPDF_Type3Cache::RenderGlyph(CPDF_Type3Glyphs* pSize,
} else {
}
}
- if (pResBitmap == NULL) {
+ if (!pResBitmap) {
image_matrix.Scale(retinaScaleX, retinaScaleY);
pResBitmap = pBitmap->TransformTo(&image_matrix, left, top);
}
- if (pResBitmap == NULL) {
+ if (!pResBitmap) {
return NULL;
}
CFX_GlyphBitmap* pGlyph = new CFX_GlyphBitmap;
@@ -212,7 +212,7 @@ FX_BOOL CPDF_RenderStatus::ProcessText(const CPDF_TextObject* textobj,
break;
case 1:
case 5:
- if (pFont->GetFace() == NULL &&
+ if (!pFont->GetFace() &&
!(pFont->GetSubstFont()->m_SubstFlags & FXFONT_SUBST_GLYPHPATH)) {
bFill = TRUE;
} else {
@@ -221,7 +221,7 @@ FX_BOOL CPDF_RenderStatus::ProcessText(const CPDF_TextObject* textobj,
break;
case 2:
case 6:
- if (pFont->GetFace() == NULL &&
+ if (!pFont->GetFace() &&
!(pFont->GetSubstFont()->m_SubstFlags & FXFONT_SUBST_GLYPHPATH)) {
bFill = TRUE;
} else {
@@ -299,21 +299,21 @@ FX_BOOL CPDF_RenderStatus::ProcessText(const CPDF_TextObject* textobj,
pFont, font_size, &text_matrix, fill_argb, &m_Options);
}
CPDF_Type3Cache* CPDF_RenderStatus::GetCachedType3(CPDF_Type3Font* pFont) {
- if (pFont->m_pDocument == NULL) {
+ if (!pFont->m_pDocument) {
return NULL;
}
pFont->m_pDocument->GetPageData()->GetFont(pFont->GetFontDict(), FALSE);
return pFont->m_pDocument->GetRenderData()->GetCachedType3(pFont);
}
static void ReleaseCachedType3(CPDF_Type3Font* pFont) {
- if (pFont->m_pDocument == NULL) {
+ if (!pFont->m_pDocument) {
return;
}
pFont->m_pDocument->GetRenderData()->ReleaseCachedType3(pFont);
pFont->m_pDocument->GetPageData()->ReleaseFont(pFont->GetFontDict());
}
FX_BOOL CPDF_Type3Char::LoadBitmap(CPDF_RenderContext* pContext) {
- if (m_pBitmap || m_pForm == NULL) {
+ if (m_pBitmap || !m_pForm) {
return TRUE;
}
if (m_pForm->CountObjects() == 1 && !m_bColored) {
@@ -383,7 +383,7 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(const CPDF_TextObject* textobj,
continue;
}
CPDF_Type3Char* pType3Char = pType3Font->LoadChar(charcode);
- if (pType3Char == NULL) {
+ if (!pType3Char) {
continue;
}
CFX_Matrix matrix = char_matrix;
@@ -394,7 +394,7 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(const CPDF_TextObject* textobj,
if (pGlyphAndPos) {
for (int i = 0; i < iChar; i++) {
FXTEXT_GLYPHPOS& glyph = pGlyphAndPos[i];
- if (glyph.m_pGlyph == NULL) {
+ if (!glyph.m_pGlyph) {
continue;
}
m_pDevice->SetBitMask(&glyph.m_pGlyph->m_Bitmap,
@@ -452,7 +452,7 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(const CPDF_TextObject* textobj,
CPDF_Type3Cache* pCache = GetCachedType3(pType3Font);
refTypeCache.m_dwCount++;
CFX_GlyphBitmap* pBitmap = pCache->LoadGlyph(charcode, &matrix, sa, sd);
- if (pBitmap == NULL) {
+ if (!pBitmap) {
continue;
}
int origin_x = FXSYS_round(matrix.e);
@@ -491,7 +491,7 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(const CPDF_TextObject* textobj,
bitmap.Clear(0);
for (int iChar = 0; iChar < textobj->m_nChars; iChar++) {
FXTEXT_GLYPHPOS& glyph = pGlyphAndPos[iChar];
- if (glyph.m_pGlyph == NULL) {
+ if (!glyph.m_pGlyph) {
continue;
}
bitmap.TransferBitmap(
@@ -557,7 +557,7 @@ void CPDF_CharPosList::Load(int nChars,
charpos.m_OriginX = iChar ? pCharPos[iChar - 1] : 0;
charpos.m_OriginY = 0;
charpos.m_bGlyphAdjust = FALSE;
- if (pCIDFont == NULL) {
+ if (!pCIDFont) {
continue;
}
FX_WORD CID = pCIDFont->CIDFromCharCode(CharCode);
@@ -762,7 +762,7 @@ void CPDF_RenderStatus::DrawTextPathWithPattern(const CPDF_TextObject* textobj,
FXTEXT_CHARPOS& charpos = CharPosList.m_pCharPos[i];
const CFX_PathData* pPath = pFaceCache->LoadGlyphPath(
&pFont->m_Font, charpos.m_GlyphIndex, charpos.m_FontCharWidth);
- if (pPath == NULL) {
+ if (!pPath) {
continue;
}
CPDF_PathObject path;