| 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 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 return LinearizationUnknown; | 828 return LinearizationUnknown; |
| 829 | 829 |
| 830 uint8_t buffer[1024]; | 830 uint8_t buffer[1024]; |
| 831 m_pFileRead->ReadBlock(buffer, 0, kReqSize); | 831 m_pFileRead->ReadBlock(buffer, 0, kReqSize); |
| 832 if (IsLinearizedFile(buffer, kReqSize)) | 832 if (IsLinearizedFile(buffer, kReqSize)) |
| 833 return Linearized; | 833 return Linearized; |
| 834 | 834 |
| 835 return NotLinearized; | 835 return NotLinearized; |
| 836 } | 836 } |
| 837 | 837 |
| 838 FX_BOOL CPDF_DataAvail::IsLinearized() { |
| 839 return m_bLinearized; |
| 840 } |
| 841 |
| 838 FX_BOOL CPDF_DataAvail::IsLinearizedFile(uint8_t* pData, uint32_t dwLen) { | 842 FX_BOOL CPDF_DataAvail::IsLinearizedFile(uint8_t* pData, uint32_t dwLen) { |
| 839 if (m_pLinearized) | 843 if (m_pLinearized) |
| 840 return m_bLinearized; | 844 return m_bLinearized; |
| 841 | 845 |
| 842 ScopedFileStream file(FX_CreateMemoryStream(pData, (size_t)dwLen, FALSE)); | 846 ScopedFileStream file(FX_CreateMemoryStream(pData, (size_t)dwLen, FALSE)); |
| 843 | 847 |
| 844 int32_t offset = GetHeaderOffset(file.get()); | 848 int32_t offset = GetHeaderOffset(file.get()); |
| 845 if (offset == -1) { | 849 if (offset == -1) { |
| 846 m_docStatus = PDF_DATAAVAIL_ERROR; | 850 m_docStatus = PDF_DATAAVAIL_ERROR; |
| 847 return FALSE; | 851 return FALSE; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 962 return 1; | 966 return 1; |
| 963 } | 967 } |
| 964 } | 968 } |
| 965 pObj->Release(); | 969 pObj->Release(); |
| 966 return -1; | 970 return -1; |
| 967 } | 971 } |
| 968 pHints->AddSegment(m_Pos, req_size); | 972 pHints->AddSegment(m_Pos, req_size); |
| 969 return 0; | 973 return 0; |
| 970 } | 974 } |
| 971 | 975 |
| 972 inline void CPDF_DataAvail::SetStartOffset(FX_FILESIZE dwOffset) { | 976 void CPDF_DataAvail::SetStartOffset(FX_FILESIZE dwOffset) { |
| 973 m_Pos = dwOffset; | 977 m_Pos = dwOffset; |
| 974 } | 978 } |
| 975 | 979 |
| 976 FX_BOOL CPDF_DataAvail::GetNextToken(CFX_ByteString& token) { | 980 FX_BOOL CPDF_DataAvail::GetNextToken(CFX_ByteString& token) { |
| 977 uint8_t ch; | 981 uint8_t ch; |
| 978 if (!GetNextChar(ch)) | 982 if (!GetNextChar(ch)) |
| 979 return FALSE; | 983 return FALSE; |
| 980 | 984 |
| 981 while (1) { | 985 while (1) { |
| 982 while (PDFCharIsWhitespace(ch)) { | 986 while (PDFCharIsWhitespace(ch)) { |
| (...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1834 return FormAvailable; | 1838 return FormAvailable; |
| 1835 } | 1839 } |
| 1836 | 1840 |
| 1837 CPDF_DataAvail::PageNode::PageNode() : m_type(PDF_PAGENODE_UNKNOWN) {} | 1841 CPDF_DataAvail::PageNode::PageNode() : m_type(PDF_PAGENODE_UNKNOWN) {} |
| 1838 | 1842 |
| 1839 CPDF_DataAvail::PageNode::~PageNode() { | 1843 CPDF_DataAvail::PageNode::~PageNode() { |
| 1840 for (int32_t i = 0; i < m_childNode.GetSize(); ++i) | 1844 for (int32_t i = 0; i < m_childNode.GetSize(); ++i) |
| 1841 delete m_childNode[i]; | 1845 delete m_childNode[i]; |
| 1842 m_childNode.RemoveAll(); | 1846 m_childNode.RemoveAll(); |
| 1843 } | 1847 } |
| OLD | NEW |