OLD | NEW |
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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 return -1; | 183 return -1; |
184 } | 184 } |
185 FX_DWORD count = pNode->GetInteger(FX_BSTRC("Count")); | 185 FX_DWORD count = pNode->GetInteger(FX_BSTRC("Count")); |
186 if (count <= skip_count) { | 186 if (count <= skip_count) { |
187 skip_count -= count; | 187 skip_count -= count; |
188 index += count; | 188 index += count; |
189 return -1; | 189 return -1; |
190 } | 190 } |
191 if (count && count == pKidList->GetCount()) { | 191 if (count && count == pKidList->GetCount()) { |
192 for (FX_DWORD i = 0; i < count; i++) { | 192 for (FX_DWORD i = 0; i < count; i++) { |
193 CPDF_Object* pKid = pKidList->GetElement(i); | 193 if (CPDF_Reference* pKid = ToReference(pKidList->GetElement(i))) { |
194 if (pKid && pKid->GetType() == PDFOBJ_REFERENCE) { | 194 if (pKid->GetRefObjNum() == objnum) { |
195 if (((CPDF_Reference*)pKid)->GetRefObjNum() == objnum) { | |
196 m_PageList.SetAt(index + i, objnum); | 195 m_PageList.SetAt(index + i, objnum); |
197 return index + i; | 196 return index + i; |
198 } | 197 } |
199 } | 198 } |
200 } | 199 } |
201 } | 200 } |
202 for (FX_DWORD i = 0; i < pKidList->GetCount(); i++) { | 201 for (FX_DWORD i = 0; i < pKidList->GetCount(); i++) { |
203 CPDF_Dictionary* pKid = pKidList->GetDict(i); | 202 CPDF_Dictionary* pKid = pKidList->GetDict(i); |
204 if (pKid == NULL) { | 203 if (pKid == NULL) { |
205 continue; | 204 continue; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 continue; | 300 continue; |
302 } | 301 } |
303 CPDF_Object* pContents = | 302 CPDF_Object* pContents = |
304 pPageDict ? pPageDict->GetElement(FX_BSTRC("Contents")) : NULL; | 303 pPageDict ? pPageDict->GetElement(FX_BSTRC("Contents")) : NULL; |
305 if (pContents == NULL) { | 304 if (pContents == NULL) { |
306 continue; | 305 continue; |
307 } | 306 } |
308 if (pContents->GetDirectType() == PDFOBJ_ARRAY) { | 307 if (pContents->GetDirectType() == PDFOBJ_ARRAY) { |
309 CPDF_Array* pArray = pContents->GetDirect()->AsArray(); | 308 CPDF_Array* pArray = pContents->GetDirect()->AsArray(); |
310 for (FX_DWORD j = 0; j < pArray->GetCount(); j++) { | 309 for (FX_DWORD j = 0; j < pArray->GetCount(); j++) { |
311 CPDF_Object* pRef = pArray->GetElement(j); | 310 CPDF_Reference* pRef = ToReference(pArray->GetElement(j)); |
312 if (pRef == NULL || pRef->GetType() != PDFOBJ_REFERENCE) { | 311 if (pRef && pRef->GetRefObjNum() == objnum) |
313 continue; | |
314 } | |
315 if (((CPDF_Reference*)pRef)->GetRefObjNum() == objnum) { | |
316 return TRUE; | 312 return TRUE; |
317 } | |
318 } | 313 } |
319 } else if (pContents->GetObjNum() == objnum) { | 314 } else if (pContents->GetObjNum() == objnum) { |
320 return TRUE; | 315 return TRUE; |
321 } | 316 } |
322 } | 317 } |
323 return FALSE; | 318 return FALSE; |
324 } | 319 } |
325 FX_DWORD CPDF_Document::GetUserPermissions(FX_BOOL bCheckRevision) const { | 320 FX_DWORD CPDF_Document::GetUserPermissions(FX_BOOL bCheckRevision) const { |
326 if (m_pParser == NULL) { | 321 if (m_pParser == NULL) { |
327 return (FX_DWORD)-1; | 322 return (FX_DWORD)-1; |
(...skipping 26 matching lines...) Expand all Loading... |
354 void CPDF_Document::ClearPageData() { | 349 void CPDF_Document::ClearPageData() { |
355 if (m_pDocPage) { | 350 if (m_pDocPage) { |
356 CPDF_ModuleMgr::Get()->GetPageModule()->ClearDoc(this); | 351 CPDF_ModuleMgr::Get()->GetPageModule()->ClearDoc(this); |
357 } | 352 } |
358 } | 353 } |
359 void CPDF_Document::ClearRenderData() { | 354 void CPDF_Document::ClearRenderData() { |
360 if (m_pDocRender) { | 355 if (m_pDocRender) { |
361 CPDF_ModuleMgr::Get()->GetRenderModule()->ClearDocData(m_pDocRender); | 356 CPDF_ModuleMgr::Get()->GetRenderModule()->ClearDocData(m_pDocRender); |
362 } | 357 } |
363 } | 358 } |
OLD | NEW |