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