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 /fpdfsdk/src/fpdfppo.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 'fpdfsdk/src/fpdfppo.cpp')
-rw-r--r-- | fpdfsdk/src/fpdfppo.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/fpdfsdk/src/fpdfppo.cpp b/fpdfsdk/src/fpdfppo.cpp index ab25b76934..2508adca7b 100644 --- a/fpdfsdk/src/fpdfppo.cpp +++ b/fpdfsdk/src/fpdfppo.cpp @@ -60,7 +60,7 @@ FX_BOOL CPDF_PageOrganizer::PDFDocInit(CPDF_Document* pDestPDFDoc, CPDF_Object* pElement = pNewRoot->GetElement("Pages"); CPDF_Dictionary* pNewPages = - pElement ? ToDictionary(pElement->GetDirect()) : nullptr; + pElement ? (CPDF_Dictionary*)pElement->GetDirect() : nullptr; if (!pNewPages) { pNewPages = new CPDF_Dictionary; FX_DWORD NewPagesON = pDestPDFDoc->AddIndirectObject(pNewPages); @@ -183,13 +183,14 @@ CPDF_Object* CPDF_PageOrganizer::PageDictGetInheritableTag( if (pType->GetString().Compare("Page")) return nullptr; - CPDF_Dictionary* pp = ToDictionary(pDict->GetElement("Parent")->GetDirect()); - if (!pp) + CPDF_Object* pParent = pDict->GetElement("Parent")->GetDirect(); + if (!pParent || pParent->GetType() != PDFOBJ_DICTIONARY) return nullptr; if (pDict->KeyExist((const char*)nSrctag)) return pDict->GetElement((const char*)nSrctag); + CPDF_Dictionary* pp = (CPDF_Dictionary*)pParent; while (pp) { if (pp->KeyExist((const char*)nSrctag)) { return pp->GetElement((const char*)nSrctag); @@ -197,8 +198,12 @@ CPDF_Object* CPDF_PageOrganizer::PageDictGetInheritableTag( if (!pp->KeyExist("Parent")) { break; } - pp = ToDictionary(pp->GetElement("Parent")->GetDirect()); + pp = (CPDF_Dictionary*)pp->GetElement("Parent")->GetDirect(); + if (pp->GetType() == PDFOBJ_NULL) { + break; + } } + return nullptr; } @@ -215,7 +220,7 @@ FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj, break; } case PDFOBJ_DICTIONARY: { - CPDF_Dictionary* pDict = pObj->AsDictionary(); + CPDF_Dictionary* pDict = (CPDF_Dictionary*)pObj; FX_POSITION pos = pDict->GetStartPos(); while (pos) { @@ -286,7 +291,8 @@ FX_DWORD CPDF_PageOrganizer::GetNewObjId(CPDF_Document* pDoc, if (!pClone) return 0; - if (CPDF_Dictionary* pDictClone = pClone->AsDictionary()) { + if (pClone->GetType() == PDFOBJ_DICTIONARY) { + CPDF_Dictionary* pDictClone = (CPDF_Dictionary*)pClone; if (pDictClone->KeyExist("Type")) { CFX_ByteString strType = pDictClone->GetString("Type"); if (!FXSYS_stricmp(strType, "Pages")) { |