diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2015-10-20 13:19:19 -0400 |
---|---|---|
committer | Dan Sinclair <dsinclair@chromium.org> | 2015-10-20 13:19:19 -0400 |
commit | 4816432671eef6467354aa252f22bb80acc315b7 (patch) | |
tree | 403313130206e70abf8ceae78353042a38221bec /core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp | |
parent | 8b8dfd7934d669b2c74a0502f82387e5df0f573b (diff) | |
download | pdfium-4816432671eef6467354aa252f22bb80acc315b7.tar.xz |
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/1399233003 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp')
-rw-r--r-- | core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp index 2dff766187..29c1a007cf 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp @@ -143,18 +143,15 @@ CPDF_Dictionary* CPDF_Document::GetPage(int iPage) { return nullptr; if (m_bLinearized && (iPage == (int)m_dwFirstPageNo)) { - CPDF_Object* pObj = GetIndirectObject(m_dwFirstPageObjNum); - if (pObj && pObj->GetType() == PDFOBJ_DICTIONARY) { - return static_cast<CPDF_Dictionary*>(pObj); - } + if (CPDF_Dictionary* pDict = + ToDictionary(GetIndirectObject(m_dwFirstPageObjNum))) + return pDict; } int objnum = m_PageList.GetAt(iPage); if (objnum) { - CPDF_Object* pObj = GetIndirectObject(objnum); - if (pObj && pObj->GetType() == PDFOBJ_DICTIONARY) { - return static_cast<CPDF_Dictionary*>(pObj); - } + if (CPDF_Dictionary* pDict = ToDictionary(GetIndirectObject(objnum))) + return pDict; } CPDF_Dictionary* pRoot = GetRoot(); |