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> |
| 11 #include <utility> |
10 | 12 |
11 #include "core/fpdfapi/fpdf_parser/cpdf_hint_tables.h" | 13 #include "core/fpdfapi/fpdf_parser/cpdf_hint_tables.h" |
12 #include "core/fpdfapi/fpdf_parser/fpdf_parser_utility.h" | 14 #include "core/fpdfapi/fpdf_parser/fpdf_parser_utility.h" |
13 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 15 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
14 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" | 16 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" |
15 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 17 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
16 #include "core/fpdfapi/fpdf_parser/include/cpdf_name.h" | 18 #include "core/fpdfapi/fpdf_parser/include/cpdf_name.h" |
17 #include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" | 19 #include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" |
18 #include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" | 20 #include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" |
19 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" | 21 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" |
(...skipping 1749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1769 | 1771 |
1770 if (m_pLinearized) { | 1772 if (m_pLinearized) { |
1771 CPDF_Dictionary* pDict = m_pLinearized->GetDict(); | 1773 CPDF_Dictionary* pDict = m_pLinearized->GetDict(); |
1772 CPDF_Object* pObj = pDict ? pDict->GetDirectObjectBy("P") : nullptr; | 1774 CPDF_Object* pObj = pDict ? pDict->GetDirectObjectBy("P") : nullptr; |
1773 | 1775 |
1774 int pageNum = pObj ? pObj->GetInteger() : 0; | 1776 int pageNum = pObj ? pObj->GetInteger() : 0; |
1775 if (m_pHintTables && index != pageNum) { | 1777 if (m_pHintTables && index != pageNum) { |
1776 FX_FILESIZE szPageStartPos = 0; | 1778 FX_FILESIZE szPageStartPos = 0; |
1777 FX_FILESIZE szPageLength = 0; | 1779 FX_FILESIZE szPageLength = 0; |
1778 uint32_t dwObjNum = 0; | 1780 uint32_t dwObjNum = 0; |
1779 FX_BOOL bPagePosGot = m_pHintTables->GetPagePos(index, szPageStartPos, | 1781 bool bPagePosGot = m_pHintTables->GetPagePos(index, &szPageStartPos, |
1780 szPageLength, dwObjNum); | 1782 &szPageLength, &dwObjNum); |
1781 if (!bPagePosGot) | 1783 if (!bPagePosGot) |
1782 return nullptr; | 1784 return nullptr; |
1783 | 1785 |
1784 m_syntaxParser.InitParser(m_pFileRead, (uint32_t)szPageStartPos); | 1786 m_syntaxParser.InitParser(m_pFileRead, (uint32_t)szPageStartPos); |
1785 CPDF_Object* pPageDict = ParseIndirectObjectAt(0, dwObjNum, m_pDocument); | 1787 CPDF_Object* pPageDict = ParseIndirectObjectAt(0, dwObjNum, m_pDocument); |
1786 if (!pPageDict) | 1788 if (!pPageDict) |
1787 return nullptr; | 1789 return nullptr; |
1788 | 1790 |
1789 if (!m_pDocument->InsertIndirectObject(dwObjNum, pPageDict)) | 1791 if (!m_pDocument->InsertIndirectObject(dwObjNum, pPageDict)) |
1790 return nullptr; | 1792 return nullptr; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1829 return FormAvailable; | 1831 return FormAvailable; |
1830 } | 1832 } |
1831 | 1833 |
1832 CPDF_DataAvail::PageNode::PageNode() : m_type(PDF_PAGENODE_UNKNOWN) {} | 1834 CPDF_DataAvail::PageNode::PageNode() : m_type(PDF_PAGENODE_UNKNOWN) {} |
1833 | 1835 |
1834 CPDF_DataAvail::PageNode::~PageNode() { | 1836 CPDF_DataAvail::PageNode::~PageNode() { |
1835 for (int32_t i = 0; i < m_childNode.GetSize(); ++i) | 1837 for (int32_t i = 0; i < m_childNode.GetSize(); ++i) |
1836 delete m_childNode[i]; | 1838 delete m_childNode[i]; |
1837 m_childNode.RemoveAll(); | 1839 m_childNode.RemoveAll(); |
1838 } | 1840 } |
OLD | NEW |