| 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 #ifndef CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_ | 7 #ifndef CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_ |
| 8 #define CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_ | 8 #define CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_ |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 void SetEncrypt(CPDF_CryptoHandler* pCryptoHandler) { | 281 void SetEncrypt(CPDF_CryptoHandler* pCryptoHandler) { |
| 282 m_pCryptoHandler.reset(pCryptoHandler); | 282 m_pCryptoHandler.reset(pCryptoHandler); |
| 283 } | 283 } |
| 284 | 284 |
| 285 FX_BOOL IsEncrypted() { return m_pCryptoHandler != NULL; } | 285 FX_BOOL IsEncrypted() { return m_pCryptoHandler != NULL; } |
| 286 | 286 |
| 287 FX_BOOL GetCharAt(FX_FILESIZE pos, uint8_t& ch); | 287 FX_BOOL GetCharAt(FX_FILESIZE pos, uint8_t& ch); |
| 288 | 288 |
| 289 FX_BOOL ReadBlock(uint8_t* pBuf, FX_DWORD size); | 289 FX_BOOL ReadBlock(uint8_t* pBuf, FX_DWORD size); |
| 290 | 290 |
| 291 CFX_ByteString GetNextWord(FX_BOOL& bIsNumber); | 291 CFX_ByteString GetNextWord(bool* bIsNumber); |
| 292 | 292 |
| 293 protected: | 293 protected: |
| 294 friend class CPDF_Parser; | 294 friend class CPDF_Parser; |
| 295 friend class CPDF_DataAvail; | 295 friend class CPDF_DataAvail; |
| 296 friend class fpdf_parser_parser_ReadHexString_Test; | 296 friend class fpdf_parser_parser_ReadHexString_Test; |
| 297 | 297 |
| 298 static const int kParserMaxRecursionDepth = 64; | 298 static const int kParserMaxRecursionDepth = 64; |
| 299 static int s_CurrentRecursionDepth; | 299 static int s_CurrentRecursionDepth; |
| 300 | 300 |
| 301 virtual FX_BOOL GetNextChar(uint8_t& ch); | 301 virtual FX_BOOL GetNextChar(uint8_t& ch); |
| 302 | 302 |
| 303 FX_BOOL GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch); | 303 FX_BOOL GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch); |
| 304 | 304 |
| 305 void GetNextWord(); | 305 void GetNextWordInternal(bool* bIsNumber); |
| 306 | 306 |
| 307 bool IsWholeWord(FX_FILESIZE startpos, | 307 bool IsWholeWord(FX_FILESIZE startpos, |
| 308 FX_FILESIZE limit, | 308 FX_FILESIZE limit, |
| 309 const CFX_ByteStringC& tag, | 309 const CFX_ByteStringC& tag, |
| 310 FX_BOOL checkKeyword); | 310 FX_BOOL checkKeyword); |
| 311 | 311 |
| 312 CFX_ByteString ReadString(); | 312 CFX_ByteString ReadString(); |
| 313 | 313 |
| 314 CFX_ByteString ReadHexString(); | 314 CFX_ByteString ReadHexString(); |
| 315 | 315 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 337 FX_DWORD m_BufSize; | 337 FX_DWORD m_BufSize; |
| 338 | 338 |
| 339 FX_FILESIZE m_BufOffset; | 339 FX_FILESIZE m_BufOffset; |
| 340 | 340 |
| 341 std::unique_ptr<CPDF_CryptoHandler> m_pCryptoHandler; | 341 std::unique_ptr<CPDF_CryptoHandler> m_pCryptoHandler; |
| 342 | 342 |
| 343 uint8_t m_WordBuffer[257]; | 343 uint8_t m_WordBuffer[257]; |
| 344 | 344 |
| 345 FX_DWORD m_WordSize; | 345 FX_DWORD m_WordSize; |
| 346 | 346 |
| 347 FX_BOOL m_bIsNumber; | |
| 348 | |
| 349 FX_FILESIZE m_dwWordPos; | 347 FX_FILESIZE m_dwWordPos; |
| 350 }; | 348 }; |
| 351 | 349 |
| 352 #define PDFPARSE_TYPEONLY 1 | 350 #define PDFPARSE_TYPEONLY 1 |
| 353 #define PDFPARSE_NOSTREAM 2 | 351 #define PDFPARSE_NOSTREAM 2 |
| 354 struct PARSE_CONTEXT { | 352 struct PARSE_CONTEXT { |
| 355 uint32_t m_Flags; | 353 uint32_t m_Flags; |
| 356 FX_FILESIZE m_DictStart; | 354 FX_FILESIZE m_DictStart; |
| 357 FX_FILESIZE m_DictEnd; | 355 FX_FILESIZE m_DictEnd; |
| 358 FX_FILESIZE m_DataStart; | 356 FX_FILESIZE m_DataStart; |
| (...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 977 FX_DWORD src_size, | 975 FX_DWORD src_size, |
| 978 const CPDF_Dictionary* pDict, | 976 const CPDF_Dictionary* pDict, |
| 979 uint8_t*& dest_buf, | 977 uint8_t*& dest_buf, |
| 980 FX_DWORD& dest_size, | 978 FX_DWORD& dest_size, |
| 981 CFX_ByteString& ImageEncoding, | 979 CFX_ByteString& ImageEncoding, |
| 982 CPDF_Dictionary*& pImageParms, | 980 CPDF_Dictionary*& pImageParms, |
| 983 FX_DWORD estimated_size, | 981 FX_DWORD estimated_size, |
| 984 FX_BOOL bImageAcc); | 982 FX_BOOL bImageAcc); |
| 985 | 983 |
| 986 #endif // CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_ | 984 #endif // CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_ |
| OLD | NEW |