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/fpdfdoc.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/fpdfdoc.cpp')
-rw-r--r-- | fpdfsdk/src/fpdfdoc.cpp | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/fpdfsdk/src/fpdfdoc.cpp b/fpdfsdk/src/fpdfdoc.cpp index ad8ef8bea3..b770295604 100644 --- a/fpdfsdk/src/fpdfdoc.cpp +++ b/fpdfsdk/src/fpdfdoc.cpp @@ -56,8 +56,7 @@ FPDFBookmark_GetFirstChild(FPDF_DOCUMENT document, FPDF_BOOKMARK pDict) { if (!pDoc) return nullptr; CPDF_BookmarkTree tree(pDoc); - CPDF_Bookmark bookmark = - CPDF_Bookmark(ToDictionary(static_cast<CPDF_Object*>(pDict))); + CPDF_Bookmark bookmark = CPDF_Bookmark((CPDF_Dictionary*)pDict); return tree.GetFirstChild(bookmark).GetDict(); } @@ -69,8 +68,7 @@ FPDFBookmark_GetNextSibling(FPDF_DOCUMENT document, FPDF_BOOKMARK pDict) { if (!pDoc) return nullptr; CPDF_BookmarkTree tree(pDoc); - CPDF_Bookmark bookmark = - CPDF_Bookmark(ToDictionary(static_cast<CPDF_Object*>(pDict))); + CPDF_Bookmark bookmark = CPDF_Bookmark((CPDF_Dictionary*)pDict); return tree.GetNextSibling(bookmark).GetDict(); } @@ -79,7 +77,7 @@ DLLEXPORT unsigned long STDCALL FPDFBookmark_GetTitle(FPDF_BOOKMARK pDict, unsigned long buflen) { if (!pDict) return 0; - CPDF_Bookmark bookmark(ToDictionary(static_cast<CPDF_Object*>(pDict))); + CPDF_Bookmark bookmark((CPDF_Dictionary*)pDict); CFX_WideString title = bookmark.GetTitle(); CFX_ByteString encodedTitle = title.UTF16LE_Encode(); unsigned long len = encodedTitle.GetLength(); @@ -109,7 +107,7 @@ DLLEXPORT FPDF_DEST STDCALL FPDFBookmark_GetDest(FPDF_DOCUMENT document, CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); if (!pDoc) return nullptr; - CPDF_Bookmark bookmark(ToDictionary(static_cast<CPDF_Object*>(pDict))); + CPDF_Bookmark bookmark((CPDF_Dictionary*)pDict); CPDF_Dest dest = bookmark.GetDest(pDoc); if (dest) return dest.GetObject(); @@ -124,7 +122,7 @@ DLLEXPORT FPDF_DEST STDCALL FPDFBookmark_GetDest(FPDF_DOCUMENT document, DLLEXPORT FPDF_ACTION STDCALL FPDFBookmark_GetAction(FPDF_BOOKMARK pDict) { if (!pDict) return NULL; - CPDF_Bookmark bookmark(ToDictionary(static_cast<CPDF_Object*>(pDict))); + CPDF_Bookmark bookmark((CPDF_Dictionary*)pDict); return bookmark.GetAction().GetDict(); } @@ -132,7 +130,7 @@ DLLEXPORT unsigned long STDCALL FPDFAction_GetType(FPDF_ACTION pDict) { if (!pDict) return PDFACTION_UNSUPPORTED; - CPDF_Action action(ToDictionary(static_cast<CPDF_Object*>(pDict))); + CPDF_Action action((CPDF_Dictionary*)pDict); CPDF_Action::ActionType type = action.GetType(); switch (type) { case CPDF_Action::GoTo: @@ -155,7 +153,7 @@ DLLEXPORT FPDF_DEST STDCALL FPDFAction_GetDest(FPDF_DOCUMENT document, CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); if (!pDoc) return nullptr; - CPDF_Action action(ToDictionary(static_cast<CPDF_Object*>(pDict))); + CPDF_Action action((CPDF_Dictionary*)pDict); return action.GetDest(pDoc).GetObject(); } @@ -165,7 +163,7 @@ FPDFAction_GetFilePath(FPDF_ACTION pDict, void* buffer, unsigned long buflen) { if (type != PDFACTION_REMOTEGOTO && type != PDFACTION_LAUNCH) return 0; - CPDF_Action action(ToDictionary(static_cast<CPDF_Object*>(pDict))); + CPDF_Action action((CPDF_Dictionary*)pDict); CFX_ByteString path = action.GetFilePath().UTF8Encode(); unsigned long len = path.GetLength() + 1; if (buffer && buflen >= len) @@ -182,7 +180,7 @@ DLLEXPORT unsigned long STDCALL FPDFAction_GetURIPath(FPDF_DOCUMENT document, CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); if (!pDoc) return 0; - CPDF_Action action(ToDictionary(static_cast<CPDF_Object*>(pDict))); + CPDF_Action action((CPDF_Dictionary*)pDict); CFX_ByteString path = action.GetURI(pDoc); unsigned long len = path.GetLength() + 1; if (buffer && buflen >= len) @@ -237,7 +235,7 @@ DLLEXPORT FPDF_DEST STDCALL FPDFLink_GetDest(FPDF_DOCUMENT document, CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); if (!pDoc) return nullptr; - CPDF_Link link(ToDictionary(static_cast<CPDF_Object*>(pDict))); + CPDF_Link link((CPDF_Dictionary*)pDict); FPDF_DEST dest = link.GetDest(pDoc).GetObject(); if (dest) return dest; @@ -252,7 +250,7 @@ DLLEXPORT FPDF_ACTION STDCALL FPDFLink_GetAction(FPDF_LINK pDict) { if (!pDict) return nullptr; - CPDF_Link link(ToDictionary(static_cast<CPDF_Object*>(pDict))); + CPDF_Link link((CPDF_Dictionary*)pDict); return link.GetAction().GetDict(); } @@ -268,9 +266,8 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFLink_Enumerate(FPDF_PAGE page, if (!pAnnots) return FALSE; for (int i = *startPos; i < (int)pAnnots->GetCount(); i++) { - CPDF_Dictionary* pDict = - ToDictionary(static_cast<CPDF_Object*>(pAnnots->GetElementValue(i))); - if (!pDict) + CPDF_Dictionary* pDict = (CPDF_Dictionary*)pAnnots->GetElementValue(i); + if (!pDict || pDict->GetType() != PDFOBJ_DICTIONARY) continue; if (pDict->GetString(FX_BSTRC("Subtype")).Equal(FX_BSTRC("Link"))) { *startPos = i + 1; @@ -285,8 +282,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetAnnotRect(FPDF_LINK linkAnnot, FS_RECTF* rect) { if (!linkAnnot || !rect) return FALSE; - CPDF_Dictionary* pAnnotDict = - ToDictionary(static_cast<CPDF_Object*>(linkAnnot)); + CPDF_Dictionary* pAnnotDict = (CPDF_Dictionary*)linkAnnot; CPDF_Rect rt = pAnnotDict->GetRect(FX_BSTRC("Rect")); rect->left = rt.left; rect->bottom = rt.bottom; @@ -298,8 +294,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetAnnotRect(FPDF_LINK linkAnnot, DLLEXPORT int STDCALL FPDFLink_CountQuadPoints(FPDF_LINK linkAnnot) { if (!linkAnnot) return 0; - CPDF_Dictionary* pAnnotDict = - ToDictionary(static_cast<CPDF_Object*>(linkAnnot)); + CPDF_Dictionary* pAnnotDict = (CPDF_Dictionary*)linkAnnot; CPDF_Array* pArray = pAnnotDict->GetArray(FX_BSTRC("QuadPoints")); if (!pArray) return 0; @@ -311,8 +306,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot, FS_QUADPOINTSF* quadPoints) { if (!linkAnnot || !quadPoints) return FALSE; - CPDF_Dictionary* pAnnotDict = - ToDictionary(static_cast<CPDF_Object*>(linkAnnot)); + CPDF_Dictionary* pAnnotDict = (CPDF_Dictionary*)linkAnnot; CPDF_Array* pArray = pAnnotDict->GetArray(FX_BSTRC("QuadPoints")); if (pArray) { if (quadIndex < 0 || quadIndex >= (int)pArray->GetCount() / 8 || |