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/parser/cpdf_data_avail.h" | 7 #include "core/fpdfapi/parser/cpdf_data_avail.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 1753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1764 bool bPagePosGot = m_pHintTables->GetPagePos(index, &szPageStartPos, | 1764 bool bPagePosGot = m_pHintTables->GetPagePos(index, &szPageStartPos, |
1765 &szPageLength, &dwObjNum); | 1765 &szPageLength, &dwObjNum); |
1766 if (!bPagePosGot) | 1766 if (!bPagePosGot) |
1767 return nullptr; | 1767 return nullptr; |
1768 | 1768 |
1769 m_syntaxParser.InitParser(m_pFileRead, (uint32_t)szPageStartPos); | 1769 m_syntaxParser.InitParser(m_pFileRead, (uint32_t)szPageStartPos); |
1770 CPDF_Object* pPageDict = ParseIndirectObjectAt(0, dwObjNum, m_pDocument); | 1770 CPDF_Object* pPageDict = ParseIndirectObjectAt(0, dwObjNum, m_pDocument); |
1771 if (!pPageDict) | 1771 if (!pPageDict) |
1772 return nullptr; | 1772 return nullptr; |
1773 | 1773 |
1774 if (!m_pDocument->ReplaceIndirectObjectIfHigherGeneration(dwObjNum, | 1774 // TODO(tsepez): check |pPageDict| ownership. |
1775 pPageDict)) { | 1775 if (!m_pDocument->ReplaceIndirectObjectIfHigherGeneration( |
| 1776 dwObjNum, UniqueObject(pPageDict))) { |
1776 return nullptr; | 1777 return nullptr; |
1777 } | 1778 } |
1778 return pPageDict->GetDict(); | 1779 return pPageDict->GetDict(); |
1779 } | 1780 } |
1780 } | 1781 } |
1781 return m_pDocument->GetPage(index); | 1782 return m_pDocument->GetPage(index); |
1782 } | 1783 } |
1783 | 1784 |
1784 CPDF_DataAvail::DocFormStatus CPDF_DataAvail::IsFormAvail( | 1785 CPDF_DataAvail::DocFormStatus CPDF_DataAvail::IsFormAvail( |
1785 DownloadHints* pHints) { | 1786 DownloadHints* pHints) { |
(...skipping 30 matching lines...) Expand all Loading... |
1816 return FormAvailable; | 1817 return FormAvailable; |
1817 } | 1818 } |
1818 | 1819 |
1819 CPDF_DataAvail::PageNode::PageNode() : m_type(PDF_PAGENODE_UNKNOWN) {} | 1820 CPDF_DataAvail::PageNode::PageNode() : m_type(PDF_PAGENODE_UNKNOWN) {} |
1820 | 1821 |
1821 CPDF_DataAvail::PageNode::~PageNode() { | 1822 CPDF_DataAvail::PageNode::~PageNode() { |
1822 for (int32_t i = 0; i < m_childNode.GetSize(); ++i) | 1823 for (int32_t i = 0; i < m_childNode.GetSize(); ++i) |
1823 delete m_childNode[i]; | 1824 delete m_childNode[i]; |
1824 m_childNode.RemoveAll(); | 1825 m_childNode.RemoveAll(); |
1825 } | 1826 } |
OLD | NEW |