diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2015-10-20 16:24:45 -0400 |
---|---|---|
committer | Dan Sinclair <dsinclair@chromium.org> | 2015-10-20 16:24:45 -0400 |
commit | f1251c1ff2b3452854681d0648b4c1ca4180ff0d (patch) | |
tree | dbcff41b8f8a5ea3d1d5280ff0c946b9647c301a /core/src/fpdfdoc/doc_tagged.cpp | |
parent | 49f88b708d905b052bc00769ac7cb48202cac019 (diff) | |
download | pdfium-f1251c1ff2b3452854681d0648b4c1ca4180ff0d.tar.xz |
[Merge to XFA] Revert "Revert "Add type cast definitions for CPDF_Dictionary.""
This reverts commit 937840e1722d1f2b77d80575d6e710d760662c9c.
Add type cast definitions for CPDF_Dictionary.
This CL adds ToCPDFDictionary type definitions and updates one file to use
instead of straight casts. I had to fix two places where we'd casted off the
constness of the original pointer.
BUG=pdfium:201
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1420583003 .
(cherry picked from commit 39869b641511c882d78e17548293cdb458c36f38)
Review URL: https://codereview.chromium.org/1410343003 .
Diffstat (limited to 'core/src/fpdfdoc/doc_tagged.cpp')
-rw-r--r-- | core/src/fpdfdoc/doc_tagged.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/core/src/fpdfdoc/doc_tagged.cpp b/core/src/fpdfdoc/doc_tagged.cpp index facad46886..fb3a05d59f 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) { |