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/cpdf_data_avail.h" | 7 #include "core/fpdfapi/fpdf_parser/include/cpdf_data_avail.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 1381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1392 switch (pNode->m_type) { | 1392 switch (pNode->m_type) { |
1393 case PDF_PAGENODE_UNKNOWN: | 1393 case PDF_PAGENODE_UNKNOWN: |
1394 if (!CheckUnkownPageNode(pNode->m_dwPageNo, pNode, pHints)) { | 1394 if (!CheckUnkownPageNode(pNode->m_dwPageNo, pNode, pHints)) { |
1395 return FALSE; | 1395 return FALSE; |
1396 } | 1396 } |
1397 --i; | 1397 --i; |
1398 break; | 1398 break; |
1399 case PDF_PAGENODE_PAGE: | 1399 case PDF_PAGENODE_PAGE: |
1400 iCount++; | 1400 iCount++; |
1401 if (iPage == iCount && m_pDocument) | 1401 if (iPage == iCount && m_pDocument) |
1402 m_pDocument->m_PageList.SetAt(iPage, pNode->m_dwPageNo); | 1402 m_pDocument->SetPageObjNum(iPage, pNode->m_dwPageNo); |
1403 break; | 1403 break; |
1404 case PDF_PAGENODE_PAGES: | 1404 case PDF_PAGENODE_PAGES: |
1405 if (!CheckPageNode(*pNode, iPage, iCount, pHints, level + 1)) | 1405 if (!CheckPageNode(*pNode, iPage, iCount, pHints, level + 1)) |
1406 return FALSE; | 1406 return FALSE; |
1407 break; | 1407 break; |
1408 case PDF_PAGENODE_ARRAY: | 1408 case PDF_PAGENODE_ARRAY: |
1409 if (!CheckArrayPageNode(pNode->m_dwPageNo, pNode, pHints)) | 1409 if (!CheckArrayPageNode(pNode->m_dwPageNo, pNode, pHints)) |
1410 return FALSE; | 1410 return FALSE; |
1411 --i; | 1411 --i; |
1412 break; | 1412 break; |
1413 } | 1413 } |
1414 | 1414 |
1415 if (iPage == iCount) { | 1415 if (iPage == iCount) { |
1416 m_docStatus = PDF_DATAAVAIL_DONE; | 1416 m_docStatus = PDF_DATAAVAIL_DONE; |
1417 return TRUE; | 1417 return TRUE; |
1418 } | 1418 } |
1419 } | 1419 } |
1420 return TRUE; | 1420 return TRUE; |
1421 } | 1421 } |
1422 | 1422 |
1423 FX_BOOL CPDF_DataAvail::LoadDocPage(uint32_t dwPage, DownloadHints* pHints) { | 1423 FX_BOOL CPDF_DataAvail::LoadDocPage(uint32_t dwPage, DownloadHints* pHints) { |
1424 FX_SAFE_INT32 safePage = pdfium::base::checked_cast<int32_t>(dwPage); | 1424 FX_SAFE_INT32 safePage = pdfium::base::checked_cast<int32_t>(dwPage); |
1425 int32_t iPage = safePage.ValueOrDie(); | 1425 int32_t iPage = safePage.ValueOrDie(); |
1426 if (m_pDocument->GetPageCount() <= iPage || | 1426 if (m_pDocument->GetPageCount() <= iPage || |
1427 m_pDocument->m_PageList.GetAt(iPage)) { | 1427 m_pDocument->IsPageLoaded(iPage)) { |
1428 m_docStatus = PDF_DATAAVAIL_DONE; | 1428 m_docStatus = PDF_DATAAVAIL_DONE; |
1429 return TRUE; | 1429 return TRUE; |
1430 } | 1430 } |
1431 | 1431 |
1432 if (m_pageNodes.m_type == PDF_PAGENODE_PAGE) { | 1432 if (m_pageNodes.m_type == PDF_PAGENODE_PAGE) { |
1433 if (iPage == 0) { | 1433 if (iPage == 0) { |
1434 m_docStatus = PDF_DATAAVAIL_DONE; | 1434 m_docStatus = PDF_DATAAVAIL_DONE; |
1435 return TRUE; | 1435 return TRUE; |
1436 } | 1436 } |
1437 m_docStatus = PDF_DATAAVAIL_ERROR; | 1437 m_docStatus = PDF_DATAAVAIL_ERROR; |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1835 return FormAvailable; | 1835 return FormAvailable; |
1836 } | 1836 } |
1837 | 1837 |
1838 CPDF_DataAvail::PageNode::PageNode() : m_type(PDF_PAGENODE_UNKNOWN) {} | 1838 CPDF_DataAvail::PageNode::PageNode() : m_type(PDF_PAGENODE_UNKNOWN) {} |
1839 | 1839 |
1840 CPDF_DataAvail::PageNode::~PageNode() { | 1840 CPDF_DataAvail::PageNode::~PageNode() { |
1841 for (int32_t i = 0; i < m_childNode.GetSize(); ++i) | 1841 for (int32_t i = 0; i < m_childNode.GetSize(); ++i) |
1842 delete m_childNode[i]; | 1842 delete m_childNode[i]; |
1843 m_childNode.RemoveAll(); | 1843 m_childNode.RemoveAll(); |
1844 } | 1844 } |
OLD | NEW |