| 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() = 0; | 16 virtual void Release() = 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(); | 27 IFXCRT_FileAccess* FXCRT_FileAccess_Create(); |
| 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) : m_pFile(pFA), m_dwCount(1), m_bU
seRange(FALSE), m_nOffset(0), m_nSize(0) {} | 31 CFX_CRTFileStream(IFXCRT_FileAccess* pFA) : m_pFile(pFA), m_dwCount(1), m_bU
seRange(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(); | 35 m_pFile->Release(); |
| 36 } | 36 } |
| 37 } | 37 } |
| 38 virtual IFX_FileStream* Retain() | 38 virtual IFX_FileStream* Retain() |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 } | 110 } |
| 111 IFXCRT_FileAccess* m_pFile; | 111 IFXCRT_FileAccess* m_pFile; |
| 112 FX_DWORD m_dwCount; | 112 FX_DWORD m_dwCount; |
| 113 FX_BOOL m_bUseRange; | 113 FX_BOOL m_bUseRange; |
| 114 FX_FILESIZE m_nOffset; | 114 FX_FILESIZE m_nOffset; |
| 115 FX_FILESIZE m_nSize; | 115 FX_FILESIZE m_nSize; |
| 116 }; | 116 }; |
| 117 #define FX_MEMSTREAM_BlockSize (64 * 1024) | 117 #define FX_MEMSTREAM_BlockSize (64 * 1024) |
| 118 #define FX_MEMSTREAM_Consecutive 0x01 | 118 #define FX_MEMSTREAM_Consecutive 0x01 |
| 119 #define FX_MEMSTREAM_TakeOver 0x02 | 119 #define FX_MEMSTREAM_TakeOver 0x02 |
| 120 class CFX_MemoryStream : public IFX_MemoryStream, public CFX_Object | 120 class CFX_MemoryStream FX_FINAL : public IFX_MemoryStream, public CFX_Object |
| 121 { | 121 { |
| 122 public: | 122 public: |
| 123 CFX_MemoryStream(FX_BOOL bConsecutive) | 123 CFX_MemoryStream(FX_BOOL bConsecutive) |
| 124 : m_dwCount(1) | 124 : m_dwCount(1) |
| 125 , m_nTotalSize(0) | 125 , m_nTotalSize(0) |
| 126 , m_nCurSize(0) | 126 , m_nCurSize(0) |
| 127 , m_nCurPos(0) | 127 , m_nCurPos(0) |
| 128 , m_nGrowSize(FX_MEMSTREAM_BlockSize) | 128 , m_nGrowSize(FX_MEMSTREAM_BlockSize) |
| 129 , m_bUseRange(FALSE) | 129 , m_bUseRange(FALSE) |
| 130 { | 130 { |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 FX_DWORD mt[MT_N]; | 389 FX_DWORD mt[MT_N]; |
| 390 } FX_MTRANDOMCONTEXT, * FX_LPMTRANDOMCONTEXT; | 390 } FX_MTRANDOMCONTEXT, * FX_LPMTRANDOMCONTEXT; |
| 391 typedef FX_MTRANDOMCONTEXT const * FX_LPCMTRANDOMCONTEXT; | 391 typedef FX_MTRANDOMCONTEXT const * FX_LPCMTRANDOMCONTEXT; |
| 392 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 392 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
| 393 FX_BOOL FX_GenerateCryptoRandom(FX_LPDWORD pBuffer, FX_INT32 iCount); | 393 FX_BOOL FX_GenerateCryptoRandom(FX_LPDWORD pBuffer, FX_INT32 iCount); |
| 394 #endif | 394 #endif |
| 395 #ifdef __cplusplus | 395 #ifdef __cplusplus |
| 396 } | 396 } |
| 397 #endif | 397 #endif |
| 398 #endif | 398 #endif |
| OLD | NEW |