Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1057)

Unified Diff: core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp

Issue 1420583003: Revert "Revert "Add type cast definitions for CPDF_Dictionary."" (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
index 2dff76618750a4bf009c8fdd5158145b932c9ed0..29c1a007cfa23b531e9c57ab7768733a9845e228 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();
« no previous file with comments | « core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp ('k') | core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698