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_CRTFileAccess : public IFX_FileAccess, public CFX_Object | 31 class CFX_CRTFileAccess : public IFX_FileAccess |
32 { | 32 { |
33 public: | 33 public: |
34 CFX_CRTFileAccess() : m_RefCount(0) {} | 34 CFX_CRTFileAccess() : m_RefCount(0) {} |
35 | 35 |
36 virtual void Release() | 36 virtual void Release() |
37 { | 37 { |
38 if (--m_RefCount == 0) | 38 if (--m_RefCount == 0) |
39 delete this; | 39 delete this; |
40 } | 40 } |
41 | 41 |
(...skipping 17 matching lines...) Expand all Loading... |
59 | 59 |
60 virtual IFX_FileStream* CreateFileStream(FX_DWORD dwModes) | 60 virtual IFX_FileStream* CreateFileStream(FX_DWORD dwModes) |
61 { | 61 { |
62 return FX_CreateFileStream(m_path, dwModes); | 62 return FX_CreateFileStream(m_path, dwModes); |
63 } | 63 } |
64 | 64 |
65 protected: | 65 protected: |
66 CFX_WideString m_path; | 66 CFX_WideString m_path; |
67 FX_DWORD m_RefCount; | 67 FX_DWORD m_RefCount; |
68 }; | 68 }; |
69 class CFX_CRTFileStream FX_FINAL : public IFX_FileStream, public CFX_Object | 69 class CFX_CRTFileStream FX_FINAL : public IFX_FileStream |
70 { | 70 { |
71 public: | 71 public: |
72 CFX_CRTFileStream(IFXCRT_FileAccess* pFA) : m_pFile(pFA), m_dwCount(1), m_bU
seRange(FALSE), m_nOffset(0), m_nSize(0) {} | 72 CFX_CRTFileStream(IFXCRT_FileAccess* pFA) : m_pFile(pFA), m_dwCount(1), m_bU
seRange(FALSE), m_nOffset(0), m_nSize(0) {} |
73 ~CFX_CRTFileStream() | 73 ~CFX_CRTFileStream() |
74 { | 74 { |
75 if (m_pFile) { | 75 if (m_pFile) { |
76 m_pFile->Release(); | 76 m_pFile->Release(); |
77 } | 77 } |
78 } | 78 } |
79 virtual IFX_FileStream* Retain() FX_OVERRIDE | 79 virtual IFX_FileStream* Retain() FX_OVERRIDE |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 } | 164 } |
165 IFXCRT_FileAccess* m_pFile; | 165 IFXCRT_FileAccess* m_pFile; |
166 FX_DWORD m_dwCount; | 166 FX_DWORD m_dwCount; |
167 FX_BOOL m_bUseRange; | 167 FX_BOOL m_bUseRange; |
168 FX_FILESIZE m_nOffset; | 168 FX_FILESIZE m_nOffset; |
169 FX_FILESIZE m_nSize; | 169 FX_FILESIZE m_nSize; |
170 }; | 170 }; |
171 #define FX_MEMSTREAM_BlockSize (64 * 1024) | 171 #define FX_MEMSTREAM_BlockSize (64 * 1024) |
172 #define FX_MEMSTREAM_Consecutive 0x01 | 172 #define FX_MEMSTREAM_Consecutive 0x01 |
173 #define FX_MEMSTREAM_TakeOver 0x02 | 173 #define FX_MEMSTREAM_TakeOver 0x02 |
174 class CFX_MemoryStream FX_FINAL : public IFX_MemoryStream, public CFX_Object | 174 class CFX_MemoryStream FX_FINAL : public IFX_MemoryStream |
175 { | 175 { |
176 public: | 176 public: |
177 CFX_MemoryStream(FX_BOOL bConsecutive) | 177 CFX_MemoryStream(FX_BOOL bConsecutive) |
178 : m_dwCount(1) | 178 : m_dwCount(1) |
179 , m_nTotalSize(0) | 179 , m_nTotalSize(0) |
180 , m_nCurSize(0) | 180 , m_nCurSize(0) |
181 , m_nCurPos(0) | 181 , m_nCurPos(0) |
182 , m_nGrowSize(FX_MEMSTREAM_BlockSize) | 182 , m_nGrowSize(FX_MEMSTREAM_BlockSize) |
183 , m_bUseRange(FALSE) | 183 , m_bUseRange(FALSE) |
184 { | 184 { |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 FX_DWORD mt[MT_N]; | 473 FX_DWORD mt[MT_N]; |
474 } FX_MTRANDOMCONTEXT, * FX_LPMTRANDOMCONTEXT; | 474 } FX_MTRANDOMCONTEXT, * FX_LPMTRANDOMCONTEXT; |
475 typedef FX_MTRANDOMCONTEXT const * FX_LPCMTRANDOMCONTEXT; | 475 typedef FX_MTRANDOMCONTEXT const * FX_LPCMTRANDOMCONTEXT; |
476 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 476 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
477 FX_BOOL FX_GenerateCryptoRandom(FX_LPDWORD pBuffer, FX_INT32 iCount); | 477 FX_BOOL FX_GenerateCryptoRandom(FX_LPDWORD pBuffer, FX_INT32 iCount); |
478 #endif | 478 #endif |
479 #ifdef __cplusplus | 479 #ifdef __cplusplus |
480 } | 480 } |
481 #endif | 481 #endif |
482 #endif | 482 #endif |
OLD | NEW |