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 | 9 |
10 #include "fx_safe_types.h" | 10 #include "fx_safe_types.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 virtual FX_FILESIZE GetPosition() const = 0; | 21 virtual FX_FILESIZE GetPosition() const = 0; |
22 virtual FX_FILESIZE SetPosition(FX_FILESIZE pos) = 0; | 22 virtual FX_FILESIZE SetPosition(FX_FILESIZE pos) = 0; |
23 virtual size_t Read(void* pBuffer, size_t szBuffer) = 0; | 23 virtual size_t Read(void* pBuffer, size_t szBuffer) = 0; |
24 virtual size_t Write(const void* pBuffer, size_t szBuffer) = 0; | 24 virtual size_t Write(const void* pBuffer, size_t szBuffer) = 0; |
25 virtual size_t ReadPos(void* pBuffer, size_t szBuffer, FX_FILES
IZE pos) = 0; | 25 virtual size_t ReadPos(void* pBuffer, size_t szBuffer, FX_FILES
IZE pos) = 0; |
26 virtual size_t WritePos(const void* pBuffer, size_t szBuffer, F
X_FILESIZE pos) = 0; | 26 virtual size_t WritePos(const void* pBuffer, size_t szBuffer, F
X_FILESIZE pos) = 0; |
27 virtual FX_BOOL Flush() = 0; | 27 virtual FX_BOOL Flush() = 0; |
28 virtual FX_BOOL Truncate(FX_FILESIZE szFile) = 0; | 28 virtual FX_BOOL Truncate(FX_FILESIZE szFile) = 0; |
29 }; | 29 }; |
30 IFXCRT_FileAccess* FXCRT_FileAccess_Create(); | 30 IFXCRT_FileAccess* FXCRT_FileAccess_Create(); |
31 class CFX_CRTFileStream FX_FINAL : public IFX_FileStream, public CFX_Object | 31 class CFX_CRTFileStream FX_FINAL : public IFX_FileStream |
32 { | 32 { |
33 public: | 33 public: |
34 CFX_CRTFileStream(IFXCRT_FileAccess* pFA) : m_pFile(pFA), m_dwCount(1), m_bU
seRange(FALSE), m_nOffset(0), m_nSize(0) {} | 34 CFX_CRTFileStream(IFXCRT_FileAccess* pFA) : m_pFile(pFA), m_dwCount(1), m_bU
seRange(FALSE), m_nOffset(0), m_nSize(0) {} |
35 ~CFX_CRTFileStream() | 35 ~CFX_CRTFileStream() |
36 { | 36 { |
37 if (m_pFile) { | 37 if (m_pFile) { |
38 m_pFile->Release(); | 38 m_pFile->Release(); |
39 } | 39 } |
40 } | 40 } |
41 virtual IFX_FileStream* Retain() FX_OVERRIDE | 41 virtual IFX_FileStream* Retain() FX_OVERRIDE |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 } | 126 } |
127 IFXCRT_FileAccess* m_pFile; | 127 IFXCRT_FileAccess* m_pFile; |
128 FX_DWORD m_dwCount; | 128 FX_DWORD m_dwCount; |
129 FX_BOOL m_bUseRange; | 129 FX_BOOL m_bUseRange; |
130 FX_FILESIZE m_nOffset; | 130 FX_FILESIZE m_nOffset; |
131 FX_FILESIZE m_nSize; | 131 FX_FILESIZE m_nSize; |
132 }; | 132 }; |
133 #define FX_MEMSTREAM_BlockSize (64 * 1024) | 133 #define FX_MEMSTREAM_BlockSize (64 * 1024) |
134 #define FX_MEMSTREAM_Consecutive 0x01 | 134 #define FX_MEMSTREAM_Consecutive 0x01 |
135 #define FX_MEMSTREAM_TakeOver 0x02 | 135 #define FX_MEMSTREAM_TakeOver 0x02 |
136 class CFX_MemoryStream FX_FINAL : public IFX_MemoryStream, public CFX_Object | 136 class CFX_MemoryStream FX_FINAL : public IFX_MemoryStream |
137 { | 137 { |
138 public: | 138 public: |
139 CFX_MemoryStream(FX_BOOL bConsecutive) | 139 CFX_MemoryStream(FX_BOOL bConsecutive) |
140 : m_dwCount(1) | 140 : m_dwCount(1) |
141 , m_nTotalSize(0) | 141 , m_nTotalSize(0) |
142 , m_nCurSize(0) | 142 , m_nCurSize(0) |
143 , m_nCurPos(0) | 143 , m_nCurPos(0) |
144 , m_nGrowSize(FX_MEMSTREAM_BlockSize) | 144 , m_nGrowSize(FX_MEMSTREAM_BlockSize) |
145 , m_bUseRange(FALSE) | 145 , m_bUseRange(FALSE) |
146 { | 146 { |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 FX_DWORD mt[MT_N]; | 435 FX_DWORD mt[MT_N]; |
436 } FX_MTRANDOMCONTEXT, * FX_LPMTRANDOMCONTEXT; | 436 } FX_MTRANDOMCONTEXT, * FX_LPMTRANDOMCONTEXT; |
437 typedef FX_MTRANDOMCONTEXT const * FX_LPCMTRANDOMCONTEXT; | 437 typedef FX_MTRANDOMCONTEXT const * FX_LPCMTRANDOMCONTEXT; |
438 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 438 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
439 FX_BOOL FX_GenerateCryptoRandom(FX_LPDWORD pBuffer, FX_INT32 iCount); | 439 FX_BOOL FX_GenerateCryptoRandom(FX_LPDWORD pBuffer, FX_INT32 iCount); |
440 #endif | 440 #endif |
441 #ifdef __cplusplus | 441 #ifdef __cplusplus |
442 } | 442 } |
443 #endif | 443 #endif |
444 #endif | 444 #endif |
OLD | NEW |