| 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 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 virtual FX_BOOL CryptStream(void* context, | 665 virtual FX_BOOL CryptStream(void* context, |
| 666 const uint8_t* src_buf, | 666 const uint8_t* src_buf, |
| 667 FX_DWORD src_size, | 667 FX_DWORD src_size, |
| 668 CFX_BinaryBuf& dest_buf, | 668 CFX_BinaryBuf& dest_buf, |
| 669 FX_BOOL bEncrypt); | 669 FX_BOOL bEncrypt); |
| 670 virtual FX_BOOL CryptFinish(void* context, | 670 virtual FX_BOOL CryptFinish(void* context, |
| 671 CFX_BinaryBuf& dest_buf, | 671 CFX_BinaryBuf& dest_buf, |
| 672 FX_BOOL bEncrypt); | 672 FX_BOOL bEncrypt); |
| 673 | 673 |
| 674 uint8_t m_EncryptKey[32]; | 674 uint8_t m_EncryptKey[32]; |
| 675 |
| 675 int m_KeyLen; | 676 int m_KeyLen; |
| 677 |
| 676 int m_Cipher; | 678 int m_Cipher; |
| 679 |
| 677 uint8_t* m_pAESContext; | 680 uint8_t* m_pAESContext; |
| 678 }; | 681 }; |
| 682 class CPDF_Point { |
| 683 public: |
| 684 CPDF_Point(FX_FLOAT xx, FX_FLOAT yy) { |
| 685 x = xx; |
| 686 y = yy; |
| 687 } |
| 679 | 688 |
| 689 FX_FLOAT x; |
| 690 |
| 691 FX_FLOAT y; |
| 692 }; |
| 693 |
| 694 #define CPDF_Rect CFX_FloatRect |
| 680 CFX_ByteString PDF_NameDecode(const CFX_ByteStringC& orig); | 695 CFX_ByteString PDF_NameDecode(const CFX_ByteStringC& orig); |
| 681 CFX_ByteString PDF_NameDecode(const CFX_ByteString& orig); | 696 CFX_ByteString PDF_NameDecode(const CFX_ByteString& orig); |
| 682 CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig); | 697 CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig); |
| 683 CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, | 698 CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, |
| 684 FX_BOOL bHex = FALSE); | 699 FX_BOOL bHex = FALSE); |
| 685 CFX_WideString PDF_DecodeText(const uint8_t* pData, FX_DWORD size); | 700 CFX_WideString PDF_DecodeText(const uint8_t* pData, FX_DWORD size); |
| 686 CFX_WideString PDF_DecodeText(const CFX_ByteString& bstr); | 701 CFX_WideString PDF_DecodeText(const CFX_ByteString& bstr); |
| 687 CFX_ByteString PDF_EncodeText(const FX_WCHAR* pString, int len = -1); | 702 CFX_ByteString PDF_EncodeText(const FX_WCHAR* pString, int len = -1); |
| 688 CFX_ByteString PDF_EncodeText(const CFX_WideString& str); | 703 CFX_ByteString PDF_EncodeText(const CFX_WideString& str); |
| 689 | 704 |
| 705 FX_FLOAT PDF_ClipFloat(FX_FLOAT f); |
| 690 class CFDF_Document : public CPDF_IndirectObjectHolder { | 706 class CFDF_Document : public CPDF_IndirectObjectHolder { |
| 691 public: | 707 public: |
| 692 static CFDF_Document* CreateNewDoc(); | 708 static CFDF_Document* CreateNewDoc(); |
| 693 static CFDF_Document* ParseFile(IFX_FileRead* pFile, | 709 static CFDF_Document* ParseFile(IFX_FileRead* pFile, |
| 694 FX_BOOL bOwnFile = FALSE); | 710 FX_BOOL bOwnFile = FALSE); |
| 695 static CFDF_Document* ParseMemory(const uint8_t* pData, FX_DWORD size); | 711 static CFDF_Document* ParseMemory(const uint8_t* pData, FX_DWORD size); |
| 712 |
| 696 ~CFDF_Document(); | 713 ~CFDF_Document(); |
| 697 | 714 |
| 698 FX_BOOL WriteBuf(CFX_ByteTextBuf& buf) const; | 715 FX_BOOL WriteBuf(CFX_ByteTextBuf& buf) const; |
| 716 |
| 699 CPDF_Dictionary* GetRoot() const { return m_pRootDict; } | 717 CPDF_Dictionary* GetRoot() const { return m_pRootDict; } |
| 700 | 718 |
| 701 protected: | 719 protected: |
| 702 CFDF_Document(); | 720 CFDF_Document(); |
| 703 void ParseStream(IFX_FileRead* pFile, FX_BOOL bOwnFile); | 721 void ParseStream(IFX_FileRead* pFile, FX_BOOL bOwnFile); |
| 704 | |
| 705 CPDF_Dictionary* m_pRootDict; | 722 CPDF_Dictionary* m_pRootDict; |
| 706 IFX_FileRead* m_pFile; | 723 IFX_FileRead* m_pFile; |
| 707 FX_BOOL m_bOwnFile; | 724 FX_BOOL m_bOwnFile; |
| 708 }; | 725 }; |
| 709 | 726 |
| 710 void FlateEncode(const uint8_t* src_buf, | 727 void FlateEncode(const uint8_t* src_buf, |
| 711 FX_DWORD src_size, | 728 FX_DWORD src_size, |
| 712 uint8_t*& dest_buf, | 729 uint8_t*& dest_buf, |
| 713 FX_DWORD& dest_size); | 730 FX_DWORD& dest_size); |
| 714 void FlateEncode(const uint8_t* src_buf, | 731 void FlateEncode(const uint8_t* src_buf, |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 FX_DWORD src_size, | 881 FX_DWORD src_size, |
| 865 const CPDF_Dictionary* pDict, | 882 const CPDF_Dictionary* pDict, |
| 866 uint8_t*& dest_buf, | 883 uint8_t*& dest_buf, |
| 867 FX_DWORD& dest_size, | 884 FX_DWORD& dest_size, |
| 868 CFX_ByteString& ImageEncoding, | 885 CFX_ByteString& ImageEncoding, |
| 869 CPDF_Dictionary*& pImageParms, | 886 CPDF_Dictionary*& pImageParms, |
| 870 FX_DWORD estimated_size, | 887 FX_DWORD estimated_size, |
| 871 FX_BOOL bImageAcc); | 888 FX_BOOL bImageAcc); |
| 872 | 889 |
| 873 #endif // CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_ | 890 #endif // CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_ |
| OLD | NEW |