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 #include "../../../include/fpdfapi/fpdf_page.h" | 9 #include "../../../include/fpdfapi/fpdf_page.h" |
10 #include "../../../src/fxcrt/fx_safe_types.h" | 10 #include "../../../src/fxcrt/fx_safe_types.h" |
(...skipping 3372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3383 m_docStatus = PDF_DATAAVAIL_LOADALLFILE; | 3383 m_docStatus = PDF_DATAAVAIL_LOADALLFILE; |
3384 return TRUE; | 3384 return TRUE; |
3385 } | 3385 } |
3386 if (!m_pRoot) { | 3386 if (!m_pRoot) { |
3387 if (m_docStatus == PDF_DATAAVAIL_ERROR) { | 3387 if (m_docStatus == PDF_DATAAVAIL_ERROR) { |
3388 m_docStatus = PDF_DATAAVAIL_LOADALLFILE; | 3388 m_docStatus = PDF_DATAAVAIL_LOADALLFILE; |
3389 return TRUE; | 3389 return TRUE; |
3390 } | 3390 } |
3391 return FALSE; | 3391 return FALSE; |
3392 } | 3392 } |
3393 CPDF_Reference* pRef = (CPDF_Reference*)m_pRoot->GetDict()->GetElement(FX_BS
TRC("Pages")); | 3393 CPDF_Dictionary* pDict = m_pRoot->GetDict(); |
| 3394 if (!pDict) { |
| 3395 m_docStatus = PDF_DATAAVAIL_ERROR; |
| 3396 return FALSE; |
| 3397 } |
| 3398 CPDF_Reference* pRef = (CPDF_Reference*)pDict->GetElement(FX_BSTRC("Pages"))
; |
3394 if (pRef == NULL || pRef->GetType() != PDFOBJ_REFERENCE) { | 3399 if (pRef == NULL || pRef->GetType() != PDFOBJ_REFERENCE) { |
3395 m_docStatus = PDF_DATAAVAIL_ERROR; | 3400 m_docStatus = PDF_DATAAVAIL_ERROR; |
3396 return FALSE; | 3401 return FALSE; |
3397 } | 3402 } |
3398 m_PagesObjNum = pRef->GetRefObjNum(); | 3403 m_PagesObjNum = pRef->GetRefObjNum(); |
3399 CPDF_Reference* pAcroFormRef = (CPDF_Reference*)m_pRoot->GetDict()->GetEleme
nt(FX_BSTRC("AcroForm")); | 3404 CPDF_Reference* pAcroFormRef = (CPDF_Reference*)m_pRoot->GetDict()->GetEleme
nt(FX_BSTRC("AcroForm")); |
3400 if (pAcroFormRef && pAcroFormRef->GetType() == PDFOBJ_REFERENCE) { | 3405 if (pAcroFormRef && pAcroFormRef->GetType() == PDFOBJ_REFERENCE) { |
3401 m_bHaveAcroForm = TRUE; | 3406 m_bHaveAcroForm = TRUE; |
3402 m_dwAcroFormObjNum = pAcroFormRef->GetRefObjNum(); | 3407 m_dwAcroFormObjNum = pAcroFormRef->GetRefObjNum(); |
3403 } | 3408 } |
(...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4638 { | 4643 { |
4639 FX_INT32 iSize = m_childNode.GetSize(); | 4644 FX_INT32 iSize = m_childNode.GetSize(); |
4640 for (FX_INT32 i = 0; i < iSize; ++i) { | 4645 for (FX_INT32 i = 0; i < iSize; ++i) { |
4641 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; | 4646 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; |
4642 if (pNode) { | 4647 if (pNode) { |
4643 delete pNode; | 4648 delete pNode; |
4644 } | 4649 } |
4645 } | 4650 } |
4646 m_childNode.RemoveAll(); | 4651 m_childNode.RemoveAll(); |
4647 } | 4652 } |
OLD | NEW |