summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/doc_basic.cpp
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-06-07 10:46:22 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-07 10:46:23 -0700
commit4997b22f84307521a62838f874928bf56cd3423c (patch)
treead11d99ac0a491ee222e9d0a42ec3b6ad3354e2a /core/fpdfdoc/doc_basic.cpp
parent0687e76dc259c678b3f29a6608331f07ffd8f1e2 (diff)
downloadpdfium-4997b22f84307521a62838f874928bf56cd3423c.tar.xz
Get rid of NULLs in core/
Review-Url: https://codereview.chromium.org/2032613003
Diffstat (limited to 'core/fpdfdoc/doc_basic.cpp')
-rw-r--r--core/fpdfdoc/doc_basic.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/core/fpdfdoc/doc_basic.cpp b/core/fpdfdoc/doc_basic.cpp
index ab99cff772..72f2985cef 100644
--- a/core/fpdfdoc/doc_basic.cpp
+++ b/core/fpdfdoc/doc_basic.cpp
@@ -92,7 +92,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
CPDF_Array** ppFind,
int nLevel = 0) {
if (nLevel > nMaxRecursion) {
- return NULL;
+ return nullptr;
}
CPDF_Array* pLimits = pNode->GetArrayBy("Limits");
if (pLimits) {
@@ -105,7 +105,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
}
if (csName.Compare(csLeft.AsStringC()) < 0 ||
csName.Compare(csRight.AsStringC()) > 0) {
- return NULL;
+ return nullptr;
}
}
CPDF_Array* pNames = pNode->GetArrayBy("Names");
@@ -128,11 +128,11 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
return pNames->GetDirectObjectAt(i * 2 + 1);
}
nIndex += dwCount;
- return NULL;
+ return nullptr;
}
CPDF_Array* pKids = pNode->GetArrayBy("Kids");
if (!pKids) {
- return NULL;
+ return nullptr;
}
for (size_t i = 0; i < pKids->GetCount(); i++) {
CPDF_Dictionary* pKid = pKids->GetDictAt(i);
@@ -145,7 +145,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
return pFound;
}
}
- return NULL;
+ return nullptr;
}
static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
@@ -155,14 +155,14 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
CPDF_Array** ppFind,
int nLevel = 0) {
if (nLevel > nMaxRecursion)
- return NULL;
+ return nullptr;
CPDF_Array* pNames = pNode->GetArrayBy("Names");
if (pNames) {
size_t nCount = pNames->GetCount() / 2;
if (nIndex >= nCurIndex + nCount) {
nCurIndex += nCount;
- return NULL;
+ return nullptr;
}
if (ppFind)
*ppFind = pNames;
@@ -171,7 +171,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
}
CPDF_Array* pKids = pNode->GetArrayBy("Kids");
if (!pKids)
- return NULL;
+ return nullptr;
for (size_t i = 0; i < pKids->GetCount(); i++) {
CPDF_Dictionary* pKid = pKids->GetDictAt(i);
if (!pKid)
@@ -181,7 +181,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
if (pFound)
return pFound;
}
- return NULL;
+ return nullptr;
}
static size_t CountNames(CPDF_Dictionary* pNode, int nLevel = 0) {
@@ -219,7 +219,7 @@ int CPDF_NameTree::GetIndex(const CFX_ByteString& csName) const {
return -1;
}
size_t nIndex = 0;
- if (!SearchNameNode(m_pRoot, csName, nIndex, NULL)) {
+ if (!SearchNameNode(m_pRoot, csName, nIndex, nullptr)) {
return -1;
}
return nIndex;
@@ -227,17 +227,17 @@ int CPDF_NameTree::GetIndex(const CFX_ByteString& csName) const {
CPDF_Object* CPDF_NameTree::LookupValue(int nIndex,
CFX_ByteString& csName) const {
if (!m_pRoot) {
- return NULL;
+ return nullptr;
}
size_t nCurIndex = 0;
- return SearchNameNode(m_pRoot, nIndex, nCurIndex, csName, NULL);
+ return SearchNameNode(m_pRoot, nIndex, nCurIndex, csName, nullptr);
}
CPDF_Object* CPDF_NameTree::LookupValue(const CFX_ByteString& csName) const {
if (!m_pRoot) {
- return NULL;
+ return nullptr;
}
size_t nIndex = 0;
- return SearchNameNode(m_pRoot, csName, nIndex, NULL);
+ return SearchNameNode(m_pRoot, csName, nIndex, nullptr);
}
CPDF_Array* CPDF_NameTree::LookupNamedDest(CPDF_Document* pDoc,
const CFX_ByteString& sName) {
@@ -474,7 +474,7 @@ CFX_WideString CPDF_PageLabel::GetLabel(int nPage) const {
}
CPDF_Dictionary* pLabels = pPDFRoot->GetDictBy("PageLabels");
CPDF_NumberTree numberTree(pLabels);
- CPDF_Object* pValue = NULL;
+ CPDF_Object* pValue = nullptr;
int n = nPage;
while (n >= 0) {
pValue = numberTree.LookupValue(n);
@@ -489,7 +489,7 @@ CFX_WideString CPDF_PageLabel::GetLabel(int nPage) const {
if (pLabel->KeyExist("P")) {
wsLabel += pLabel->GetUnicodeTextBy("P");
}
- CFX_ByteString bsNumberingStyle = pLabel->GetStringBy("S", nullptr);
+ CFX_ByteString bsNumberingStyle = pLabel->GetStringBy("S", "");
int nLabelNum = nPage - n + pLabel->GetIntegerBy("St", 1);
CFX_WideString wsNumPortion =
_GetLabelNumPortion(nLabelNum, bsNumberingStyle);