| 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> |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 ~CPDF_SyntaxParser(); | 27 ~CPDF_SyntaxParser(); |
| 28 | 28 |
| 29 void InitParser(IFX_SeekableReadStream* pFileAccess, uint32_t HeaderOffset); | 29 void InitParser(IFX_SeekableReadStream* pFileAccess, uint32_t HeaderOffset); |
| 30 | 30 |
| 31 FX_FILESIZE SavePos() const { return m_Pos; } | 31 FX_FILESIZE SavePos() const { return m_Pos; } |
| 32 void RestorePos(FX_FILESIZE pos) { m_Pos = pos; } | 32 void RestorePos(FX_FILESIZE pos) { m_Pos = pos; } |
| 33 | 33 |
| 34 CPDF_Object* GetObject(CPDF_IndirectObjectHolder* pObjList, | 34 CPDF_Object* GetObject(CPDF_IndirectObjectHolder* pObjList, |
| 35 uint32_t objnum, | 35 uint32_t objnum, |
| 36 uint32_t gennum, | 36 uint32_t gennum, |
| 37 FX_BOOL bDecrypt); | 37 bool bDecrypt); |
| 38 CPDF_Object* GetObjectForStrict(CPDF_IndirectObjectHolder* pObjList, | 38 CPDF_Object* GetObjectForStrict(CPDF_IndirectObjectHolder* pObjList, |
| 39 uint32_t objnum, | 39 uint32_t objnum, |
| 40 uint32_t gennum); | 40 uint32_t gennum); |
| 41 CFX_ByteString GetKeyword(); | 41 CFX_ByteString GetKeyword(); |
| 42 | 42 |
| 43 void ToNextLine(); | 43 void ToNextLine(); |
| 44 void ToNextWord(); | 44 void ToNextWord(); |
| 45 | 45 |
| 46 FX_BOOL SearchWord(const CFX_ByteStringC& word, | 46 bool SearchWord(const CFX_ByteStringC& word, |
| 47 FX_BOOL bWholeWord, | 47 bool bWholeWord, |
| 48 FX_BOOL bForward, | 48 bool bForward, |
| 49 FX_FILESIZE limit); | 49 FX_FILESIZE limit); |
| 50 int SearchMultiWord(const CFX_ByteStringC& words, | 50 int SearchMultiWord(const CFX_ByteStringC& words, |
| 51 FX_BOOL bWholeWord, | 51 bool bWholeWord, |
| 52 FX_FILESIZE limit); | 52 FX_FILESIZE limit); |
| 53 FX_FILESIZE FindTag(const CFX_ByteStringC& tag, FX_FILESIZE limit); | 53 FX_FILESIZE FindTag(const CFX_ByteStringC& tag, FX_FILESIZE limit); |
| 54 | 54 |
| 55 void SetEncrypt(std::unique_ptr<CPDF_CryptoHandler> pCryptoHandler); | 55 void SetEncrypt(std::unique_ptr<CPDF_CryptoHandler> pCryptoHandler); |
| 56 | 56 |
| 57 FX_BOOL ReadBlock(uint8_t* pBuf, uint32_t size); | 57 bool ReadBlock(uint8_t* pBuf, uint32_t size); |
| 58 FX_BOOL GetCharAt(FX_FILESIZE pos, uint8_t& ch); | 58 bool GetCharAt(FX_FILESIZE pos, uint8_t& ch); |
| 59 CFX_ByteString GetNextWord(bool* bIsNumber); | 59 CFX_ByteString GetNextWord(bool* bIsNumber); |
| 60 | 60 |
| 61 private: | 61 private: |
| 62 friend class CPDF_Parser; | 62 friend class CPDF_Parser; |
| 63 friend class CPDF_DataAvail; | 63 friend class CPDF_DataAvail; |
| 64 friend class cpdf_syntax_parser_ReadHexString_Test; | 64 friend class cpdf_syntax_parser_ReadHexString_Test; |
| 65 | 65 |
| 66 static const int kParserMaxRecursionDepth = 64; | 66 static const int kParserMaxRecursionDepth = 64; |
| 67 static int s_CurrentRecursionDepth; | 67 static int s_CurrentRecursionDepth; |
| 68 | 68 |
| 69 uint32_t GetDirectNum(); | 69 uint32_t GetDirectNum(); |
| 70 FX_BOOL GetNextChar(uint8_t& ch); | 70 bool GetNextChar(uint8_t& ch); |
| 71 FX_BOOL GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch); | 71 bool GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch); |
| 72 void GetNextWordInternal(bool* bIsNumber); | 72 void GetNextWordInternal(bool* bIsNumber); |
| 73 bool IsWholeWord(FX_FILESIZE startpos, | 73 bool IsWholeWord(FX_FILESIZE startpos, |
| 74 FX_FILESIZE limit, | 74 FX_FILESIZE limit, |
| 75 const CFX_ByteStringC& tag, | 75 const CFX_ByteStringC& tag, |
| 76 FX_BOOL checkKeyword); | 76 bool checkKeyword); |
| 77 | 77 |
| 78 CFX_ByteString ReadString(); | 78 CFX_ByteString ReadString(); |
| 79 CFX_ByteString ReadHexString(); | 79 CFX_ByteString ReadHexString(); |
| 80 unsigned int ReadEOLMarkers(FX_FILESIZE pos); | 80 unsigned int ReadEOLMarkers(FX_FILESIZE pos); |
| 81 CPDF_Stream* ReadStream(CPDF_Dictionary* pDict, | 81 CPDF_Stream* ReadStream(CPDF_Dictionary* pDict, |
| 82 uint32_t objnum, | 82 uint32_t objnum, |
| 83 uint32_t gennum); | 83 uint32_t gennum); |
| 84 | 84 |
| 85 CFX_ByteString MaybeIntern(const CFX_ByteString& str); | 85 CFX_ByteString MaybeIntern(const CFX_ByteString& str); |
| 86 | 86 |
| 87 FX_FILESIZE m_Pos; | 87 FX_FILESIZE m_Pos; |
| 88 int m_MetadataObjnum; | 88 int m_MetadataObjnum; |
| 89 IFX_SeekableReadStream* m_pFileAccess; | 89 IFX_SeekableReadStream* m_pFileAccess; |
| 90 FX_FILESIZE m_HeaderOffset; | 90 FX_FILESIZE m_HeaderOffset; |
| 91 FX_FILESIZE m_FileLen; | 91 FX_FILESIZE m_FileLen; |
| 92 uint8_t* m_pFileBuf; | 92 uint8_t* m_pFileBuf; |
| 93 uint32_t m_BufSize; | 93 uint32_t m_BufSize; |
| 94 FX_FILESIZE m_BufOffset; | 94 FX_FILESIZE m_BufOffset; |
| 95 std::unique_ptr<CPDF_CryptoHandler> m_pCryptoHandler; | 95 std::unique_ptr<CPDF_CryptoHandler> m_pCryptoHandler; |
| 96 uint8_t m_WordBuffer[257]; | 96 uint8_t m_WordBuffer[257]; |
| 97 uint32_t m_WordSize; | 97 uint32_t m_WordSize; |
| 98 CFX_WeakPtr<CFX_ByteStringPool> m_pPool; | 98 CFX_WeakPtr<CFX_ByteStringPool> m_pPool; |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 #endif // CORE_FPDFAPI_PARSER_CPDF_SYNTAX_PARSER_H_ | 101 #endif // CORE_FPDFAPI_PARSER_CPDF_SYNTAX_PARSER_H_ |
| OLD | NEW |