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

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

Issue 1420583003: Revert "Revert "Add type cast definitions for CPDF_Dictionary."" (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
« no previous file with comments | « core/src/fpdfdoc/doc_ocg.cpp ('k') | core/src/fpdfdoc/doc_utils.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdfdoc/doc_tagged.cpp
diff --git a/core/src/fpdfdoc/doc_tagged.cpp b/core/src/fpdfdoc/doc_tagged.cpp
index facad468867701d33a26b3f66a63d82e633f2155..fb3a05d59fbb1545845af5bcdae8d9f0aeb2be9f 100644
--- a/core/src/fpdfdoc/doc_tagged.cpp
+++ b/core/src/fpdfdoc/doc_tagged.cpp
@@ -54,9 +54,9 @@ void CPDF_StructTreeImpl::LoadDocTree() {
if (pKids == NULL) {
return;
}
- if (pKids->GetType() == PDFOBJ_DICTIONARY) {
+ if (CPDF_Dictionary* pDict = pKids->AsDictionary()) {
CPDF_StructElementImpl* pStructElementImpl =
- new CPDF_StructElementImpl(this, NULL, (CPDF_Dictionary*)pKids);
+ new CPDF_StructElementImpl(this, NULL, pDict);
m_Kids.Add(pStructElementImpl);
return;
}
@@ -81,7 +81,7 @@ void CPDF_StructTreeImpl::LoadPageTree(const CPDF_Dictionary* pPageDict) {
return;
}
FX_DWORD dwKids = 0;
- if (pKids->GetType() == PDFOBJ_DICTIONARY) {
+ if (pKids->IsDictionary()) {
dwKids = 1;
} else if (pKids->GetType() == PDFOBJ_ARRAY) {
dwKids = ((CPDF_Array*)pKids)->GetCount();
@@ -161,7 +161,7 @@ FX_BOOL CPDF_StructTreeImpl::AddTopLevelNode(CPDF_Dictionary* pDict,
if (!pObj) {
return FALSE;
}
- if (pObj->GetType() == PDFOBJ_DICTIONARY) {
+ if (pObj->IsDictionary()) {
if (pObj->GetObjNum() == pDict->GetObjNum()) {
if (m_Kids[0]) {
m_Kids[0]->Release();
@@ -266,10 +266,10 @@ void CPDF_StructElementImpl::LoadKid(FX_DWORD PageObjNum,
pKid->m_PageContent.m_PageObjNum = PageObjNum;
return;
}
- if (pKidObj->GetType() != PDFOBJ_DICTIONARY) {
+ CPDF_Dictionary* pKidDict = pKidObj->AsDictionary();
+ if (!pKidDict)
return;
- }
- CPDF_Dictionary* pKidDict = (CPDF_Dictionary*)pKidObj;
+
CPDF_Object* pPageObj = pKidDict->GetElement(FX_BSTRC("Pg"));
if (pPageObj && pPageObj->GetType() == PDFOBJ_REFERENCE) {
PageObjNum = ((CPDF_Reference*)pPageObj)->GetRefObjNum();
@@ -322,8 +322,8 @@ static CPDF_Dictionary* FindAttrDict(CPDF_Object* pAttrs,
return NULL;
}
CPDF_Dictionary* pDict = NULL;
- if (pAttrs->GetType() == PDFOBJ_DICTIONARY) {
- pDict = (CPDF_Dictionary*)pAttrs;
+ if (pAttrs->IsDictionary()) {
+ pDict = pAttrs->AsDictionary();
} else if (pAttrs->GetType() == PDFOBJ_STREAM) {
pDict = ((CPDF_Stream*)pAttrs)->GetDict();
} else if (pAttrs->GetType() == PDFOBJ_ARRAY) {
« no previous file with comments | « core/src/fpdfdoc/doc_ocg.cpp ('k') | core/src/fpdfdoc/doc_utils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698