diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2015-10-20 13:30:34 -0400 |
---|---|---|
committer | Dan Sinclair <dsinclair@chromium.org> | 2015-10-20 13:30:34 -0400 |
commit | 937840e1722d1f2b77d80575d6e710d760662c9c (patch) | |
tree | ff065615d6d91abe8e5c788da3a08386fc2d25d6 /core/src/fpdfdoc/doc_action.cpp | |
parent | c29bee029cd5fe3f8a4ceb580235ac2d0e5ce8fd (diff) | |
download | pdfium-937840e1722d1f2b77d80575d6e710d760662c9c.tar.xz |
Revert "Add type cast definitions for CPDF_Dictionary."
This reverts commit 4816432671eef6467354aa252f22bb80acc315b7.
Reason, broke the javascript_test Rendering PDF file
/mnt/data/b/build/slave/linux/build/pdfium/out/Debug/gen/pdfium/testing/javascript/document_methods.pdf.
Non-linearized path...
FAILURE: document_methods.in; Command
'['/mnt/data/b/build/slave/linux/build/pdfium/out/Debug/pdfium_test',
'/mnt/data/b/build/slave/linux/build/pdfium/out/Debug/gen/pdfium/testing/javascript/document_methods.pdf']'
returned non-zero exit status -11
BUG=pdfium:201
TBR=thestig@chromium.org
Review URL: https://codereview.chromium.org/1412413002 .
Diffstat (limited to 'core/src/fpdfdoc/doc_action.cpp')
-rw-r--r-- | core/src/fpdfdoc/doc_action.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/core/src/fpdfdoc/doc_action.cpp b/core/src/fpdfdoc/doc_action.cpp index 409d050484..759a06c656 100644 --- a/core/src/fpdfdoc/doc_action.cpp +++ b/core/src/fpdfdoc/doc_action.cpp @@ -251,10 +251,13 @@ CPDF_Action CPDF_Action::GetSubAction(FX_DWORD iIndex) const { return CPDF_Action(); } CPDF_Object* pNext = m_pDict->GetElementValue("Next"); - if (CPDF_Dictionary* pDict = ToDictionary(pNext)) { - if (iIndex == 0) + int iObjType = pNext->GetType(); + if (iObjType == PDFOBJ_DICTIONARY) { + CPDF_Dictionary* pDict = static_cast<CPDF_Dictionary*>(pNext); + if (iIndex == 0) { return CPDF_Action(pDict); - } else if (pNext->GetType() == PDFOBJ_ARRAY) { + } + } else if (iObjType == PDFOBJ_ARRAY) { CPDF_Array* pArray = static_cast<CPDF_Array*>(pNext); return CPDF_Action(pArray->GetDict(iIndex)); } @@ -292,10 +295,9 @@ CPDF_Action CPDF_AAction::GetNextAction(FX_POSITION& pos, return CPDF_Action(); } CPDF_Object* pDirect = pObj->GetDirect(); - CPDF_Dictionary* pDict = ToDictionary(pDirect); - if (!pDict) + if (!pDirect || pDirect->GetType() != PDFOBJ_DICTIONARY) { return CPDF_Action(); - + } int i = 0; while (g_sAATypes[i][0] != '\0') { if (csKey == g_sAATypes[i]) { @@ -304,7 +306,7 @@ CPDF_Action CPDF_AAction::GetNextAction(FX_POSITION& pos, i++; } eType = (AActionType)i; - return CPDF_Action(pDict); + return CPDF_Action(static_cast<CPDF_Dictionary*>(pDirect)); } CPDF_DocJSActions::CPDF_DocJSActions(CPDF_Document* pDoc) { m_pDocument = pDoc; @@ -319,7 +321,7 @@ CPDF_Action CPDF_DocJSActions::GetJSAction(int index, ASSERT(m_pDocument != NULL); CPDF_NameTree name_tree(m_pDocument, FX_BSTRC("JavaScript")); CPDF_Object* pAction = name_tree.LookupValue(index, csName); - if (!ToDictionary(pAction)) { + if (pAction == NULL || pAction->GetType() != PDFOBJ_DICTIONARY) { return CPDF_Action(); } return CPDF_Action(pAction->GetDict()); @@ -328,7 +330,7 @@ CPDF_Action CPDF_DocJSActions::GetJSAction(const CFX_ByteString& csName) const { ASSERT(m_pDocument != NULL); CPDF_NameTree name_tree(m_pDocument, FX_BSTRC("JavaScript")); CPDF_Object* pAction = name_tree.LookupValue(csName); - if (!ToDictionary(pAction)) { + if (pAction == NULL || pAction->GetType() != PDFOBJ_DICTIONARY) { return CPDF_Action(); } return CPDF_Action(pAction->GetDict()); |