| 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 _FXCRT_EXTENSION_IMP_ | 7 #ifndef _FXCRT_EXTENSION_IMP_ |
| 8 #define _FXCRT_EXTENSION_IMP_ | 8 #define _FXCRT_EXTENSION_IMP_ |
| 9 class IFXCRT_FileAccess | 9 class IFXCRT_FileAccess |
| 10 { | 10 { |
| 11 public: | 11 public: |
| 12 virtual ~IFXCRT_FileAccess() {} | 12 virtual ~IFXCRT_FileAccess() {} |
| 13 virtual FX_BOOL Open(FX_BSTR fileName, FX_DWORD dwMode) = 0; | 13 virtual FX_BOOL Open(FX_BSTR fileName, FX_DWORD dwMode) = 0; |
| 14 virtual FX_BOOL Open(FX_WSTR fileName, FX_DWORD dwMode) = 0; | 14 virtual FX_BOOL Open(FX_WSTR fileName, FX_DWORD dwMode) = 0; |
| 15 virtual void Close() = 0; | 15 virtual void Close() = 0; |
| 16 virtual void Release(IFX_Allocator* pAllocator = NULL) = 0; | 16 virtual void Release(IFX_Allocator* pAllocator = NULL) = 0; |
| 17 virtual FX_FILESIZE GetSize() const = 0; | 17 virtual FX_FILESIZE GetSize() const = 0; |
| 18 virtual FX_FILESIZE GetPosition() const = 0; | 18 virtual FX_FILESIZE GetPosition() const = 0; |
| 19 virtual FX_FILESIZE SetPosition(FX_FILESIZE pos) = 0; | 19 virtual FX_FILESIZE SetPosition(FX_FILESIZE pos) = 0; |
| 20 virtual size_t Read(void* pBuffer, size_t szBuffer) = 0; | 20 virtual size_t Read(void* pBuffer, size_t szBuffer) = 0; |
| 21 virtual size_t Write(const void* pBuffer, size_t szBuffer) = 0; | 21 virtual size_t Write(const void* pBuffer, size_t szBuffer) = 0; |
| 22 virtual size_t ReadPos(void* pBuffer, size_t szBuffer, FX_FILES
IZE pos) = 0; | 22 virtual size_t ReadPos(void* pBuffer, size_t szBuffer, FX_FILES
IZE pos) = 0; |
| 23 virtual size_t WritePos(const void* pBuffer, size_t szBuffer, F
X_FILESIZE pos) = 0; | 23 virtual size_t WritePos(const void* pBuffer, size_t szBuffer, F
X_FILESIZE pos) = 0; |
| 24 virtual FX_BOOL Flush() = 0; | 24 virtual FX_BOOL Flush() = 0; |
| 25 virtual FX_BOOL Truncate(FX_FILESIZE szFile) = 0; | 25 virtual FX_BOOL Truncate(FX_FILESIZE szFile) = 0; |
| 26 }; | 26 }; |
| 27 IFXCRT_FileAccess* FXCRT_FileAccess_Create(IFX_Allocator* pAllocator = NULL
); | 27 IFXCRT_FileAccess* FXCRT_FileAccess_Create(IFX_Allocator* pAllocator = NULL
); |
| 28 class CFX_CRTFileStream : public IFX_FileStream, public CFX_Object | 28 class CFX_CRTFileStream FX_FINAL : public IFX_FileStream, public CFX_Object |
| 29 { | 29 { |
| 30 public: | 30 public: |
| 31 CFX_CRTFileStream(IFXCRT_FileAccess* pFA, IFX_Allocator* pAllocator) : m_pAl
locator(pAllocator), m_pFile(pFA), m_dwCount(1), m_bUseRange(FALSE), m_nOffset(0
), m_nSize(0) {} | 31 CFX_CRTFileStream(IFXCRT_FileAccess* pFA, IFX_Allocator* pAllocator) : m_pAl
locator(pAllocator), m_pFile(pFA), m_dwCount(1), m_bUseRange(FALSE), m_nOffset(0
), m_nSize(0) {} |
| 32 ~CFX_CRTFileStream() | 32 ~CFX_CRTFileStream() |
| 33 { | 33 { |
| 34 if (m_pFile) { | 34 if (m_pFile) { |
| 35 m_pFile->Release(m_pAllocator); | 35 m_pFile->Release(m_pAllocator); |
| 36 } | 36 } |
| 37 } | 37 } |
| 38 virtual IFX_FileStream* Retain() | 38 virtual IFX_FileStream* Retain() |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 IFX_Allocator* m_pAllocator; | 115 IFX_Allocator* m_pAllocator; |
| 116 IFXCRT_FileAccess* m_pFile; | 116 IFXCRT_FileAccess* m_pFile; |
| 117 FX_DWORD m_dwCount; | 117 FX_DWORD m_dwCount; |
| 118 FX_BOOL m_bUseRange; | 118 FX_BOOL m_bUseRange; |
| 119 FX_FILESIZE m_nOffset; | 119 FX_FILESIZE m_nOffset; |
| 120 FX_FILESIZE m_nSize; | 120 FX_FILESIZE m_nSize; |
| 121 }; | 121 }; |
| 122 #define FX_MEMSTREAM_BlockSize (64 * 1024) | 122 #define FX_MEMSTREAM_BlockSize (64 * 1024) |
| 123 #define FX_MEMSTREAM_Consecutive 0x01 | 123 #define FX_MEMSTREAM_Consecutive 0x01 |
| 124 #define FX_MEMSTREAM_TakeOver 0x02 | 124 #define FX_MEMSTREAM_TakeOver 0x02 |
| 125 class CFX_MemoryStream : public IFX_MemoryStream, public CFX_Object | 125 class CFX_MemoryStream FX_FINAL : public IFX_MemoryStream, public CFX_Object |
| 126 { | 126 { |
| 127 public: | 127 public: |
| 128 CFX_MemoryStream(FX_BOOL bConsecutive, IFX_Allocator* pAllocator) | 128 CFX_MemoryStream(FX_BOOL bConsecutive, IFX_Allocator* pAllocator) |
| 129 : m_Blocks(pAllocator) | 129 : m_Blocks(pAllocator) |
| 130 , m_dwCount(1) | 130 , m_dwCount(1) |
| 131 , m_nTotalSize(0) | 131 , m_nTotalSize(0) |
| 132 , m_nCurSize(0) | 132 , m_nCurSize(0) |
| 133 , m_nCurPos(0) | 133 , m_nCurPos(0) |
| 134 , m_nGrowSize(FX_MEMSTREAM_BlockSize) | 134 , m_nGrowSize(FX_MEMSTREAM_BlockSize) |
| 135 , m_bUseRange(FALSE) | 135 , m_bUseRange(FALSE) |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 FX_DWORD mt[MT_N]; | 404 FX_DWORD mt[MT_N]; |
| 405 } FX_MTRANDOMCONTEXT, * FX_LPMTRANDOMCONTEXT; | 405 } FX_MTRANDOMCONTEXT, * FX_LPMTRANDOMCONTEXT; |
| 406 typedef FX_MTRANDOMCONTEXT const * FX_LPCMTRANDOMCONTEXT; | 406 typedef FX_MTRANDOMCONTEXT const * FX_LPCMTRANDOMCONTEXT; |
| 407 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 407 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
| 408 FX_BOOL FX_GenerateCryptoRandom(FX_LPDWORD pBuffer, FX_INT32 iCount); | 408 FX_BOOL FX_GenerateCryptoRandom(FX_LPDWORD pBuffer, FX_INT32 iCount); |
| 409 #endif | 409 #endif |
| 410 #ifdef __cplusplus | 410 #ifdef __cplusplus |
| 411 } | 411 } |
| 412 #endif | 412 #endif |
| 413 #endif | 413 #endif |
| OLD | NEW |