summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_parser
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-12-14 18:34:00 -0800
committerLei Zhang <thestig@chromium.org>2015-12-14 18:34:00 -0800
commit412e908082a361d0fd9591eab939e96a882212f1 (patch)
tree11726052ae08f13dc5a05a82cbce870758580aeb /core/src/fpdfapi/fpdf_parser
parent96660d6f382204339d6b1aadc3913303d436e252 (diff)
downloadpdfium-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 'core/src/fpdfapi/fpdf_parser')
-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
7 files changed, 60 insertions, 63 deletions
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);