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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "../../../include/fpdfapi/fpdf_parser.h" 7 #include "../../../include/fpdfapi/fpdf_parser.h"
8 #include "../../../include/fpdfapi/fpdf_module.h" 8 #include "../../../include/fpdfapi/fpdf_module.h"
9 9
10 10
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 } 136 }
137 } 137 }
138 return NULL; 138 return NULL;
139 } 139 }
140 140
141 CPDF_Dictionary* CPDF_Document::GetPage(int iPage) { 141 CPDF_Dictionary* CPDF_Document::GetPage(int iPage) {
142 if (iPage < 0 || iPage >= m_PageList.GetSize()) 142 if (iPage < 0 || iPage >= m_PageList.GetSize())
143 return nullptr; 143 return nullptr;
144 144
145 if (m_bLinearized && (iPage == (int)m_dwFirstPageNo)) { 145 if (m_bLinearized && (iPage == (int)m_dwFirstPageNo)) {
146 CPDF_Object* pObj = GetIndirectObject(m_dwFirstPageObjNum); 146 if (CPDF_Dictionary* pDict =
147 if (pObj && pObj->GetType() == PDFOBJ_DICTIONARY) { 147 ToDictionary(GetIndirectObject(m_dwFirstPageObjNum)))
148 return static_cast<CPDF_Dictionary*>(pObj); 148 return pDict;
149 }
150 } 149 }
151 150
152 int objnum = m_PageList.GetAt(iPage); 151 int objnum = m_PageList.GetAt(iPage);
153 if (objnum) { 152 if (objnum) {
154 CPDF_Object* pObj = GetIndirectObject(objnum); 153 if (CPDF_Dictionary* pDict = ToDictionary(GetIndirectObject(objnum)))
155 if (pObj && pObj->GetType() == PDFOBJ_DICTIONARY) { 154 return pDict;
156 return static_cast<CPDF_Dictionary*>(pObj);
157 }
158 } 155 }
159 156
160 CPDF_Dictionary* pRoot = GetRoot(); 157 CPDF_Dictionary* pRoot = GetRoot();
161 if (!pRoot) 158 if (!pRoot)
162 return nullptr; 159 return nullptr;
163 160
164 CPDF_Dictionary* pPages = pRoot->GetDict(FX_BSTRC("Pages")); 161 CPDF_Dictionary* pPages = pRoot->GetDict(FX_BSTRC("Pages"));
165 if (!pPages) 162 if (!pPages)
166 return nullptr; 163 return nullptr;
167 164
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 void CPDF_Document::ClearPageData() { 354 void CPDF_Document::ClearPageData() {
358 if (m_pDocPage) { 355 if (m_pDocPage) {
359 CPDF_ModuleMgr::Get()->GetPageModule()->ClearDoc(this); 356 CPDF_ModuleMgr::Get()->GetPageModule()->ClearDoc(this);
360 } 357 }
361 } 358 }
362 void CPDF_Document::ClearRenderData() { 359 void CPDF_Document::ClearRenderData() {
363 if (m_pDocRender) { 360 if (m_pDocRender) {
364 CPDF_ModuleMgr::Get()->GetRenderModule()->ClearDocData(m_pDocRender); 361 CPDF_ModuleMgr::Get()->GetRenderModule()->ClearDocData(m_pDocRender);
365 } 362 }
366 } 363 }
OLDNEW
« 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