| 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_SRC_FXCRT_EXTENSION_H_ | 7 #ifndef CORE_SRC_FXCRT_EXTENSION_H_ |
| 8 #define CORE_SRC_FXCRT_EXTENSION_H_ | 8 #define CORE_SRC_FXCRT_EXTENSION_H_ |
| 9 | 9 |
| 10 #include "core/include/fxcrt/fx_basic.h" | 10 #include "core/include/fxcrt/fx_basic.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 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_FILESIZE pos) = 0; | 25 virtual size_t ReadPos(void* pBuffer, size_t szBuffer, FX_FILESIZE pos) = 0; |
| 26 virtual size_t WritePos(const void* pBuffer, | 26 virtual size_t WritePos(const void* pBuffer, |
| 27 size_t szBuffer, | 27 size_t szBuffer, |
| 28 FX_FILESIZE pos) = 0; | 28 FX_FILESIZE pos) = 0; |
| 29 virtual FX_BOOL Flush() = 0; | 29 virtual FX_BOOL Flush() = 0; |
| 30 virtual FX_BOOL Truncate(FX_FILESIZE szFile) = 0; | 30 virtual FX_BOOL Truncate(FX_FILESIZE szFile) = 0; |
| 31 }; | 31 }; |
| 32 IFXCRT_FileAccess* FXCRT_FileAccess_Create(); | 32 IFXCRT_FileAccess* FXCRT_FileAccess_Create(); |
| 33 | 33 |
| 34 #ifdef PDF_ENABLE_XFA |
| 34 class CFX_CRTFileAccess : public IFX_FileAccess { | 35 class CFX_CRTFileAccess : public IFX_FileAccess { |
| 35 public: | 36 public: |
| 36 CFX_CRTFileAccess() : m_RefCount(0) {} | 37 CFX_CRTFileAccess() : m_RefCount(0) {} |
| 37 | 38 |
| 38 // IFX_FileAccess | 39 // IFX_FileAccess |
| 39 void Release() override { | 40 void Release() override { |
| 40 if (--m_RefCount == 0) | 41 if (--m_RefCount == 0) |
| 41 delete this; | 42 delete this; |
| 42 } | 43 } |
| 43 | 44 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 56 m_path = wsPath; | 57 m_path = wsPath; |
| 57 m_RefCount = 1; | 58 m_RefCount = 1; |
| 58 return TRUE; | 59 return TRUE; |
| 59 } | 60 } |
| 60 | 61 |
| 61 protected: | 62 protected: |
| 62 CFX_WideString m_path; | 63 CFX_WideString m_path; |
| 63 FX_DWORD m_RefCount; | 64 FX_DWORD m_RefCount; |
| 64 }; | 65 }; |
| 65 | 66 |
| 67 #endif |
| 66 class CFX_CRTFileStream final : public IFX_FileStream { | 68 class CFX_CRTFileStream final : public IFX_FileStream { |
| 67 public: | 69 public: |
| 68 CFX_CRTFileStream(IFXCRT_FileAccess* pFA) : m_pFile(pFA), m_dwCount(1) {} | 70 CFX_CRTFileStream(IFXCRT_FileAccess* pFA) : m_pFile(pFA), m_dwCount(1) {} |
| 69 ~CFX_CRTFileStream() override { | 71 ~CFX_CRTFileStream() override { |
| 70 if (m_pFile) { | 72 if (m_pFile) { |
| 71 m_pFile->Release(); | 73 m_pFile->Release(); |
| 72 } | 74 } |
| 73 } | 75 } |
| 74 virtual IFX_FileStream* Retain() override { | 76 virtual IFX_FileStream* Retain() override { |
| 75 m_dwCount++; | 77 m_dwCount++; |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 } FX_MTRANDOMCONTEXT, *FX_LPMTRANDOMCONTEXT; | 343 } FX_MTRANDOMCONTEXT, *FX_LPMTRANDOMCONTEXT; |
| 342 typedef FX_MTRANDOMCONTEXT const* FX_LPCMTRANDOMCONTEXT; | 344 typedef FX_MTRANDOMCONTEXT const* FX_LPCMTRANDOMCONTEXT; |
| 343 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 345 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
| 344 FX_BOOL FX_GenerateCryptoRandom(FX_DWORD* pBuffer, int32_t iCount); | 346 FX_BOOL FX_GenerateCryptoRandom(FX_DWORD* pBuffer, int32_t iCount); |
| 345 #endif | 347 #endif |
| 346 #ifdef __cplusplus | 348 #ifdef __cplusplus |
| 347 } | 349 } |
| 348 #endif | 350 #endif |
| 349 | 351 |
| 350 #endif // CORE_SRC_FXCRT_EXTENSION_H_ | 352 #endif // CORE_SRC_FXCRT_EXTENSION_H_ |
| OLD | NEW |