| 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 #ifndef CORE_FPDFAPI_PARSER_CPDF_SYNTAX_PARSER_H_ | 7 #ifndef CORE_FPDFAPI_PARSER_CPDF_SYNTAX_PARSER_H_ |
| 8 #define CORE_FPDFAPI_PARSER_CPDF_SYNTAX_PARSER_H_ | 8 #define CORE_FPDFAPI_PARSER_CPDF_SYNTAX_PARSER_H_ |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "core/fxcrt/cfx_string_pool_template.h" | 12 #include "core/fxcrt/cfx_string_pool_template.h" |
| 13 #include "core/fxcrt/cfx_weak_ptr.h" | 13 #include "core/fxcrt/cfx_weak_ptr.h" |
| 14 #include "core/fxcrt/fx_basic.h" | 14 #include "core/fxcrt/fx_basic.h" |
| 15 | 15 |
| 16 class CPDF_CryptoHandler; | 16 class CPDF_CryptoHandler; |
| 17 class CPDF_Dictionary; | 17 class CPDF_Dictionary; |
| 18 class CPDF_IndirectObjectHolder; | 18 class CPDF_IndirectObjectHolder; |
| 19 class CPDF_Object; | 19 class CPDF_Object; |
| 20 class CPDF_Stream; | 20 class CPDF_Stream; |
| 21 class IFX_SeekableReadStream; | 21 class IFX_SeekableReadStream; |
| 22 | 22 |
| 23 class CPDF_SyntaxParser { | 23 class CPDF_SyntaxParser { |
| 24 public: | 24 public: |
| 25 CPDF_SyntaxParser(); | 25 CPDF_SyntaxParser(); |
| 26 explicit CPDF_SyntaxParser(const CFX_WeakPtr<CFX_ByteStringPool>& pPool); | 26 explicit CPDF_SyntaxParser(const CFX_WeakPtr<CFX_ByteStringPool>& pPool); |
| 27 ~CPDF_SyntaxParser(); | 27 ~CPDF_SyntaxParser(); |
| 28 | 28 |
| 29 void InitParser(IFX_SeekableReadStream* pFileAccess, uint32_t HeaderOffset); | 29 void InitParser(const CFX_RetainPtr<IFX_SeekableReadStream>& pFileAccess, |
| 30 uint32_t HeaderOffset); |
| 31 |
| 30 FX_FILESIZE SavePos() const { return m_Pos; } | 32 FX_FILESIZE SavePos() const { return m_Pos; } |
| 31 void RestorePos(FX_FILESIZE pos) { m_Pos = pos; } | 33 void RestorePos(FX_FILESIZE pos) { m_Pos = pos; } |
| 32 | 34 |
| 33 std::unique_ptr<CPDF_Object> GetObject(CPDF_IndirectObjectHolder* pObjList, | 35 std::unique_ptr<CPDF_Object> GetObject(CPDF_IndirectObjectHolder* pObjList, |
| 34 uint32_t objnum, | 36 uint32_t objnum, |
| 35 uint32_t gennum, | 37 uint32_t gennum, |
| 36 bool bDecrypt); | 38 bool bDecrypt); |
| 37 | 39 |
| 38 std::unique_ptr<CPDF_Object> GetObjectForStrict( | 40 std::unique_ptr<CPDF_Object> GetObjectForStrict( |
| 39 CPDF_IndirectObjectHolder* pObjList, | 41 CPDF_IndirectObjectHolder* pObjList, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 uint32_t objnum, | 82 uint32_t objnum, |
| 81 uint32_t gennum); | 83 uint32_t gennum); |
| 82 | 84 |
| 83 inline bool CheckPosition(FX_FILESIZE pos) { | 85 inline bool CheckPosition(FX_FILESIZE pos) { |
| 84 return m_BufOffset >= pos || | 86 return m_BufOffset >= pos || |
| 85 static_cast<FX_FILESIZE>(m_BufOffset + m_BufSize) <= pos; | 87 static_cast<FX_FILESIZE>(m_BufOffset + m_BufSize) <= pos; |
| 86 } | 88 } |
| 87 | 89 |
| 88 FX_FILESIZE m_Pos; | 90 FX_FILESIZE m_Pos; |
| 89 uint32_t m_MetadataObjnum; | 91 uint32_t m_MetadataObjnum; |
| 90 IFX_SeekableReadStream* m_pFileAccess; | 92 CFX_RetainPtr<IFX_SeekableReadStream> m_pFileAccess; |
| 91 FX_FILESIZE m_HeaderOffset; | 93 FX_FILESIZE m_HeaderOffset; |
| 92 FX_FILESIZE m_FileLen; | 94 FX_FILESIZE m_FileLen; |
| 93 uint8_t* m_pFileBuf; | 95 uint8_t* m_pFileBuf; |
| 94 uint32_t m_BufSize; | 96 uint32_t m_BufSize; |
| 95 FX_FILESIZE m_BufOffset; | 97 FX_FILESIZE m_BufOffset; |
| 96 std::unique_ptr<CPDF_CryptoHandler> m_pCryptoHandler; | 98 std::unique_ptr<CPDF_CryptoHandler> m_pCryptoHandler; |
| 97 uint8_t m_WordBuffer[257]; | 99 uint8_t m_WordBuffer[257]; |
| 98 uint32_t m_WordSize; | 100 uint32_t m_WordSize; |
| 99 CFX_WeakPtr<CFX_ByteStringPool> m_pPool; | 101 CFX_WeakPtr<CFX_ByteStringPool> m_pPool; |
| 100 }; | 102 }; |
| 101 | 103 |
| 102 #endif // CORE_FPDFAPI_PARSER_CPDF_SYNTAX_PARSER_H_ | 104 #endif // CORE_FPDFAPI_PARSER_CPDF_SYNTAX_PARSER_H_ |
| OLD | NEW |