| 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_FXCRT_EXTENSION_H_ | 7 #ifndef CORE_FXCRT_EXTENSION_H_ |
| 8 #define CORE_FXCRT_EXTENSION_H_ | 8 #define CORE_FXCRT_EXTENSION_H_ |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 #ifdef PDF_ENABLE_XFA | 37 #ifdef PDF_ENABLE_XFA |
| 38 class CFX_CRTFileAccess : public IFX_FileAccess { | 38 class CFX_CRTFileAccess : public IFX_FileAccess { |
| 39 public: | 39 public: |
| 40 CFX_CRTFileAccess(); | 40 CFX_CRTFileAccess(); |
| 41 ~CFX_CRTFileAccess() override; | 41 ~CFX_CRTFileAccess() override; |
| 42 | 42 |
| 43 // IFX_FileAccess | 43 // IFX_FileAccess |
| 44 void Release() override; | 44 void Release() override; |
| 45 IFX_FileAccess* Retain() override; | 45 IFX_FileAccess* Retain() override; |
| 46 void GetPath(CFX_WideString& wsPath) override; | 46 void GetPath(CFX_WideString& wsPath) override; |
| 47 IFX_FileStream* CreateFileStream(uint32_t dwModes) override; | 47 IFX_SeekableStream* CreateFileStream(uint32_t dwModes) override; |
| 48 | 48 |
| 49 FX_BOOL Init(const CFX_WideStringC& wsPath); | 49 FX_BOOL Init(const CFX_WideStringC& wsPath); |
| 50 | 50 |
| 51 protected: | 51 protected: |
| 52 CFX_WideString m_path; | 52 CFX_WideString m_path; |
| 53 uint32_t m_RefCount; | 53 uint32_t m_RefCount; |
| 54 }; | 54 }; |
| 55 #endif // PDF_ENABLE_XFA | 55 #endif // PDF_ENABLE_XFA |
| 56 | 56 |
| 57 class CFX_CRTFileStream final : public IFX_FileStream { | 57 class CFX_CRTFileStream final : public IFX_SeekableStream { |
| 58 public: | 58 public: |
| 59 explicit CFX_CRTFileStream(std::unique_ptr<IFXCRT_FileAccess> pFA); | 59 explicit CFX_CRTFileStream(std::unique_ptr<IFXCRT_FileAccess> pFA); |
| 60 ~CFX_CRTFileStream() override; | 60 ~CFX_CRTFileStream() override; |
| 61 | 61 |
| 62 // IFX_FileStream: | 62 // IFX_SeekableStream: |
| 63 IFX_FileStream* Retain() override; | 63 IFX_SeekableStream* Retain() override; |
| 64 void Release() override; | 64 void Release() override; |
| 65 FX_FILESIZE GetSize() override; | 65 FX_FILESIZE GetSize() override; |
| 66 FX_BOOL IsEOF() override; | 66 FX_BOOL IsEOF() override; |
| 67 FX_FILESIZE GetPosition() override; | 67 FX_FILESIZE GetPosition() override; |
| 68 FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override; | 68 FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override; |
| 69 size_t ReadBlock(void* buffer, size_t size) override; | 69 size_t ReadBlock(void* buffer, size_t size) override; |
| 70 FX_BOOL WriteBlock(const void* buffer, | 70 FX_BOOL WriteBlock(const void* buffer, |
| 71 FX_FILESIZE offset, | 71 FX_FILESIZE offset, |
| 72 size_t size) override; | 72 size_t size) override; |
| 73 FX_BOOL Flush() override; | 73 FX_BOOL Flush() override; |
| 74 | 74 |
| 75 protected: | 75 protected: |
| 76 std::unique_ptr<IFXCRT_FileAccess> m_pFile; | 76 std::unique_ptr<IFXCRT_FileAccess> m_pFile; |
| 77 uint32_t m_dwCount; | 77 uint32_t m_dwCount; |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 #define FX_MEMSTREAM_BlockSize (64 * 1024) | 80 #define FX_MEMSTREAM_BlockSize (64 * 1024) |
| 81 #define FX_MEMSTREAM_Consecutive 0x01 | 81 #define FX_MEMSTREAM_Consecutive 0x01 |
| 82 #define FX_MEMSTREAM_TakeOver 0x02 | 82 #define FX_MEMSTREAM_TakeOver 0x02 |
| 83 class CFX_MemoryStream final : public IFX_MemoryStream { | 83 class CFX_MemoryStream final : public IFX_MemoryStream { |
| 84 public: | 84 public: |
| 85 explicit CFX_MemoryStream(FX_BOOL bConsecutive); | 85 explicit CFX_MemoryStream(FX_BOOL bConsecutive); |
| 86 CFX_MemoryStream(uint8_t* pBuffer, size_t nSize, FX_BOOL bTakeOver); | 86 CFX_MemoryStream(uint8_t* pBuffer, size_t nSize, FX_BOOL bTakeOver); |
| 87 ~CFX_MemoryStream() override; | 87 ~CFX_MemoryStream() override; |
| 88 | 88 |
| 89 // IFX_MemoryStream | 89 // IFX_MemoryStream |
| 90 IFX_FileStream* Retain() override; | 90 IFX_SeekableStream* Retain() override; |
| 91 void Release() override; | 91 void Release() override; |
| 92 FX_FILESIZE GetSize() override; | 92 FX_FILESIZE GetSize() override; |
| 93 FX_BOOL IsEOF() override; | 93 FX_BOOL IsEOF() override; |
| 94 FX_FILESIZE GetPosition() override; | 94 FX_FILESIZE GetPosition() override; |
| 95 FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override; | 95 FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override; |
| 96 size_t ReadBlock(void* buffer, size_t size) override; | 96 size_t ReadBlock(void* buffer, size_t size) override; |
| 97 FX_BOOL WriteBlock(const void* buffer, | 97 FX_BOOL WriteBlock(const void* buffer, |
| 98 FX_FILESIZE offset, | 98 FX_FILESIZE offset, |
| 99 size_t size) override; | 99 size_t size) override; |
| 100 FX_BOOL Flush() override; | 100 FX_BOOL Flush() override; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 uint32_t mt[MT_N]; | 135 uint32_t mt[MT_N]; |
| 136 }; | 136 }; |
| 137 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 137 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
| 138 FX_BOOL FX_GenerateCryptoRandom(uint32_t* pBuffer, int32_t iCount); | 138 FX_BOOL FX_GenerateCryptoRandom(uint32_t* pBuffer, int32_t iCount); |
| 139 #endif | 139 #endif |
| 140 #ifdef __cplusplus | 140 #ifdef __cplusplus |
| 141 } | 141 } |
| 142 #endif | 142 #endif |
| 143 | 143 |
| 144 #endif // CORE_FXCRT_EXTENSION_H_ | 144 #endif // CORE_FXCRT_EXTENSION_H_ |
| OLD | NEW |