| OLD | NEW |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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 "core/fpdfapi/fpdf_parser/include/ipdf_data_avail.h" | 7 #include "core/fpdfapi/fpdf_parser/include/ipdf_data_avail.h" |
| 8 | 8 |
| 9 #include "core/fpdfapi/fpdf_parser/cpdf_data_avail.h" | 9 #include "core/fpdfapi/fpdf_parser/cpdf_data_avail.h" |
| 10 #include "core/fpdfapi/fpdf_parser/fpdf_parser_utility.h" | 10 #include "core/fpdfapi/fpdf_parser/fpdf_parser_utility.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 m_bLinearized = FALSE; | 67 m_bLinearized = FALSE; |
| 68 m_bPagesLoad = FALSE; | 68 m_bPagesLoad = FALSE; |
| 69 m_bPagesTreeLoad = FALSE; | 69 m_bPagesTreeLoad = FALSE; |
| 70 m_bMainXRefLoadedOK = FALSE; | 70 m_bMainXRefLoadedOK = FALSE; |
| 71 m_bAnnotsLoad = FALSE; | 71 m_bAnnotsLoad = FALSE; |
| 72 m_bHaveAcroForm = FALSE; | 72 m_bHaveAcroForm = FALSE; |
| 73 m_bAcroFormLoad = FALSE; | 73 m_bAcroFormLoad = FALSE; |
| 74 m_bPageLoadedOK = FALSE; | 74 m_bPageLoadedOK = FALSE; |
| 75 m_bNeedDownLoadResource = FALSE; | 75 m_bNeedDownLoadResource = FALSE; |
| 76 m_bLinearizedFormParamLoad = FALSE; | 76 m_bLinearizedFormParamLoad = FALSE; |
| 77 m_pLinearized = NULL; | 77 m_pLinearized = nullptr; |
| 78 m_pRoot = NULL; | 78 m_pRoot = nullptr; |
| 79 m_pTrailer = NULL; | 79 m_pTrailer = nullptr; |
| 80 m_pCurrentParser = NULL; | 80 m_pCurrentParser = nullptr; |
| 81 m_pAcroForm = NULL; | 81 m_pAcroForm = nullptr; |
| 82 m_pPageDict = NULL; | 82 m_pPageDict = nullptr; |
| 83 m_pPageResource = NULL; | 83 m_pPageResource = nullptr; |
| 84 m_docStatus = PDF_DATAAVAIL_HEADER; | 84 m_docStatus = PDF_DATAAVAIL_HEADER; |
| 85 m_parser.m_bOwnFileRead = false; | 85 m_parser.m_bOwnFileRead = false; |
| 86 m_bTotalLoadPageTree = FALSE; | 86 m_bTotalLoadPageTree = FALSE; |
| 87 m_bCurPageDictLoadOK = FALSE; | 87 m_bCurPageDictLoadOK = FALSE; |
| 88 m_bLinearedDataOK = FALSE; | 88 m_bLinearedDataOK = FALSE; |
| 89 m_bSupportHintTable = bSupportHintTable; | 89 m_bSupportHintTable = bSupportHintTable; |
| 90 } | 90 } |
| 91 CPDF_DataAvail::~CPDF_DataAvail() { | 91 CPDF_DataAvail::~CPDF_DataAvail() { |
| 92 m_pHintTables.reset(); | 92 m_pHintTables.reset(); |
| 93 if (m_pLinearized) | 93 if (m_pLinearized) |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 return TRUE; | 562 return TRUE; |
| 563 } | 563 } |
| 564 | 564 |
| 565 FX_BOOL CPDF_DataAvail::GetPageKids(CPDF_Parser* pParser, CPDF_Object* pPages) { | 565 FX_BOOL CPDF_DataAvail::GetPageKids(CPDF_Parser* pParser, CPDF_Object* pPages) { |
| 566 if (!pParser) { | 566 if (!pParser) { |
| 567 m_docStatus = PDF_DATAAVAIL_ERROR; | 567 m_docStatus = PDF_DATAAVAIL_ERROR; |
| 568 return FALSE; | 568 return FALSE; |
| 569 } | 569 } |
| 570 | 570 |
| 571 CPDF_Dictionary* pDict = pPages->GetDict(); | 571 CPDF_Dictionary* pDict = pPages->GetDict(); |
| 572 CPDF_Object* pKids = pDict ? pDict->GetObjectBy("Kids") : NULL; | 572 CPDF_Object* pKids = pDict ? pDict->GetObjectBy("Kids") : nullptr; |
| 573 if (!pKids) | 573 if (!pKids) |
| 574 return TRUE; | 574 return TRUE; |
| 575 | 575 |
| 576 switch (pKids->GetType()) { | 576 switch (pKids->GetType()) { |
| 577 case CPDF_Object::REFERENCE: | 577 case CPDF_Object::REFERENCE: |
| 578 m_PageObjList.Add(pKids->AsReference()->GetRefObjNum()); | 578 m_PageObjList.Add(pKids->AsReference()->GetRefObjNum()); |
| 579 break; | 579 break; |
| 580 case CPDF_Object::ARRAY: { | 580 case CPDF_Object::ARRAY: { |
| 581 CPDF_Array* pKidsArray = pKids->AsArray(); | 581 CPDF_Array* pKidsArray = pKids->AsArray(); |
| 582 for (size_t i = 0; i < pKidsArray->GetCount(); ++i) { | 582 for (size_t i = 0; i < pKidsArray->GetCount(); ++i) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 } | 635 } |
| 636 return TRUE; | 636 return TRUE; |
| 637 } | 637 } |
| 638 | 638 |
| 639 pHints->AddSegment(0, kReqSize); | 639 pHints->AddSegment(0, kReqSize); |
| 640 return FALSE; | 640 return FALSE; |
| 641 } | 641 } |
| 642 | 642 |
| 643 FX_BOOL CPDF_DataAvail::CheckFirstPage(IPDF_DataAvail::DownloadHints* pHints) { | 643 FX_BOOL CPDF_DataAvail::CheckFirstPage(IPDF_DataAvail::DownloadHints* pHints) { |
| 644 CPDF_Dictionary* pDict = m_pLinearized->GetDict(); | 644 CPDF_Dictionary* pDict = m_pLinearized->GetDict(); |
| 645 CPDF_Object* pEndOffSet = pDict ? pDict->GetObjectBy("E") : NULL; | 645 CPDF_Object* pEndOffSet = pDict ? pDict->GetObjectBy("E") : nullptr; |
| 646 if (!pEndOffSet) { | 646 if (!pEndOffSet) { |
| 647 m_docStatus = PDF_DATAAVAIL_ERROR; | 647 m_docStatus = PDF_DATAAVAIL_ERROR; |
| 648 return FALSE; | 648 return FALSE; |
| 649 } | 649 } |
| 650 | 650 |
| 651 CPDF_Object* pXRefOffset = pDict ? pDict->GetObjectBy("T") : NULL; | 651 CPDF_Object* pXRefOffset = pDict ? pDict->GetObjectBy("T") : nullptr; |
| 652 if (!pXRefOffset) { | 652 if (!pXRefOffset) { |
| 653 m_docStatus = PDF_DATAAVAIL_ERROR; | 653 m_docStatus = PDF_DATAAVAIL_ERROR; |
| 654 return FALSE; | 654 return FALSE; |
| 655 } | 655 } |
| 656 | 656 |
| 657 CPDF_Object* pFileLen = pDict ? pDict->GetObjectBy("L") : NULL; | 657 CPDF_Object* pFileLen = pDict ? pDict->GetObjectBy("L") : nullptr; |
| 658 if (!pFileLen) { | 658 if (!pFileLen) { |
| 659 m_docStatus = PDF_DATAAVAIL_ERROR; | 659 m_docStatus = PDF_DATAAVAIL_ERROR; |
| 660 return FALSE; | 660 return FALSE; |
| 661 } | 661 } |
| 662 | 662 |
| 663 FX_BOOL bNeedDownLoad = FALSE; | 663 FX_BOOL bNeedDownLoad = FALSE; |
| 664 if (pEndOffSet->IsNumber()) { | 664 if (pEndOffSet->IsNumber()) { |
| 665 uint32_t dwEnd = pEndOffSet->GetInteger(); | 665 uint32_t dwEnd = pEndOffSet->GetInteger(); |
| 666 dwEnd += 512; | 666 dwEnd += 512; |
| 667 if ((FX_FILESIZE)dwEnd > m_dwFileLen) | 667 if ((FX_FILESIZE)dwEnd > m_dwFileLen) |
| (...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1829 return FormAvailable; | 1829 return FormAvailable; |
| 1830 } | 1830 } |
| 1831 | 1831 |
| 1832 CPDF_DataAvail::PageNode::PageNode() : m_type(PDF_PAGENODE_UNKNOWN) {} | 1832 CPDF_DataAvail::PageNode::PageNode() : m_type(PDF_PAGENODE_UNKNOWN) {} |
| 1833 | 1833 |
| 1834 CPDF_DataAvail::PageNode::~PageNode() { | 1834 CPDF_DataAvail::PageNode::~PageNode() { |
| 1835 for (int32_t i = 0; i < m_childNode.GetSize(); ++i) | 1835 for (int32_t i = 0; i < m_childNode.GetSize(); ++i) |
| 1836 delete m_childNode[i]; | 1836 delete m_childNode[i]; |
| 1837 m_childNode.RemoveAll(); | 1837 m_childNode.RemoveAll(); |
| 1838 } | 1838 } |
| OLD | NEW |