From 959a904f3877d338d784c573487d90de87cb25ac Mon Sep 17 00:00:00 2001 From: tsepez Date: Fri, 2 Dec 2016 10:11:59 -0800 Subject: Tidy fx_stream.h Group related IFX_ classes. Move #defines to .cpp file that uses them. Replace loose function with static method. Review-Url: https://codereview.chromium.org/2548583004 --- core/fxcrt/fx_extension.cpp | 2 +- core/fxcrt/fx_stream.h | 36 +++++++++++++++--------------------- 2 files changed, 16 insertions(+), 22 deletions(-) (limited to 'core/fxcrt') diff --git a/core/fxcrt/fx_extension.cpp b/core/fxcrt/fx_extension.cpp index aa3841e31c..1bb9a3a5f6 100644 --- a/core/fxcrt/fx_extension.cpp +++ b/core/fxcrt/fx_extension.cpp @@ -408,7 +408,7 @@ bool CFX_MemoryStream::ExpandBlocks(size_t size) { } // namespace #ifdef PDF_ENABLE_XFA -IFX_FileAccess* FX_CreateDefaultFileAccess(const CFX_WideStringC& wsPath) { +IFX_FileAccess* IFX_FileAccess::CreateDefault(const CFX_WideStringC& wsPath) { if (wsPath.GetLength() == 0) return nullptr; diff --git a/core/fxcrt/fx_stream.h b/core/fxcrt/fx_stream.h index e938ec18df..711b66472b 100644 --- a/core/fxcrt/fx_stream.h +++ b/core/fxcrt/fx_stream.h @@ -14,10 +14,11 @@ #include class CFindFileDataA; - typedef CFindFileDataA FX_FileHandle; #define FX_FILESIZE int32_t + #else + #include #include #include @@ -43,14 +44,6 @@ bool FX_GetNextFile(FX_FileHandle* handle, void FX_CloseFolder(FX_FileHandle* handle); FX_WCHAR FX_GetFolderSeparator(); -#define FX_GETBYTEOFFSET32(a) 0 -#define FX_GETBYTEOFFSET40(a) 0 -#define FX_GETBYTEOFFSET48(a) 0 -#define FX_GETBYTEOFFSET56(a) 0 -#define FX_GETBYTEOFFSET24(a) ((uint8_t)(a >> 24)) -#define FX_GETBYTEOFFSET16(a) ((uint8_t)(a >> 16)) -#define FX_GETBYTEOFFSET8(a) ((uint8_t)(a >> 8)) -#define FX_GETBYTEOFFSET0(a) ((uint8_t)(a)) #define FX_FILEMODE_Write 0 #define FX_FILEMODE_ReadOnly 1 #define FX_FILEMODE_Truncate 2 @@ -123,18 +116,6 @@ class IFX_SeekableStream : public IFX_SeekableReadStream, bool Flush() override = 0; }; -#ifdef PDF_ENABLE_XFA -class IFX_FileAccess { - public: - virtual ~IFX_FileAccess() {} - virtual void Release() = 0; - virtual IFX_FileAccess* Retain() = 0; - virtual void GetPath(CFX_WideString& wsPath) = 0; - virtual IFX_SeekableStream* CreateFileStream(uint32_t dwModes) = 0; -}; -IFX_FileAccess* FX_CreateDefaultFileAccess(const CFX_WideStringC& wsPath); -#endif // PDF_ENABLE_XFA - class IFX_MemoryStream : public IFX_SeekableStream { public: static IFX_MemoryStream* Create(uint8_t* pBuffer, @@ -165,6 +146,19 @@ class IFX_BufferedReadStream : public IFX_ReadStream { virtual FX_FILESIZE GetBlockOffset() = 0; }; +#ifdef PDF_ENABLE_XFA +class IFX_FileAccess { + public: + static IFX_FileAccess* CreateDefault(const CFX_WideStringC& wsPath); + + virtual ~IFX_FileAccess() {} + virtual void Release() = 0; + virtual IFX_FileAccess* Retain() = 0; + virtual void GetPath(CFX_WideString& wsPath) = 0; + virtual IFX_SeekableStream* CreateFileStream(uint32_t dwModes) = 0; +}; +#endif // PDF_ENABLE_XFA + #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ class CFindFileData { public: -- cgit v1.2.3