From 937840e1722d1f2b77d80575d6e710d760662c9c Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 20 Oct 2015 13:30:34 -0400 Subject: 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 . --- core/src/fpdfdoc/doc_action.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'core/src/fpdfdoc/doc_action.cpp') 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(pNext); + if (iIndex == 0) { return CPDF_Action(pDict); - } else if (pNext->GetType() == PDFOBJ_ARRAY) { + } + } else if (iObjType == PDFOBJ_ARRAY) { CPDF_Array* pArray = static_cast(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(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()); -- cgit v1.2.3