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

Unified Diff: core/src/fpdfdoc/doc_basic.cpp

Issue 1520063002: Get rid of most instance of 'foo == NULL' (Closed) Base URL: https://pdfium.googlesource.com/pdfium@bstr_isnull
Patch Set: rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/src/fpdfdoc/doc_ap.cpp ('k') | core/src/fpdfdoc/doc_form.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdfdoc/doc_basic.cpp
diff --git a/core/src/fpdfdoc/doc_basic.cpp b/core/src/fpdfdoc/doc_basic.cpp
index c58e10b779deaecd1638368b877c1269cf21bb16..d976650ae01676e86fa4935a20e3db9624b08849 100644
--- a/core/src/fpdfdoc/doc_basic.cpp
+++ b/core/src/fpdfdoc/doc_basic.cpp
@@ -112,12 +112,12 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
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 =
@@ -151,12 +151,12 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
return pNames->GetElementValue((nIndex - nCurIndex) * 2 + 1);
}
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 =
@@ -176,13 +176,13 @@ static int CountNames(CPDF_Dictionary* pNode, int nLevel = 0) {
return pNames->GetCount() / 2;
}
CPDF_Array* pKids = pNode->GetArray("Kids");
- if (pKids == NULL) {
+ if (!pKids) {
return 0;
}
int nCount = 0;
for (FX_DWORD i = 0; i < pKids->GetCount(); i++) {
CPDF_Dictionary* pKid = pKids->GetDict(i);
- if (pKid == NULL) {
+ if (!pKid) {
continue;
}
nCount += CountNames(pKid, nLevel + 1);
@@ -190,31 +190,31 @@ static int CountNames(CPDF_Dictionary* pNode, int nLevel = 0) {
return nCount;
}
int CPDF_NameTree::GetCount() const {
- if (m_pRoot == NULL) {
+ if (!m_pRoot) {
return 0;
}
return ::CountNames(m_pRoot);
}
int CPDF_NameTree::GetIndex(const CFX_ByteString& csName) const {
- if (m_pRoot == NULL) {
+ if (!m_pRoot) {
return -1;
}
int nIndex = 0;
- if (SearchNameNode(m_pRoot, csName, nIndex, NULL) == NULL) {
+ if (!SearchNameNode(m_pRoot, csName, nIndex, NULL)) {
return -1;
}
return nIndex;
}
CPDF_Object* CPDF_NameTree::LookupValue(int nIndex,
CFX_ByteString& csName) const {
- if (m_pRoot == NULL) {
+ if (!m_pRoot) {
return NULL;
}
int nCurIndex = 0;
return SearchNameNode(m_pRoot, nIndex, nCurIndex, csName, NULL);
}
CPDF_Object* CPDF_NameTree::LookupValue(const CFX_ByteString& csName) const {
- if (m_pRoot == NULL) {
+ if (!m_pRoot) {
return NULL;
}
int nIndex = 0;
@@ -468,11 +468,11 @@ static CFX_WideString _GetLabelNumPortion(int num,
}
CFX_WideString CPDF_PageLabel::GetLabel(int nPage) const {
CFX_WideString wsLabel;
- if (m_pDocument == NULL) {
+ if (!m_pDocument) {
return wsLabel;
}
CPDF_Dictionary* pPDFRoot = m_pDocument->GetRoot();
- if (pPDFRoot == NULL) {
+ if (!pPDFRoot) {
return wsLabel;
}
CPDF_Dictionary* pLabels = pPDFRoot->GetDict("PageLabels");
@@ -504,11 +504,11 @@ CFX_WideString CPDF_PageLabel::GetLabel(int nPage) const {
return wsLabel;
}
int32_t CPDF_PageLabel::GetPageByLabel(const CFX_ByteStringC& bsLabel) const {
- if (m_pDocument == NULL) {
+ if (!m_pDocument) {
return -1;
}
CPDF_Dictionary* pPDFRoot = m_pDocument->GetRoot();
- if (pPDFRoot == NULL) {
+ if (!pPDFRoot) {
return -1;
}
int nPages = m_pDocument->GetPageCount();
« no previous file with comments | « core/src/fpdfdoc/doc_ap.cpp ('k') | core/src/fpdfdoc/doc_form.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698