diff options
Diffstat (limited to 'xfa/fgas/crt')
-rw-r--r-- | xfa/fgas/crt/ifgas_stream.cpp (renamed from xfa/fgas/crt/fgas_stream.cpp) | 113 | ||||
-rw-r--r-- | xfa/fgas/crt/ifgas_stream.h (renamed from xfa/fgas/crt/fgas_stream.h) | 7 |
2 files changed, 60 insertions, 60 deletions
diff --git a/xfa/fgas/crt/fgas_stream.cpp b/xfa/fgas/crt/ifgas_stream.cpp index 02096d4966..eef19a59ff 100644 --- a/xfa/fgas/crt/fgas_stream.cpp +++ b/xfa/fgas/crt/ifgas_stream.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fgas/crt/fgas_stream.h" +#include "xfa/fgas/crt/ifgas_stream.h" #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || \ _FX_OS_ == _FX_WIN64_ @@ -321,50 +321,6 @@ bool FileSetSize(FXSYS_FILE* file, int32_t size) { #endif } -} // namespace - -// static -CFX_RetainPtr<IFGAS_Stream> IFGAS_Stream::CreateStream( - const CFX_RetainPtr<IFX_SeekableReadStream>& pFileRead, - uint32_t dwAccess) { - auto pSR = pdfium::MakeRetain<CFGAS_Stream>(); - if (!pSR->LoadFileRead(pFileRead, dwAccess)) - return nullptr; - - if (dwAccess & FX_STREAMACCESS_Text) - return pdfium::MakeRetain<CFGAS_TextStream>(pSR); - - return pSR; -} - -// static -CFX_RetainPtr<IFGAS_Stream> IFGAS_Stream::CreateStream( - const CFX_RetainPtr<IFX_SeekableWriteStream>& pFileWrite, - uint32_t dwAccess) { - auto pSR = pdfium::MakeRetain<CFGAS_Stream>(); - if (!pSR->LoadFileWrite(pFileWrite, dwAccess)) - return nullptr; - - if (dwAccess & FX_STREAMACCESS_Text) - return pdfium::MakeRetain<CFGAS_TextStream>(pSR); - - return pSR; -} - -// static -CFX_RetainPtr<IFGAS_Stream> IFGAS_Stream::CreateStream(uint8_t* pData, - int32_t length, - uint32_t dwAccess) { - auto pSR = pdfium::MakeRetain<CFGAS_Stream>(); - if (!pSR->LoadBuffer(pData, length, dwAccess)) - return nullptr; - - if (dwAccess & FX_STREAMACCESS_Text) - return pdfium::MakeRetain<CFGAS_TextStream>(pSR); - - return pSR; -} - IFGAS_StreamImp::IFGAS_StreamImp() : m_dwAccess(0) {} CFGAS_FileStreamImp::CFGAS_FileStreamImp() : m_hFile(nullptr), m_iLength(0) {} @@ -898,13 +854,6 @@ int32_t CFGAS_BufferStreamImp::WriteString(const wchar_t* pStr, return iLen; } -// static -CFX_RetainPtr<IFGAS_Stream> IFGAS_Stream::CreateTextStream( - const CFX_RetainPtr<IFGAS_Stream>& pBaseStream) { - ASSERT(pBaseStream); - return pdfium::MakeRetain<CFGAS_TextStream>(pBaseStream); -} - CFGAS_TextStream::CFGAS_TextStream(const CFX_RetainPtr<IFGAS_Stream>& pStream) : m_wCodePage(FX_CODEPAGE_DefANSI), m_wBOMLength(0), @@ -1453,10 +1402,6 @@ CFX_RetainPtr<IFGAS_Stream> CFGAS_Stream::CreateSharedStream(uint32_t dwAccess, return pShared; } -CFX_RetainPtr<IFX_SeekableReadStream> IFGAS_Stream::MakeSeekableReadStream() { - return CFGAS_FileRead::Create(CFX_RetainPtr<IFGAS_Stream>(this)); -} - CFX_RetainPtr<CFGAS_FileRead> CFGAS_FileRead::Create( const CFX_RetainPtr<IFGAS_Stream>& pStream) { return pdfium::MakeRetain<CFGAS_FileRead>(pStream); @@ -1478,3 +1423,59 @@ bool CFGAS_FileRead::ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) { int32_t iLen = m_pStream->ReadData((uint8_t*)buffer, (int32_t)size); return iLen == (int32_t)size; } + +} // namespace + +// static +CFX_RetainPtr<IFGAS_Stream> IFGAS_Stream::CreateStream( + const CFX_RetainPtr<IFX_SeekableReadStream>& pFileRead, + uint32_t dwAccess) { + auto pSR = pdfium::MakeRetain<CFGAS_Stream>(); + if (!pSR->LoadFileRead(pFileRead, dwAccess)) + return nullptr; + + if (dwAccess & FX_STREAMACCESS_Text) + return pdfium::MakeRetain<CFGAS_TextStream>(pSR); + + return pSR; +} + +// static +CFX_RetainPtr<IFGAS_Stream> IFGAS_Stream::CreateStream( + const CFX_RetainPtr<IFX_SeekableWriteStream>& pFileWrite, + uint32_t dwAccess) { + auto pSR = pdfium::MakeRetain<CFGAS_Stream>(); + if (!pSR->LoadFileWrite(pFileWrite, dwAccess)) + return nullptr; + + if (dwAccess & FX_STREAMACCESS_Text) + return pdfium::MakeRetain<CFGAS_TextStream>(pSR); + + return pSR; +} + +// static +CFX_RetainPtr<IFGAS_Stream> IFGAS_Stream::CreateStream(uint8_t* pData, + int32_t length, + uint32_t dwAccess) { + auto pSR = pdfium::MakeRetain<CFGAS_Stream>(); + if (!pSR->LoadBuffer(pData, length, dwAccess)) + return nullptr; + + if (dwAccess & FX_STREAMACCESS_Text) + return pdfium::MakeRetain<CFGAS_TextStream>(pSR); + + return pSR; +} + +// static +CFX_RetainPtr<IFGAS_Stream> IFGAS_Stream::CreateTextStream( + const CFX_RetainPtr<IFGAS_Stream>& pBaseStream) { + ASSERT(pBaseStream); + return pdfium::MakeRetain<CFGAS_TextStream>(pBaseStream); +} + +// static +CFX_RetainPtr<IFX_SeekableReadStream> IFGAS_Stream::MakeSeekableReadStream() { + return CFGAS_FileRead::Create(CFX_RetainPtr<IFGAS_Stream>(this)); +} diff --git a/xfa/fgas/crt/fgas_stream.h b/xfa/fgas/crt/ifgas_stream.h index fdfc08205a..3ffead96dd 100644 --- a/xfa/fgas/crt/fgas_stream.h +++ b/xfa/fgas/crt/ifgas_stream.h @@ -4,8 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#ifndef XFA_FGAS_CRT_FGAS_STREAM_H_ -#define XFA_FGAS_CRT_FGAS_STREAM_H_ +#ifndef XFA_FGAS_CRT_IFGAS_STREAM_H_ +#define XFA_FGAS_CRT_IFGAS_STREAM_H_ #include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_stream.h" @@ -63,5 +63,4 @@ class IFGAS_Stream : public CFX_Retainable { CFX_RetainPtr<IFX_SeekableReadStream> MakeSeekableReadStream(); }; - -#endif // XFA_FGAS_CRT_FGAS_STREAM_H_ +#endif // XFA_FGAS_CRT_IFGAS_STREAM_H_ |