| 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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 | 254 |
| 255 void InitParser(IFX_FileRead* pFileAccess, FX_DWORD HeaderOffset); | 255 void InitParser(IFX_FileRead* pFileAccess, FX_DWORD HeaderOffset); |
| 256 | 256 |
| 257 FX_FILESIZE SavePos() { return m_Pos; } | 257 FX_FILESIZE SavePos() { return m_Pos; } |
| 258 | 258 |
| 259 void RestorePos(FX_FILESIZE pos) { m_Pos = pos; } | 259 void RestorePos(FX_FILESIZE pos) { m_Pos = pos; } |
| 260 | 260 |
| 261 CPDF_Object* GetObject(CPDF_IndirectObjectHolder* pObjList, | 261 CPDF_Object* GetObject(CPDF_IndirectObjectHolder* pObjList, |
| 262 FX_DWORD objnum, | 262 FX_DWORD objnum, |
| 263 FX_DWORD gennum, | 263 FX_DWORD gennum, |
| 264 PARSE_CONTEXT* pContext, | |
| 265 FX_BOOL bDecrypt); | 264 FX_BOOL bDecrypt); |
| 266 | 265 |
| 267 CPDF_Object* GetObjectByStrict(CPDF_IndirectObjectHolder* pObjList, | 266 CPDF_Object* GetObjectByStrict(CPDF_IndirectObjectHolder* pObjList, |
| 268 FX_DWORD objnum, | 267 FX_DWORD objnum, |
| 269 FX_DWORD gennum, | 268 FX_DWORD gennum); |
| 270 PARSE_CONTEXT* pContext); | |
| 271 | 269 |
| 272 int GetDirectNum(); | 270 int GetDirectNum(); |
| 273 | 271 |
| 274 CFX_ByteString GetString(FX_DWORD objnum, FX_DWORD gennum); | 272 CFX_ByteString GetString(FX_DWORD objnum, FX_DWORD gennum); |
| 275 | 273 |
| 276 CFX_ByteString GetName(); | 274 CFX_ByteString GetName(); |
| 277 | 275 |
| 278 CFX_ByteString GetKeyword(); | 276 CFX_ByteString GetKeyword(); |
| 279 | 277 |
| 280 void GetBinary(uint8_t* buffer, FX_DWORD size); | 278 void GetBinary(uint8_t* buffer, FX_DWORD size); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 const CFX_ByteStringC& tag, | 323 const CFX_ByteStringC& tag, |
| 326 FX_BOOL checkKeyword); | 324 FX_BOOL checkKeyword); |
| 327 | 325 |
| 328 CFX_ByteString ReadString(); | 326 CFX_ByteString ReadString(); |
| 329 | 327 |
| 330 CFX_ByteString ReadHexString(); | 328 CFX_ByteString ReadHexString(); |
| 331 | 329 |
| 332 unsigned int ReadEOLMarkers(FX_FILESIZE pos); | 330 unsigned int ReadEOLMarkers(FX_FILESIZE pos); |
| 333 | 331 |
| 334 CPDF_Stream* ReadStream(CPDF_Dictionary* pDict, | 332 CPDF_Stream* ReadStream(CPDF_Dictionary* pDict, |
| 335 PARSE_CONTEXT* pContext, | |
| 336 FX_DWORD objnum, | 333 FX_DWORD objnum, |
| 337 FX_DWORD gennum); | 334 FX_DWORD gennum); |
| 338 | 335 |
| 339 FX_FILESIZE m_Pos; | 336 FX_FILESIZE m_Pos; |
| 340 | 337 |
| 341 FX_BOOL m_bFileStream; | 338 FX_BOOL m_bFileStream; |
| 342 | 339 |
| 343 int m_MetadataObjnum; | 340 int m_MetadataObjnum; |
| 344 | 341 |
| 345 IFX_FileRead* m_pFileAccess; | 342 IFX_FileRead* m_pFileAccess; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 356 | 353 |
| 357 std::unique_ptr<CPDF_CryptoHandler> m_pCryptoHandler; | 354 std::unique_ptr<CPDF_CryptoHandler> m_pCryptoHandler; |
| 358 | 355 |
| 359 uint8_t m_WordBuffer[257]; | 356 uint8_t m_WordBuffer[257]; |
| 360 | 357 |
| 361 FX_DWORD m_WordSize; | 358 FX_DWORD m_WordSize; |
| 362 | 359 |
| 363 FX_FILESIZE m_dwWordPos; | 360 FX_FILESIZE m_dwWordPos; |
| 364 }; | 361 }; |
| 365 | 362 |
| 366 struct PARSE_CONTEXT { | |
| 367 FX_FILESIZE m_DictStart; | |
| 368 FX_FILESIZE m_DictEnd; | |
| 369 FX_FILESIZE m_DataStart; | |
| 370 FX_FILESIZE m_DataEnd; | |
| 371 }; | |
| 372 | |
| 373 #define PDFPARSE_ERROR_SUCCESS 0 | 363 #define PDFPARSE_ERROR_SUCCESS 0 |
| 374 #define PDFPARSE_ERROR_FILE 1 | 364 #define PDFPARSE_ERROR_FILE 1 |
| 375 #define PDFPARSE_ERROR_FORMAT 2 | 365 #define PDFPARSE_ERROR_FORMAT 2 |
| 376 #define PDFPARSE_ERROR_PASSWORD 3 | 366 #define PDFPARSE_ERROR_PASSWORD 3 |
| 377 #define PDFPARSE_ERROR_HANDLER 4 | 367 #define PDFPARSE_ERROR_HANDLER 4 |
| 378 #define PDFPARSE_ERROR_CERT 5 | 368 #define PDFPARSE_ERROR_CERT 5 |
| 379 | 369 |
| 380 class CPDF_Parser { | 370 class CPDF_Parser { |
| 381 public: | 371 public: |
| 382 CPDF_Parser(); | 372 CPDF_Parser(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 409 | 399 |
| 410 CPDF_Document* GetDocument() { return m_pDocument; } | 400 CPDF_Document* GetDocument() { return m_pDocument; } |
| 411 | 401 |
| 412 FX_DWORD GetRootObjNum(); | 402 FX_DWORD GetRootObjNum(); |
| 413 FX_DWORD GetInfoObjNum(); | 403 FX_DWORD GetInfoObjNum(); |
| 414 CPDF_Array* GetIDArray(); | 404 CPDF_Array* GetIDArray(); |
| 415 | 405 |
| 416 CPDF_Dictionary* GetEncryptDict() { return m_pEncryptDict; } | 406 CPDF_Dictionary* GetEncryptDict() { return m_pEncryptDict; } |
| 417 | 407 |
| 418 CPDF_Object* ParseIndirectObject(CPDF_IndirectObjectHolder* pObjList, | 408 CPDF_Object* ParseIndirectObject(CPDF_IndirectObjectHolder* pObjList, |
| 419 FX_DWORD objnum, | 409 FX_DWORD objnum); |
| 420 PARSE_CONTEXT* pContext = NULL); | 410 |
| 421 FX_DWORD GetLastObjNum() const; | 411 FX_DWORD GetLastObjNum() const; |
| 422 bool IsValidObjectNumber(FX_DWORD objnum) const; | 412 bool IsValidObjectNumber(FX_DWORD objnum) const; |
| 423 FX_BOOL IsFormStream(FX_DWORD objnum, FX_BOOL& bForm); | 413 FX_BOOL IsFormStream(FX_DWORD objnum, FX_BOOL& bForm); |
| 424 | 414 |
| 425 FX_FILESIZE GetObjectOffset(FX_DWORD objnum) const; | 415 FX_FILESIZE GetObjectOffset(FX_DWORD objnum) const; |
| 426 | 416 |
| 427 FX_FILESIZE GetObjectSize(FX_DWORD objnum) const; | 417 FX_FILESIZE GetObjectSize(FX_DWORD objnum) const; |
| 428 | 418 |
| 429 void GetIndirectBinary(FX_DWORD objnum, uint8_t*& pBuffer, FX_DWORD& size); | 419 void GetIndirectBinary(FX_DWORD objnum, uint8_t*& pBuffer, FX_DWORD& size); |
| 430 | 420 |
| 431 IFX_FileRead* GetFileAccess() const { return m_Syntax.m_pFileAccess; } | 421 IFX_FileRead* GetFileAccess() const { return m_Syntax.m_pFileAccess; } |
| 432 | 422 |
| 433 int GetFileVersion() const { return m_FileVersion; } | 423 int GetFileVersion() const { return m_FileVersion; } |
| 434 | 424 |
| 435 FX_BOOL IsXRefStream() const { return m_bXRefStream; } | 425 FX_BOOL IsXRefStream() const { return m_bXRefStream; } |
| 436 CPDF_Object* ParseIndirectObjectAt(CPDF_IndirectObjectHolder* pObjList, | 426 CPDF_Object* ParseIndirectObjectAt(CPDF_IndirectObjectHolder* pObjList, |
| 437 FX_FILESIZE pos, | 427 FX_FILESIZE pos, |
| 438 FX_DWORD objnum, | 428 FX_DWORD objnum); |
| 439 PARSE_CONTEXT* pContext); | |
| 440 | 429 |
| 441 CPDF_Object* ParseIndirectObjectAtByStrict( | 430 CPDF_Object* ParseIndirectObjectAtByStrict( |
| 442 CPDF_IndirectObjectHolder* pObjList, | 431 CPDF_IndirectObjectHolder* pObjList, |
| 443 FX_FILESIZE pos, | 432 FX_FILESIZE pos, |
| 444 FX_DWORD objnum, | 433 FX_DWORD objnum, |
| 445 PARSE_CONTEXT* pContext, | |
| 446 FX_FILESIZE* pResultPos); | 434 FX_FILESIZE* pResultPos); |
| 447 | 435 |
| 448 FX_DWORD StartAsynParse(IFX_FileRead* pFile, | 436 FX_DWORD StartAsynParse(IFX_FileRead* pFile, |
| 449 FX_BOOL bReParse = FALSE, | 437 FX_BOOL bReParse = FALSE, |
| 450 FX_BOOL bOwnFileRead = TRUE); | 438 FX_BOOL bOwnFileRead = TRUE); |
| 451 | 439 |
| 452 FX_DWORD GetFirstPageNo() { return m_dwFirstPageNo; } | 440 FX_DWORD GetFirstPageNo() { return m_dwFirstPageNo; } |
| 453 | 441 |
| 454 protected: | 442 protected: |
| 455 CPDF_Object* ParseDirect(CPDF_Object* pObj); | 443 CPDF_Object* ParseDirect(CPDF_Object* pObj); |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 993 FX_DWORD src_size, | 981 FX_DWORD src_size, |
| 994 const CPDF_Dictionary* pDict, | 982 const CPDF_Dictionary* pDict, |
| 995 uint8_t*& dest_buf, | 983 uint8_t*& dest_buf, |
| 996 FX_DWORD& dest_size, | 984 FX_DWORD& dest_size, |
| 997 CFX_ByteString& ImageEncoding, | 985 CFX_ByteString& ImageEncoding, |
| 998 CPDF_Dictionary*& pImageParms, | 986 CPDF_Dictionary*& pImageParms, |
| 999 FX_DWORD estimated_size, | 987 FX_DWORD estimated_size, |
| 1000 FX_BOOL bImageAcc); | 988 FX_BOOL bImageAcc); |
| 1001 | 989 |
| 1002 #endif // CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_ | 990 #endif // CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_ |
| OLD | NEW |