| 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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 void SetEncrypt(CPDF_CryptoHandler* pCryptoHandler) { | 290 void SetEncrypt(CPDF_CryptoHandler* pCryptoHandler) { |
| 291 m_pCryptoHandler.reset(pCryptoHandler); | 291 m_pCryptoHandler.reset(pCryptoHandler); |
| 292 } | 292 } |
| 293 | 293 |
| 294 FX_BOOL IsEncrypted() { return m_pCryptoHandler != NULL; } | 294 FX_BOOL IsEncrypted() { return m_pCryptoHandler != NULL; } |
| 295 | 295 |
| 296 FX_BOOL GetCharAt(FX_FILESIZE pos, uint8_t& ch); | 296 FX_BOOL GetCharAt(FX_FILESIZE pos, uint8_t& ch); |
| 297 | 297 |
| 298 FX_BOOL ReadBlock(uint8_t* pBuf, FX_DWORD size); | 298 FX_BOOL ReadBlock(uint8_t* pBuf, FX_DWORD size); |
| 299 | 299 |
| 300 CFX_ByteString GetNextWord(FX_BOOL& bIsNumber); | 300 CFX_ByteString GetNextWord(bool* bIsNumber); |
| 301 | 301 |
| 302 protected: | 302 protected: |
| 303 friend class CPDF_Parser; | 303 friend class CPDF_Parser; |
| 304 friend class CPDF_DataAvail; | 304 friend class CPDF_DataAvail; |
| 305 friend class fpdf_parser_parser_ReadHexString_Test; | 305 friend class fpdf_parser_parser_ReadHexString_Test; |
| 306 | 306 |
| 307 static const int kParserMaxRecursionDepth = 64; | 307 static const int kParserMaxRecursionDepth = 64; |
| 308 static int s_CurrentRecursionDepth; | 308 static int s_CurrentRecursionDepth; |
| 309 | 309 |
| 310 virtual FX_BOOL GetNextChar(uint8_t& ch); | 310 virtual FX_BOOL GetNextChar(uint8_t& ch); |
| 311 | 311 |
| 312 FX_BOOL GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch); | 312 FX_BOOL GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch); |
| 313 | 313 |
| 314 void GetNextWord(); | 314 bool GetNextWordInternal(); |
| 315 | 315 |
| 316 bool IsWholeWord(FX_FILESIZE startpos, | 316 bool IsWholeWord(FX_FILESIZE startpos, |
| 317 FX_FILESIZE limit, | 317 FX_FILESIZE limit, |
| 318 const CFX_ByteStringC& tag, | 318 const CFX_ByteStringC& tag, |
| 319 FX_BOOL checkKeyword); | 319 FX_BOOL checkKeyword); |
| 320 | 320 |
| 321 CFX_ByteString ReadString(); | 321 CFX_ByteString ReadString(); |
| 322 | 322 |
| 323 CFX_ByteString ReadHexString(); | 323 CFX_ByteString ReadHexString(); |
| 324 | 324 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 346 FX_DWORD m_BufSize; | 346 FX_DWORD m_BufSize; |
| 347 | 347 |
| 348 FX_FILESIZE m_BufOffset; | 348 FX_FILESIZE m_BufOffset; |
| 349 | 349 |
| 350 std::unique_ptr<CPDF_CryptoHandler> m_pCryptoHandler; | 350 std::unique_ptr<CPDF_CryptoHandler> m_pCryptoHandler; |
| 351 | 351 |
| 352 uint8_t m_WordBuffer[257]; | 352 uint8_t m_WordBuffer[257]; |
| 353 | 353 |
| 354 FX_DWORD m_WordSize; | 354 FX_DWORD m_WordSize; |
| 355 | 355 |
| 356 FX_BOOL m_bIsNumber; | |
| 357 | |
| 358 FX_FILESIZE m_dwWordPos; | 356 FX_FILESIZE m_dwWordPos; |
| 359 }; | 357 }; |
| 360 | 358 |
| 361 #define PDFPARSE_TYPEONLY 1 | 359 #define PDFPARSE_TYPEONLY 1 |
| 362 #define PDFPARSE_NOSTREAM 2 | 360 #define PDFPARSE_NOSTREAM 2 |
| 363 struct PARSE_CONTEXT { | 361 struct PARSE_CONTEXT { |
| 364 uint32_t m_Flags; | 362 uint32_t m_Flags; |
| 365 FX_FILESIZE m_DictStart; | 363 FX_FILESIZE m_DictStart; |
| 366 FX_FILESIZE m_DictEnd; | 364 FX_FILESIZE m_DictEnd; |
| 367 FX_FILESIZE m_DataStart; | 365 FX_FILESIZE m_DataStart; |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 996 FX_DWORD src_size, | 994 FX_DWORD src_size, |
| 997 const CPDF_Dictionary* pDict, | 995 const CPDF_Dictionary* pDict, |
| 998 uint8_t*& dest_buf, | 996 uint8_t*& dest_buf, |
| 999 FX_DWORD& dest_size, | 997 FX_DWORD& dest_size, |
| 1000 CFX_ByteString& ImageEncoding, | 998 CFX_ByteString& ImageEncoding, |
| 1001 CPDF_Dictionary*& pImageParms, | 999 CPDF_Dictionary*& pImageParms, |
| 1002 FX_DWORD estimated_size, | 1000 FX_DWORD estimated_size, |
| 1003 FX_BOOL bImageAcc); | 1001 FX_BOOL bImageAcc); |
| 1004 | 1002 |
| 1005 #endif // CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_ | 1003 #endif // CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_ |
| OLD | NEW |