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

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

Issue 1410673005: Add type cast definitions for CPDF_Number. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 2 months 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
Index: core/src/fpdfdoc/doc_tagged.cpp
diff --git a/core/src/fpdfdoc/doc_tagged.cpp b/core/src/fpdfdoc/doc_tagged.cpp
index fb3a05d59fbb1545845af5bcdae8d9f0aeb2be9f..871d04a8250a601bae6ea73e4ebdcae6fb1fa5ae 100644
--- a/core/src/fpdfdoc/doc_tagged.cpp
+++ b/core/src/fpdfdoc/doc_tagged.cpp
@@ -254,10 +254,10 @@ void CPDF_StructElementImpl::LoadKid(FX_DWORD PageObjNum,
CPDF_Object* pKidObj,
CPDF_StructKid* pKid) {
pKid->m_Type = CPDF_StructKid::Invalid;
- if (pKidObj == NULL) {
+ if (!pKidObj)
return;
- }
- if (pKidObj->GetType() == PDFOBJ_NUMBER) {
+
+ if (pKidObj->IsNumber()) {
if (m_pTree->m_pPage && m_pTree->m_pPage->GetObjNum() != PageObjNum) {
return;
}
@@ -266,6 +266,7 @@ void CPDF_StructElementImpl::LoadKid(FX_DWORD PageObjNum,
pKid->m_PageContent.m_PageObjNum = PageObjNum;
return;
}
+
CPDF_Dictionary* pKidDict = pKidObj->AsDictionary();
if (!pKidDict)
return;
@@ -441,9 +442,8 @@ FX_FLOAT CPDF_StructElementImpl::GetNumber(const CFX_ByteStringC& owner,
FX_BOOL bInheritable,
int subindex) {
CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex);
- if (pAttr == NULL || pAttr->GetType() != PDFOBJ_NUMBER) {
+ if (!ToNumber(pAttr))
return default_value;
- }
return pAttr->GetNumber();
}
int CPDF_StructElementImpl::GetInteger(const CFX_ByteStringC& owner,
@@ -452,8 +452,7 @@ int CPDF_StructElementImpl::GetInteger(const CFX_ByteStringC& owner,
FX_BOOL bInheritable,
int subindex) {
CPDF_Object* pAttr = GetAttr(owner, name, bInheritable, subindex);
- if (pAttr == NULL || pAttr->GetType() != PDFOBJ_NUMBER) {
+ if (!ToNumber(pAttr))
Lei Zhang 2015/10/21 14:45:50 another opportunity for ternary operator
dsinclair 2015/10/21 15:00:11 Done.
return default_value;
- }
return pAttr->GetInteger();
}

Powered by Google App Engine
This is Rietveld 408576698