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 "core/include/fpdfapi/fpdf_parser.h" | 7 #include "core/include/fpdfapi/fpdf_parser.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 4281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4292 } | 4292 } |
4293 int CPDF_DataAvail::GetPageCount() const { | 4293 int CPDF_DataAvail::GetPageCount() const { |
4294 if (m_pLinearized) { | 4294 if (m_pLinearized) { |
4295 CPDF_Dictionary* pDict = m_pLinearized->GetDict(); | 4295 CPDF_Dictionary* pDict = m_pLinearized->GetDict(); |
4296 CPDF_Object* pObj = pDict ? pDict->GetElementValue("N") : nullptr; | 4296 CPDF_Object* pObj = pDict ? pDict->GetElementValue("N") : nullptr; |
4297 return pObj ? pObj->GetInteger() : 0; | 4297 return pObj ? pObj->GetInteger() : 0; |
4298 } | 4298 } |
4299 return m_pDocument ? m_pDocument->GetPageCount() : 0; | 4299 return m_pDocument ? m_pDocument->GetPageCount() : 0; |
4300 } | 4300 } |
4301 CPDF_Dictionary* CPDF_DataAvail::GetPage(int index) { | 4301 CPDF_Dictionary* CPDF_DataAvail::GetPage(int index) { |
4302 if (!m_pDocument || index < 0 || index >= this->GetPageCount()) { | 4302 if (!m_pDocument || index < 0 || index >= GetPageCount()) { |
4303 return nullptr; | 4303 return nullptr; |
4304 } | 4304 } |
4305 if (m_pLinearized) { | 4305 if (m_pLinearized) { |
4306 CPDF_Dictionary* pDict = m_pLinearized->GetDict(); | 4306 CPDF_Dictionary* pDict = m_pLinearized->GetDict(); |
4307 CPDF_Object* pObj = pDict ? pDict->GetElementValue("P") : nullptr; | 4307 CPDF_Object* pObj = pDict ? pDict->GetElementValue("P") : nullptr; |
4308 int pageNum = pObj ? pObj->GetInteger() : 0; | 4308 int pageNum = pObj ? pObj->GetInteger() : 0; |
4309 if (m_pHintTables && index != pageNum) { | 4309 if (m_pHintTables && index != pageNum) { |
4310 FX_FILESIZE szPageStartPos = 0; | 4310 FX_FILESIZE szPageStartPos = 0; |
4311 FX_FILESIZE szPageLength = 0; | 4311 FX_FILESIZE szPageLength = 0; |
4312 FX_DWORD dwObjNum = 0; | 4312 FX_DWORD dwObjNum = 0; |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4740 if (!m_pLinearizedDict) | 4740 if (!m_pLinearizedDict) |
4741 return -1; | 4741 return -1; |
4742 CPDF_Array* pRange = m_pLinearizedDict->GetArrayBy("H"); | 4742 CPDF_Array* pRange = m_pLinearizedDict->GetArrayBy("H"); |
4743 if (!pRange) | 4743 if (!pRange) |
4744 return -1; | 4744 return -1; |
4745 CPDF_Object* pStreamLen = pRange->GetElementValue(1); | 4745 CPDF_Object* pStreamLen = pRange->GetElementValue(1); |
4746 if (!pStreamLen) | 4746 if (!pStreamLen) |
4747 return -1; | 4747 return -1; |
4748 return pStreamLen->GetInteger(); | 4748 return pStreamLen->GetInteger(); |
4749 } | 4749 } |
OLD | NEW |