diff options
author | tsepez <tsepez@chromium.org> | 2016-10-24 10:19:11 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-10-24 10:19:11 -0700 |
commit | ad2441ef675866eb84c7392eeda03391a5a5d474 (patch) | |
tree | 5b250139c65d5f440f3b544643b1fb85e23380dd | |
parent | b674ebe6dd13288160ad8e324d719a124caf5a83 (diff) | |
download | pdfium-ad2441ef675866eb84c7392eeda03391a5a5d474.tar.xz |
Rename IFX_ stream nameschromium/2900
It's been troubling for some time that an IFX_FileStream might
actually be an in-memory buffer with no backing file.
Review-Url: https://codereview.chromium.org/2443723002
74 files changed, 255 insertions, 226 deletions
diff --git a/core/fpdfapi/edit/cpdf_creator.h b/core/fpdfapi/edit/cpdf_creator.h index 5de3793eb5..8b0efdd309 100644 --- a/core/fpdfapi/edit/cpdf_creator.h +++ b/core/fpdfapi/edit/cpdf_creator.h @@ -32,7 +32,7 @@ class CPDF_Creator { ~CPDF_Creator(); void RemoveSecurity(); - bool Create(IFX_StreamWrite* pFile, uint32_t flags = 0); + bool Create(IFX_WriteStream* pFile, uint32_t flags = 0); int32_t Continue(IFX_Pause* pPause = nullptr); FX_BOOL SetFileVersion(int32_t fileVersion = 17); diff --git a/core/fpdfapi/edit/fpdf_edit_create.cpp b/core/fpdfapi/edit/fpdf_edit_create.cpp index e5b1fe1bb0..b4e1157d9e 100644 --- a/core/fpdfapi/edit/fpdf_edit_create.cpp +++ b/core/fpdfapi/edit/fpdf_edit_create.cpp @@ -1482,7 +1482,7 @@ int32_t CPDF_Creator::WriteDoc_Stage1(IFX_Pause* pPause) { InitOldObjNumOffsets(); m_iStage = 20; } else { - IFX_FileRead* pSrcFile = m_pParser->GetFileAccess(); + IFX_SeekableReadStream* pSrcFile = m_pParser->GetFileAccess(); m_Offset = pSrcFile->GetSize(); m_Pos = (void*)(uintptr_t)m_Offset; m_iStage = 15; @@ -1490,7 +1490,7 @@ int32_t CPDF_Creator::WriteDoc_Stage1(IFX_Pause* pPause) { } if (m_iStage == 15) { if ((m_dwFlags & FPDFCREATE_NO_ORIGINAL) == 0 && m_Pos) { - IFX_FileRead* pSrcFile = m_pParser->GetFileAccess(); + IFX_SeekableReadStream* pSrcFile = m_pParser->GetFileAccess(); uint8_t buffer[4096]; uint32_t src_size = (uint32_t)(uintptr_t)m_Pos; while (src_size) { @@ -1907,7 +1907,7 @@ void CPDF_Creator::Clear() { m_pIDArray.reset(); } -bool CPDF_Creator::Create(IFX_StreamWrite* pFile, uint32_t flags) { +bool CPDF_Creator::Create(IFX_WriteStream* pFile, uint32_t flags) { m_File.AttachFile(pFile); return Create(flags); } diff --git a/core/fpdfapi/page/cpdf_image.cpp b/core/fpdfapi/page/cpdf_image.cpp index 50768c5058..b40bc3ca8e 100644 --- a/core/fpdfapi/page/cpdf_image.cpp +++ b/core/fpdfapi/page/cpdf_image.cpp @@ -123,7 +123,7 @@ CPDF_Dictionary* CPDF_Image::InitJPEG(uint8_t* pData, uint32_t size) { return pDict; } -void CPDF_Image::SetJpegImage(IFX_FileRead* pFile) { +void CPDF_Image::SetJpegImage(IFX_SeekableReadStream* pFile) { uint32_t size = (uint32_t)pFile->GetSize(); if (!size) return; diff --git a/core/fpdfapi/page/cpdf_image.h b/core/fpdfapi/page/cpdf_image.h index 72de0d8cef..1e6f70fa33 100644 --- a/core/fpdfapi/page/cpdf_image.h +++ b/core/fpdfapi/page/cpdf_image.h @@ -16,14 +16,14 @@ #define PDF_IMAGE_MASK_LOSSY_COMPRESS 0x0004 #define PDF_IMAGE_MASK_LOSSLESS_COMPRESS 0x0008 -class CFX_DIBitmap; class CFX_DIBSource; +class CFX_DIBitmap; class CPDF_Dictionay; class CPDF_Document; class CPDF_Page; -class IFX_FileRead; -class IFX_FileWrite; class IFX_Pause; +class IFX_SeekableReadStream; +class IFX_SeekableWriteStream; class CPDF_Image { public: @@ -56,7 +56,7 @@ class CPDF_Image { FX_BOOL bLoadMask = FALSE) const; void SetImage(const CFX_DIBitmap* pDIBitmap, int32_t iCompress); - void SetJpegImage(IFX_FileRead* pFile); + void SetJpegImage(IFX_SeekableReadStream* pFile); void ResetCache(CPDF_Page* pPage, const CFX_DIBitmap* pDIBitmap); diff --git a/core/fpdfapi/parser/cfdf_document.cpp b/core/fpdfapi/parser/cfdf_document.cpp index a1518dfed0..3bafdda9f2 100644 --- a/core/fpdfapi/parser/cfdf_document.cpp +++ b/core/fpdfapi/parser/cfdf_document.cpp @@ -33,7 +33,8 @@ CFDF_Document* CFDF_Document::CreateNewDoc() { return pDoc; } -CFDF_Document* CFDF_Document::ParseFile(IFX_FileRead* pFile, FX_BOOL bOwnFile) { +CFDF_Document* CFDF_Document::ParseFile(IFX_SeekableReadStream* pFile, + FX_BOOL bOwnFile) { if (!pFile) return nullptr; @@ -47,7 +48,8 @@ CFDF_Document* CFDF_Document::ParseMemory(const uint8_t* pData, uint32_t size) { TRUE); } -void CFDF_Document::ParseStream(IFX_FileRead* pFile, FX_BOOL bOwnFile) { +void CFDF_Document::ParseStream(IFX_SeekableReadStream* pFile, + FX_BOOL bOwnFile) { m_pFile = pFile; m_bOwnFile = bOwnFile; CPDF_SyntaxParser parser; diff --git a/core/fpdfapi/parser/cfdf_document.h b/core/fpdfapi/parser/cfdf_document.h index 21ac62d11c..32d0aab422 100644 --- a/core/fpdfapi/parser/cfdf_document.h +++ b/core/fpdfapi/parser/cfdf_document.h @@ -18,7 +18,7 @@ class CPDF_Dictionary; class CFDF_Document : public CPDF_IndirectObjectHolder { public: static CFDF_Document* CreateNewDoc(); - static CFDF_Document* ParseFile(IFX_FileRead* pFile, + static CFDF_Document* ParseFile(IFX_SeekableReadStream* pFile, FX_BOOL bOwnFile = FALSE); static CFDF_Document* ParseMemory(const uint8_t* pData, uint32_t size); ~CFDF_Document() override; @@ -31,10 +31,10 @@ class CFDF_Document : public CPDF_IndirectObjectHolder { protected: CFDF_Document(); - void ParseStream(IFX_FileRead* pFile, FX_BOOL bOwnFile); + void ParseStream(IFX_SeekableReadStream* pFile, FX_BOOL bOwnFile); CPDF_Dictionary* m_pRootDict; - IFX_FileRead* m_pFile; + IFX_SeekableReadStream* m_pFile; FX_BOOL m_bOwnFile; CFX_WeakPtr<CFX_ByteStringPool> m_pByteStringPool; }; diff --git a/core/fpdfapi/parser/cpdf_data_avail.cpp b/core/fpdfapi/parser/cpdf_data_avail.cpp index e23aa8ecfb..c6a434be5d 100644 --- a/core/fpdfapi/parser/cpdf_data_avail.cpp +++ b/core/fpdfapi/parser/cpdf_data_avail.cpp @@ -32,7 +32,7 @@ CPDF_DataAvail::DownloadHints::~DownloadHints() {} int CPDF_DataAvail::s_CurrentDataAvailRecursionDepth = 0; CPDF_DataAvail::CPDF_DataAvail(FileAvail* pFileAvail, - IFX_FileRead* pFileRead, + IFX_SeekableReadStream* pFileRead, FX_BOOL bSupportHintTable) : m_pFileAvail(pFileAvail), m_pFileRead(pFileRead) { m_Pos = 0; diff --git a/core/fpdfapi/parser/cpdf_data_avail.h b/core/fpdfapi/parser/cpdf_data_avail.h index fe5c481af2..138fe1e3d8 100644 --- a/core/fpdfapi/parser/cpdf_data_avail.h +++ b/core/fpdfapi/parser/cpdf_data_avail.h @@ -93,7 +93,7 @@ class CPDF_DataAvail final { }; CPDF_DataAvail(FileAvail* pFileAvail, - IFX_FileRead* pFileRead, + IFX_SeekableReadStream* pFileRead, FX_BOOL bSupportHintTable); ~CPDF_DataAvail(); @@ -104,7 +104,7 @@ class CPDF_DataAvail final { DocLinearizationStatus IsLinearizedPDF(); FX_BOOL IsLinearized(); void GetLinearizedMainXRefInfo(FX_FILESIZE* pPos, uint32_t* pSize); - IFX_FileRead* GetFileRead() const { return m_pFileRead; } + IFX_SeekableReadStream* GetFileRead() const { return m_pFileRead; } int GetPageCount() const; CPDF_Dictionary* GetPage(int index); @@ -193,7 +193,7 @@ class CPDF_DataAvail final { FX_BOOL IsDataAvail(FX_FILESIZE offset, uint32_t size, DownloadHints* pHints); FileAvail* const m_pFileAvail; - IFX_FileRead* const m_pFileRead; + IFX_SeekableReadStream* const m_pFileRead; CPDF_Parser m_parser; CPDF_SyntaxParser m_syntaxParser; CPDF_Object* m_pRoot; diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp index c29ae18da2..c2748882cf 100644 --- a/core/fpdfapi/parser/cpdf_parser.cpp +++ b/core/fpdfapi/parser/cpdf_parser.cpp @@ -119,7 +119,7 @@ CPDF_CryptoHandler* CPDF_Parser::GetCryptoHandler() { return m_pSyntax->m_pCryptoHandler.get(); } -IFX_FileRead* CPDF_Parser::GetFileAccess() const { +IFX_SeekableReadStream* CPDF_Parser::GetFileAccess() const { return m_pSyntax->m_pFileAccess; } @@ -139,7 +139,7 @@ void CPDF_Parser::ShrinkObjectMap(uint32_t objnum) { m_ObjectInfo[objnum - 1].pos = 0; } -CPDF_Parser::Error CPDF_Parser::StartParse(IFX_FileRead* pFileAccess, +CPDF_Parser::Error CPDF_Parser::StartParse(IFX_SeekableReadStream* pFileAccess, CPDF_Document* pDocument) { ASSERT(!m_bHasParsed); m_bHasParsed = true; @@ -1438,7 +1438,7 @@ uint32_t CPDF_Parser::GetPermissions() const { return dwPermission; } -FX_BOOL CPDF_Parser::IsLinearizedFile(IFX_FileRead* pFileAccess, +FX_BOOL CPDF_Parser::IsLinearizedFile(IFX_SeekableReadStream* pFileAccess, uint32_t offset) { m_pSyntax->InitParser(pFileAccess, offset); m_pSyntax->RestorePos(m_pSyntax->m_HeaderOffset + 9); @@ -1491,8 +1491,9 @@ FX_BOOL CPDF_Parser::IsLinearizedFile(IFX_FileRead* pFileAccess, return FALSE; } -CPDF_Parser::Error CPDF_Parser::StartLinearizedParse(IFX_FileRead* pFileAccess, - CPDF_Document* pDocument) { +CPDF_Parser::Error CPDF_Parser::StartLinearizedParse( + IFX_SeekableReadStream* pFileAccess, + CPDF_Document* pDocument) { ASSERT(!m_bHasParsed); m_bXRefStream = FALSE; diff --git a/core/fpdfapi/parser/cpdf_parser.h b/core/fpdfapi/parser/cpdf_parser.h index 83b591f3b2..887857628a 100644 --- a/core/fpdfapi/parser/cpdf_parser.h +++ b/core/fpdfapi/parser/cpdf_parser.h @@ -23,7 +23,7 @@ class CPDF_Object; class CPDF_SecurityHandler; class CPDF_StreamAcc; class CPDF_SyntaxParser; -class IFX_FileRead; +class IFX_SeekableReadStream; class CPDF_Parser { public: @@ -42,8 +42,9 @@ class CPDF_Parser { CPDF_Parser(); ~CPDF_Parser(); - Error StartParse(IFX_FileRead* pFile, CPDF_Document* pDocument); - Error StartLinearizedParse(IFX_FileRead* pFile, CPDF_Document* pDocument); + Error StartParse(IFX_SeekableReadStream* pFile, CPDF_Document* pDocument); + Error StartLinearizedParse(IFX_SeekableReadStream* pFile, + CPDF_Document* pDocument); void SetPassword(const FX_CHAR* password) { m_Password = password; } CFX_ByteString GetPassword() { return m_Password; } @@ -68,7 +69,7 @@ class CPDF_Parser { bool IsVersionUpdated() const { return m_bVersionUpdated; } bool IsObjectFreeOrNull(uint32_t objnum) const; CPDF_CryptoHandler* GetCryptoHandler(); - IFX_FileRead* GetFileAccess() const; + IFX_SeekableReadStream* GetFileAccess() const; FX_FILESIZE GetObjectOffset(uint32_t objnum) const; FX_FILESIZE GetObjectSize(uint32_t objnum) const; @@ -136,7 +137,8 @@ class CPDF_Parser { FX_BOOL LoadLinearizedAllCrossRefV5(FX_FILESIZE pos); Error LoadLinearizedMainXRefTable(); CPDF_StreamAcc* GetObjectStream(uint32_t number); - FX_BOOL IsLinearizedFile(IFX_FileRead* pFileAccess, uint32_t offset); + FX_BOOL IsLinearizedFile(IFX_SeekableReadStream* pFileAccess, + uint32_t offset); void SetEncryptDictionary(CPDF_Dictionary* pDict); void ShrinkObjectMap(uint32_t size); // A simple check whether the cross reference table matches with diff --git a/core/fpdfapi/parser/cpdf_parser_unittest.cpp b/core/fpdfapi/parser/cpdf_parser_unittest.cpp index c97b88e6d1..6c6fb213f4 100644 --- a/core/fpdfapi/parser/cpdf_parser_unittest.cpp +++ b/core/fpdfapi/parser/cpdf_parser_unittest.cpp @@ -13,7 +13,7 @@ #include "testing/utils/path_service.h" // Provide a way to read test data from a buffer instead of a file. -class CFX_TestBufferRead : public IFX_FileRead { +class CFX_TestBufferRead : public IFX_SeekableReadStream { public: CFX_TestBufferRead(const unsigned char* buffer_in, size_t buf_size) : buffer_(buffer_in), total_size_(buf_size) {} @@ -21,7 +21,7 @@ class CFX_TestBufferRead : public IFX_FileRead { // IFX_Stream void Release() override { delete this; } - // IFX_FileRead + // IFX_SeekableReadStream FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override { if (offset < 0 || offset + size > total_size_) { return FALSE; @@ -45,7 +45,7 @@ class CPDF_TestParser : public CPDF_Parser { // Setup reading from a file and initial states. bool InitTestFromFile(const FX_CHAR* path) { - IFX_FileRead* pFileAccess = FX_CreateFileRead(path); + IFX_SeekableReadStream* pFileAccess = FX_CreateFileRead(path); if (!pFileAccess) return false; diff --git a/core/fpdfapi/parser/cpdf_stream.cpp b/core/fpdfapi/parser/cpdf_stream.cpp index 935c80c5c8..93899db24e 100644 --- a/core/fpdfapi/parser/cpdf_stream.cpp +++ b/core/fpdfapi/parser/cpdf_stream.cpp @@ -57,7 +57,7 @@ void CPDF_Stream::InitStream(const uint8_t* pData, m_pDict->SetIntegerFor("Length", m_dwSize); } -void CPDF_Stream::InitStreamFromFile(IFX_FileRead* pFile, +void CPDF_Stream::InitStreamFromFile(IFX_SeekableReadStream* pFile, CPDF_Dictionary* pDict) { m_pDict.reset(pDict); m_bMemoryBased = false; diff --git a/core/fpdfapi/parser/cpdf_stream.h b/core/fpdfapi/parser/cpdf_stream.h index 756eccfba1..588714eadc 100644 --- a/core/fpdfapi/parser/cpdf_stream.h +++ b/core/fpdfapi/parser/cpdf_stream.h @@ -37,7 +37,8 @@ class CPDF_Stream : public CPDF_Object { void SetData(const uint8_t* pData, uint32_t size); void InitStream(const uint8_t* pData, uint32_t size, CPDF_Dictionary* pDict); - void InitStreamFromFile(IFX_FileRead* pFile, CPDF_Dictionary* pDict); + void InitStreamFromFile(IFX_SeekableReadStream* pFile, + CPDF_Dictionary* pDict); FX_BOOL ReadRawData(FX_FILESIZE start_pos, uint8_t* pBuf, @@ -55,7 +56,7 @@ class CPDF_Stream : public CPDF_Object { bool m_bMemoryBased = true; uint32_t m_dwSize = 0; std::unique_ptr<uint8_t, FxFreeDeleter> m_pDataBuf; - IFX_FileRead* m_pFile = nullptr; + IFX_SeekableReadStream* m_pFile = nullptr; }; using UniqueStream = std::unique_ptr<CPDF_Stream, ReleaseDeleter<CPDF_Object>>; diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.cpp b/core/fpdfapi/parser/cpdf_syntax_parser.cpp index e7f25d15c2..3b1df94503 100644 --- a/core/fpdfapi/parser/cpdf_syntax_parser.cpp +++ b/core/fpdfapi/parser/cpdf_syntax_parser.cpp @@ -782,7 +782,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict, return pStream; } -void CPDF_SyntaxParser::InitParser(IFX_FileRead* pFileAccess, +void CPDF_SyntaxParser::InitParser(IFX_SeekableReadStream* pFileAccess, uint32_t HeaderOffset) { FX_Free(m_pFileBuf); diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.h b/core/fpdfapi/parser/cpdf_syntax_parser.h index 444a94bde1..5694d233e1 100644 --- a/core/fpdfapi/parser/cpdf_syntax_parser.h +++ b/core/fpdfapi/parser/cpdf_syntax_parser.h @@ -18,7 +18,7 @@ class CPDF_Dictionary; class CPDF_IndirectObjectHolder; class CPDF_Object; class CPDF_Stream; -class IFX_FileRead; +class IFX_SeekableReadStream; class CPDF_SyntaxParser { public: @@ -26,7 +26,7 @@ class CPDF_SyntaxParser { explicit CPDF_SyntaxParser(const CFX_WeakPtr<CFX_ByteStringPool>& pPool); ~CPDF_SyntaxParser(); - void InitParser(IFX_FileRead* pFileAccess, uint32_t HeaderOffset); + void InitParser(IFX_SeekableReadStream* pFileAccess, uint32_t HeaderOffset); FX_FILESIZE SavePos() const { return m_Pos; } void RestorePos(FX_FILESIZE pos) { m_Pos = pos; } @@ -86,7 +86,7 @@ class CPDF_SyntaxParser { FX_FILESIZE m_Pos; int m_MetadataObjnum; - IFX_FileRead* m_pFileAccess; + IFX_SeekableReadStream* m_pFileAccess; FX_FILESIZE m_HeaderOffset; FX_FILESIZE m_FileLen; uint8_t* m_pFileBuf; diff --git a/core/fpdfapi/parser/fpdf_parser_utility.cpp b/core/fpdfapi/parser/fpdf_parser_utility.cpp index 7b9ead4005..8fdef1eb11 100644 --- a/core/fpdfapi/parser/fpdf_parser_utility.cpp +++ b/core/fpdfapi/parser/fpdf_parser_utility.cpp @@ -68,7 +68,7 @@ const char PDF_CharType[256] = { 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'W'}; -int32_t GetHeaderOffset(IFX_FileRead* pFile) { +int32_t GetHeaderOffset(IFX_SeekableReadStream* pFile) { const size_t kBufSize = 4; uint8_t buf[kBufSize]; for (int32_t offset = 0; offset <= 1024; ++offset) { diff --git a/core/fpdfapi/parser/fpdf_parser_utility.h b/core/fpdfapi/parser/fpdf_parser_utility.h index 4c0187ed4a..589171f1a4 100644 --- a/core/fpdfapi/parser/fpdf_parser_utility.h +++ b/core/fpdfapi/parser/fpdf_parser_utility.h @@ -10,7 +10,7 @@ #include "core/fxcrt/fx_string.h" #include "core/fxcrt/fx_system.h" -class IFX_FileRead; +class IFX_SeekableReadStream; class CPDF_Dictionary; // Use the accessors below instead of directly accessing PDF_CharType. @@ -33,7 +33,7 @@ inline bool PDFCharIsLineEnding(uint8_t c) { return c == '\r' || c == '\n'; } -int32_t GetHeaderOffset(IFX_FileRead* pFile); +int32_t GetHeaderOffset(IFX_SeekableReadStream* pFile); int32_t GetDirectInteger(CPDF_Dictionary* pDict, const CFX_ByteString& key); #endif // CORE_FPDFAPI_PARSER_FPDF_PARSER_UTILITY_H_ diff --git a/core/fxcodec/codec/ccodec_progressivedecoder.h b/core/fxcodec/codec/ccodec_progressivedecoder.h index 73fec6457e..b760c2ec1c 100644 --- a/core/fxcodec/codec/ccodec_progressivedecoder.h +++ b/core/fxcodec/codec/ccodec_progressivedecoder.h @@ -21,7 +21,7 @@ class CCodec_ModuleMgr; class CCodec_PngContext; class CCodec_TiffContext; class CFX_DIBAttribute; -class IFX_FileRead; +class IFX_SeekableReadStream; class IFX_Pause; struct FXBMP_Context; struct FXGIF_Context; @@ -45,7 +45,7 @@ class CCodec_ProgressiveDecoder { explicit CCodec_ProgressiveDecoder(CCodec_ModuleMgr* pCodecMgr); ~CCodec_ProgressiveDecoder(); - FXCODEC_STATUS LoadImageInfo(IFX_FileRead* pFile, + FXCODEC_STATUS LoadImageInfo(IFX_SeekableReadStream* pFile, FXCODEC_IMAGE_TYPE imageType, CFX_DIBAttribute* pAttribute, bool bSkipImageTypeCheck); @@ -125,7 +125,7 @@ class CCodec_ProgressiveDecoder { std::vector<uint8_t> m_pWeightTables; }; - IFX_FileRead* m_pFile; + IFX_SeekableReadStream* m_pFile; CCodec_ModuleMgr* m_pCodecMgr; FXJPEG_Context* m_pJpegContext; FXPNG_Context* m_pPngContext; diff --git a/core/fxcodec/codec/ccodec_tiffmodule.h b/core/fxcodec/codec/ccodec_tiffmodule.h index c6525f32e2..37d40821a6 100644 --- a/core/fxcodec/codec/ccodec_tiffmodule.h +++ b/core/fxcodec/codec/ccodec_tiffmodule.h @@ -12,13 +12,13 @@ class CCodec_TiffContext; class CFX_DIBAttribute; class CFX_DIBitmap; -class IFX_FileRead; +class IFX_SeekableReadStream; class CCodec_TiffModule { public: ~CCodec_TiffModule() {} - CCodec_TiffContext* CreateDecoder(IFX_FileRead* file_ptr); + CCodec_TiffContext* CreateDecoder(IFX_SeekableReadStream* file_ptr); bool LoadFrameInfo(CCodec_TiffContext* ctx, int32_t frame, diff --git a/core/fxcodec/codec/fx_codec_progress.cpp b/core/fxcodec/codec/fx_codec_progress.cpp index 605e1b573f..4de62baad2 100644 --- a/core/fxcodec/codec/fx_codec_progress.cpp +++ b/core/fxcodec/codec/fx_codec_progress.cpp @@ -1296,7 +1296,7 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType( } FXCODEC_STATUS CCodec_ProgressiveDecoder::LoadImageInfo( - IFX_FileRead* pFile, + IFX_SeekableReadStream* pFile, FXCODEC_IMAGE_TYPE imageType, CFX_DIBAttribute* pAttribute, bool bSkipImageTypeCheck) { diff --git a/core/fxcodec/codec/fx_codec_tiff.cpp b/core/fxcodec/codec/fx_codec_tiff.cpp index f4fa01aabc..c76a604e4d 100644 --- a/core/fxcodec/codec/fx_codec_tiff.cpp +++ b/core/fxcodec/codec/fx_codec_tiff.cpp @@ -17,7 +17,7 @@ class CCodec_TiffContext { CCodec_TiffContext(); ~CCodec_TiffContext(); - bool InitDecoder(IFX_FileRead* file_ptr); + bool InitDecoder(IFX_SeekableReadStream* file_ptr); bool LoadFrameInfo(int32_t frame, int32_t* width, int32_t* height, @@ -26,7 +26,7 @@ class CCodec_TiffContext { CFX_DIBAttribute* pAttribute); bool Decode(CFX_DIBitmap* pDIBitmap); - IFX_FileRead* io_in() const { return m_io_in; } + IFX_SeekableReadStream* io_in() const { return m_io_in; } uint32_t offset() const { return m_offset; } void set_offset(uint32_t offset) { m_offset = offset; } void increment_offset(uint32_t offset) { m_offset += offset; } @@ -50,7 +50,7 @@ class CCodec_TiffContext { uint16_t bps, uint16_t spp); - IFX_FileRead* m_io_in; + IFX_SeekableReadStream* m_io_in; uint32_t m_offset; TIFF* m_tif_ctx; }; @@ -193,7 +193,7 @@ CCodec_TiffContext::~CCodec_TiffContext() { TIFFClose(m_tif_ctx); } -bool CCodec_TiffContext::InitDecoder(IFX_FileRead* file_ptr) { +bool CCodec_TiffContext::InitDecoder(IFX_SeekableReadStream* file_ptr) { m_io_in = file_ptr; m_tif_ctx = tiff_open(this, "r"); return !!m_tif_ctx; @@ -435,7 +435,8 @@ bool CCodec_TiffContext::Decode(CFX_DIBitmap* pDIBitmap) { return false; } -CCodec_TiffContext* CCodec_TiffModule::CreateDecoder(IFX_FileRead* file_ptr) { +CCodec_TiffContext* CCodec_TiffModule::CreateDecoder( + IFX_SeekableReadStream* file_ptr) { CCodec_TiffContext* pDecoder = new CCodec_TiffContext; if (!pDecoder->InitDecoder(file_ptr)) { delete pDecoder; diff --git a/core/fxcrt/extension.h b/core/fxcrt/extension.h index 6a437db574..45f6d4f2f0 100644 --- a/core/fxcrt/extension.h +++ b/core/fxcrt/extension.h @@ -44,7 +44,7 @@ class CFX_CRTFileAccess : public IFX_FileAccess { void Release() override; IFX_FileAccess* Retain() override; void GetPath(CFX_WideString& wsPath) override; - IFX_FileStream* CreateFileStream(uint32_t dwModes) override; + IFX_SeekableStream* CreateFileStream(uint32_t dwModes) override; FX_BOOL Init(const CFX_WideStringC& wsPath); @@ -54,13 +54,13 @@ class CFX_CRTFileAccess : public IFX_FileAccess { }; #endif // PDF_ENABLE_XFA -class CFX_CRTFileStream final : public IFX_FileStream { +class CFX_CRTFileStream final : public IFX_SeekableStream { public: explicit CFX_CRTFileStream(std::unique_ptr<IFXCRT_FileAccess> pFA); ~CFX_CRTFileStream() override; - // IFX_FileStream: - IFX_FileStream* Retain() override; + // IFX_SeekableStream: + IFX_SeekableStream* Retain() override; void Release() override; FX_FILESIZE GetSize() override; FX_BOOL IsEOF() override; @@ -87,7 +87,7 @@ class CFX_MemoryStream final : public IFX_MemoryStream { ~CFX_MemoryStream() override; // IFX_MemoryStream - IFX_FileStream* Retain() override; + IFX_SeekableStream* Retain() override; void Release() override; FX_FILESIZE GetSize() override; FX_BOOL IsEOF() override; diff --git a/core/fxcrt/fx_basic.h b/core/fxcrt/fx_basic.h index 4cf69f896b..6643d33dce 100644 --- a/core/fxcrt/fx_basic.h +++ b/core/fxcrt/fx_basic.h @@ -121,14 +121,14 @@ class CFX_FileBufferArchive { int32_t AppendString(const CFX_ByteStringC& lpsz); // |pFile| must outlive the CFX_FileBufferArchive. - void AttachFile(IFX_StreamWrite* pFile); + void AttachFile(IFX_WriteStream* pFile); private: static const size_t kBufSize = 32768; size_t m_Length; std::unique_ptr<uint8_t, FxFreeDeleter> m_pBuffer; - IFX_StreamWrite* m_pFile; + IFX_WriteStream* m_pFile; }; class CFX_CharMap { diff --git a/core/fxcrt/fx_basic_buffer.cpp b/core/fxcrt/fx_basic_buffer.cpp index d441f6c0e9..e954224d8a 100644 --- a/core/fxcrt/fx_basic_buffer.cpp +++ b/core/fxcrt/fx_basic_buffer.cpp @@ -285,7 +285,7 @@ int32_t CFX_FileBufferArchive::AppendString(const CFX_ByteStringC& lpsz) { return AppendBlock(lpsz.raw_str(), lpsz.GetLength()); } -void CFX_FileBufferArchive::AttachFile(IFX_StreamWrite* pFile) { +void CFX_FileBufferArchive::AttachFile(IFX_WriteStream* pFile) { ASSERT(pFile); m_pFile = pFile; } diff --git a/core/fxcrt/fx_ext.h b/core/fxcrt/fx_ext.h index 959a26bf44..cca80b1142 100644 --- a/core/fxcrt/fx_ext.h +++ b/core/fxcrt/fx_ext.h @@ -18,7 +18,7 @@ // Come up or wait for something better. This appears in this file rather // than fx_stream.h due to include ordering restrictions. using ScopedFileStream = - std::unique_ptr<IFX_FileStream, ReleaseDeleter<IFX_FileStream>>; + std::unique_ptr<IFX_SeekableStream, ReleaseDeleter<IFX_SeekableStream>>; FX_FLOAT FXSYS_tan(FX_FLOAT a); FX_FLOAT FXSYS_logb(FX_FLOAT b, FX_FLOAT x); diff --git a/core/fxcrt/fx_extension.cpp b/core/fxcrt/fx_extension.cpp index ca6b6d4066..5ac22bd44e 100644 --- a/core/fxcrt/fx_extension.cpp +++ b/core/fxcrt/fx_extension.cpp @@ -36,7 +36,7 @@ void CFX_CRTFileAccess::GetPath(CFX_WideString& wsPath) { wsPath = m_path; } -IFX_FileStream* CFX_CRTFileAccess::CreateFileStream(uint32_t dwModes) { +IFX_SeekableStream* CFX_CRTFileAccess::CreateFileStream(uint32_t dwModes) { return FX_CreateFileStream(m_path.c_str(), dwModes); } @@ -85,7 +85,7 @@ CFX_MemoryStream::~CFX_MemoryStream() { m_Blocks.RemoveAll(); } -IFX_FileStream* CFX_MemoryStream::Retain() { +IFX_SeekableStream* CFX_MemoryStream::Retain() { m_dwCount++; return this; } @@ -281,7 +281,7 @@ FX_BOOL CFX_MemoryStream::ExpandBlocks(size_t size) { return TRUE; } -IFX_FileStream* CFX_CRTFileStream::Retain() { +IFX_SeekableStream* CFX_CRTFileStream::Retain() { m_dwCount++; return this; } @@ -336,24 +336,25 @@ IFX_FileAccess* FX_CreateDefaultFileAccess(const CFX_WideStringC& wsPath) { } #endif // PDF_ENABLE_XFA -IFX_FileStream* FX_CreateFileStream(const FX_CHAR* filename, uint32_t dwModes) { +IFX_SeekableStream* FX_CreateFileStream(const FX_CHAR* filename, + uint32_t dwModes) { std::unique_ptr<IFXCRT_FileAccess> pFA(IFXCRT_FileAccess::Create()); if (!pFA->Open(filename, dwModes)) return nullptr; return new CFX_CRTFileStream(std::move(pFA)); } -IFX_FileStream* FX_CreateFileStream(const FX_WCHAR* filename, - uint32_t dwModes) { +IFX_SeekableStream* FX_CreateFileStream(const FX_WCHAR* filename, + uint32_t dwModes) { std::unique_ptr<IFXCRT_FileAccess> pFA(IFXCRT_FileAccess::Create()); if (!pFA->Open(filename, dwModes)) return nullptr; return new CFX_CRTFileStream(std::move(pFA)); } -IFX_FileRead* FX_CreateFileRead(const FX_CHAR* filename) { +IFX_SeekableReadStream* FX_CreateFileRead(const FX_CHAR* filename) { return FX_CreateFileStream(filename, FX_FILEMODE_ReadOnly); } -IFX_FileRead* FX_CreateFileRead(const FX_WCHAR* filename) { +IFX_SeekableReadStream* FX_CreateFileRead(const FX_WCHAR* filename) { return FX_CreateFileStream(filename, FX_FILEMODE_ReadOnly); } IFX_MemoryStream* FX_CreateMemoryStream(uint8_t* pBuffer, diff --git a/core/fxcrt/fx_stream.h b/core/fxcrt/fx_stream.h index 047fedf9bb..2509ec2cd7 100644 --- a/core/fxcrt/fx_stream.h +++ b/core/fxcrt/fx_stream.h @@ -55,16 +55,26 @@ FX_WCHAR FX_GetFolderSeparator(); #define FX_FILEMODE_ReadOnly 1 #define FX_FILEMODE_Truncate 2 -class IFX_StreamWrite { +class IFX_WriteStream { public: - virtual ~IFX_StreamWrite() {} + virtual ~IFX_WriteStream() {} virtual void Release() = 0; virtual FX_BOOL WriteBlock(const void* pData, size_t size) = 0; }; -class IFX_FileWrite : public IFX_StreamWrite { +class IFX_ReadStream { public: - // IFX_StreamWrite: + virtual ~IFX_ReadStream() {} + + virtual void Release() = 0; + virtual FX_BOOL IsEOF() = 0; + virtual FX_FILESIZE GetPosition() = 0; + virtual size_t ReadBlock(void* buffer, size_t size) = 0; +}; + +class IFX_SeekableWriteStream : public IFX_WriteStream { + public: + // IFX_WriteStream: FX_BOOL WriteBlock(const void* pData, size_t size) override; virtual FX_FILESIZE GetSize() = 0; virtual FX_BOOL Flush() = 0; @@ -73,19 +83,9 @@ class IFX_FileWrite : public IFX_StreamWrite { size_t size) = 0; }; -class IFX_StreamRead { - public: - virtual ~IFX_StreamRead() {} - - virtual void Release() = 0; - virtual FX_BOOL IsEOF() = 0; - virtual FX_FILESIZE GetPosition() = 0; - virtual size_t ReadBlock(void* buffer, size_t size) = 0; -}; - -class IFX_FileRead : public IFX_StreamRead { +class IFX_SeekableReadStream : public IFX_ReadStream { public: - // IFX_StreamRead: + // IFX_ReadStream: void Release() override = 0; FX_BOOL IsEOF() override; FX_FILESIZE GetPosition() override; @@ -95,14 +95,15 @@ class IFX_FileRead : public IFX_StreamRead { virtual FX_FILESIZE GetSize() = 0; }; -IFX_FileRead* FX_CreateFileRead(const FX_CHAR* filename); -IFX_FileRead* FX_CreateFileRead(const FX_WCHAR* filename); +IFX_SeekableReadStream* FX_CreateFileRead(const FX_CHAR* filename); +IFX_SeekableReadStream* FX_CreateFileRead(const FX_WCHAR* filename); -class IFX_FileStream : public IFX_FileRead, public IFX_FileWrite { +class IFX_SeekableStream : public IFX_SeekableReadStream, + public IFX_SeekableWriteStream { public: - virtual IFX_FileStream* Retain() = 0; + virtual IFX_SeekableStream* Retain() = 0; - // IFX_FileRead: + // IFX_SeekableReadStream: void Release() override = 0; FX_BOOL IsEOF() override = 0; FX_FILESIZE GetPosition() override = 0; @@ -110,7 +111,7 @@ class IFX_FileStream : public IFX_FileRead, public IFX_FileWrite { FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override = 0; FX_FILESIZE GetSize() override = 0; - // IFX_FileWrite: + // IFX_SeekableWriteStream: FX_BOOL WriteBlock(const void* buffer, FX_FILESIZE offset, size_t size) override = 0; @@ -118,8 +119,10 @@ class IFX_FileStream : public IFX_FileRead, public IFX_FileWrite { FX_BOOL Flush() override = 0; }; -IFX_FileStream* FX_CreateFileStream(const FX_CHAR* filename, uint32_t dwModes); -IFX_FileStream* FX_CreateFileStream(const FX_WCHAR* filename, uint32_t dwModes); +IFX_SeekableStream* FX_CreateFileStream(const FX_CHAR* filename, + uint32_t dwModes); +IFX_SeekableStream* FX_CreateFileStream(const FX_WCHAR* filename, + uint32_t dwModes); #ifdef PDF_ENABLE_XFA class IFX_FileAccess { @@ -128,12 +131,12 @@ class IFX_FileAccess { virtual void Release() = 0; virtual IFX_FileAccess* Retain() = 0; virtual void GetPath(CFX_WideString& wsPath) = 0; - virtual IFX_FileStream* CreateFileStream(uint32_t dwModes) = 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_FileStream { +class IFX_MemoryStream : public IFX_SeekableStream { public: virtual FX_BOOL IsConsecutive() const = 0; virtual void EstimateSize(size_t nInitSize, size_t nGrowSize) = 0; @@ -149,9 +152,9 @@ IFX_MemoryStream* FX_CreateMemoryStream(uint8_t* pBuffer, FX_BOOL bTakeOver = FALSE); IFX_MemoryStream* FX_CreateMemoryStream(FX_BOOL bConsecutive = FALSE); -class IFX_BufferRead : public IFX_StreamRead { +class IFX_BufferRead : public IFX_ReadStream { public: - // IFX_StreamRead: + // IFX_ReadStream: void Release() override = 0; FX_BOOL IsEOF() override = 0; FX_FILESIZE GetPosition() override = 0; diff --git a/core/fxcrt/fx_xml.h b/core/fxcrt/fx_xml.h index 78f162597f..4ab28f66c5 100644 --- a/core/fxcrt/fx_xml.h +++ b/core/fxcrt/fx_xml.h @@ -58,7 +58,7 @@ class CXML_Element { size_t size, FX_BOOL bSaveSpaceChars = FALSE, FX_FILESIZE* pParsedSize = nullptr); - static CXML_Element* Parse(IFX_FileRead* pFile, + static CXML_Element* Parse(IFX_SeekableReadStream* pFile, FX_BOOL bSaveSpaceChars = FALSE, FX_FILESIZE* pParsedSize = nullptr); static CXML_Element* Parse(IFX_BufferRead* pBuffer, diff --git a/core/fxcrt/fx_xml_parser.cpp b/core/fxcrt/fx_xml_parser.cpp index 563e1c961b..e6c3543378 100644 --- a/core/fxcrt/fx_xml_parser.cpp +++ b/core/fxcrt/fx_xml_parser.cpp @@ -57,7 +57,7 @@ FX_FILESIZE CXML_DataBufAcc::GetBlockOffset() { return 0; } -CXML_DataStmAcc::CXML_DataStmAcc(IFX_FileRead* pFileRead) +CXML_DataStmAcc::CXML_DataStmAcc(IFX_SeekableReadStream* pFileRead) : m_pFileRead(pFileRead), m_pBuffer(nullptr), m_nStart(0), m_dwSize(0) { ASSERT(m_pFileRead); } @@ -132,7 +132,7 @@ FX_BOOL CXML_Parser::Init(uint8_t* pBuffer, size_t size) { m_pDataAcc = new CXML_DataBufAcc(pBuffer, size); return Init(TRUE); } -FX_BOOL CXML_Parser::Init(IFX_FileRead* pFileRead) { +FX_BOOL CXML_Parser::Init(IFX_SeekableReadStream* pFileRead) { m_pDataAcc = new CXML_DataStmAcc(pFileRead); return Init(TRUE); } @@ -651,7 +651,7 @@ CXML_Element* CXML_Element::Parse(const void* pBuffer, } return XML_ContinueParse(parser, bSaveSpaceChars, pParsedSize); } -CXML_Element* CXML_Element::Parse(IFX_FileRead* pFile, +CXML_Element* CXML_Element::Parse(IFX_SeekableReadStream* pFile, FX_BOOL bSaveSpaceChars, FX_FILESIZE* pParsedSize) { CXML_Parser parser; diff --git a/core/fxcrt/fxcrt_stream.cpp b/core/fxcrt/fxcrt_stream.cpp index a8c96bf02c..638a183177 100644 --- a/core/fxcrt/fxcrt_stream.cpp +++ b/core/fxcrt/fxcrt_stream.cpp @@ -6,22 +6,22 @@ #include "core/fxcrt/fx_stream.h" -FX_BOOL IFX_FileWrite::WriteBlock(const void* pData, size_t size) { +FX_BOOL IFX_SeekableWriteStream::WriteBlock(const void* pData, size_t size) { return WriteBlock(pData, GetSize(), size); } -FX_BOOL IFX_FileRead::IsEOF() { +FX_BOOL IFX_SeekableReadStream::IsEOF() { return FALSE; } -FX_FILESIZE IFX_FileRead::GetPosition() { +FX_FILESIZE IFX_SeekableReadStream::GetPosition() { return 0; } -size_t IFX_FileRead::ReadBlock(void* buffer, size_t size) { +size_t IFX_SeekableReadStream::ReadBlock(void* buffer, size_t size) { return 0; } -FX_BOOL IFX_FileStream::WriteBlock(const void* buffer, size_t size) { +FX_BOOL IFX_SeekableStream::WriteBlock(const void* buffer, size_t size) { return WriteBlock(buffer, GetSize(), size); } diff --git a/core/fxcrt/xml_int.h b/core/fxcrt/xml_int.h index 47997062cc..aa157c2333 100644 --- a/core/fxcrt/xml_int.h +++ b/core/fxcrt/xml_int.h @@ -37,7 +37,7 @@ class CXML_DataBufAcc : public IFX_BufferRead { class CXML_DataStmAcc : public IFX_BufferRead { public: - explicit CXML_DataStmAcc(IFX_FileRead* pFileRead); + explicit CXML_DataStmAcc(IFX_SeekableReadStream* pFileRead); ~CXML_DataStmAcc() override; // IFX_BufferRead @@ -51,7 +51,7 @@ class CXML_DataStmAcc : public IFX_BufferRead { FX_FILESIZE GetBlockOffset() override; protected: - IFX_FileRead* m_pFileRead; + IFX_SeekableReadStream* m_pFileRead; uint8_t* m_pBuffer; FX_FILESIZE m_nStart; size_t m_dwSize; @@ -63,7 +63,7 @@ class CXML_Parser { ~CXML_Parser(); FX_BOOL Init(uint8_t* pBuffer, size_t size); - FX_BOOL Init(IFX_FileRead* pFileRead); + FX_BOOL Init(IFX_SeekableReadStream* pFileRead); FX_BOOL Init(IFX_BufferRead* pBuffer); FX_BOOL Init(FX_BOOL bOwndedStream); FX_BOOL ReadNextBlock(); diff --git a/core/fxge/android/cfpf_skiafontmgr.cpp b/core/fxge/android/cfpf_skiafontmgr.cpp index 290551bedf..2deb327392 100644 --- a/core/fxge/android/cfpf_skiafontmgr.cpp +++ b/core/fxge/android/cfpf_skiafontmgr.cpp @@ -26,7 +26,8 @@ static unsigned long FPF_SkiaStream_Read(FXFT_Stream stream, unsigned long offset, unsigned char* buffer, unsigned long count) { - IFX_FileRead* pFileRead = (IFX_FileRead*)stream->descriptor.pointer; + IFX_SeekableReadStream* pFileRead = + (IFX_SeekableReadStream*)stream->descriptor.pointer; if (!pFileRead) return 0; if (count > 0) { @@ -355,7 +356,7 @@ CFPF_SkiaFont* CFPF_SkiaFontMgr::CreateFont(const CFX_ByteStringC& bsFamilyname, return nullptr; } -FXFT_Face CFPF_SkiaFontMgr::GetFontFace(IFX_FileRead* pFileRead, +FXFT_Face CFPF_SkiaFontMgr::GetFontFace(IFX_SeekableReadStream* pFileRead, int32_t iFaceIndex) { if (!pFileRead) return nullptr; diff --git a/core/fxge/android/fpf_skiafontmgr.h b/core/fxge/android/fpf_skiafontmgr.h index bd586204c5..74e7adeb5a 100644 --- a/core/fxge/android/fpf_skiafontmgr.h +++ b/core/fxge/android/fpf_skiafontmgr.h @@ -75,7 +75,7 @@ class CFPF_SkiaFileFont : public CFPF_SkiaFontDescriptor { // CFPF_SkiaFontDescriptor int32_t GetType() const override { return FPF_SKIAFONTTYPE_File; } - IFX_FileRead* m_pFile; + IFX_SeekableReadStream* m_pFile; }; class CFPF_SkiaBufferFont : public CFPF_SkiaFontDescriptor { @@ -101,7 +101,8 @@ class CFPF_SkiaFontMgr { uint32_t dwMatch = 0); bool InitFTLibrary(); - FXFT_Face GetFontFace(IFX_FileRead* pFileRead, int32_t iFaceIndex = 0); + FXFT_Face GetFontFace(IFX_SeekableReadStream* pFileRead, + int32_t iFaceIndex = 0); FXFT_Face GetFontFace(const CFX_ByteStringC& bsFile, int32_t iFaceIndex = 0); FXFT_Face GetFontFace(const uint8_t* pBuffer, size_t szBuffer, diff --git a/core/fxge/fx_font.h b/core/fxge/fx_font.h index 8dda12af50..a562795784 100644 --- a/core/fxge/fx_font.h +++ b/core/fxge/fx_font.h @@ -110,7 +110,7 @@ class CFX_Font { CFX_SubstFont* GetSubstFont() const { return m_pSubstFont.get(); } #ifdef PDF_ENABLE_XFA - FX_BOOL LoadFile(IFX_FileRead* pFile, + FX_BOOL LoadFile(IFX_SeekableReadStream* pFile, int nFaceIndex = 0, int* pFaceCount = nullptr); diff --git a/core/fxge/ge/cfx_font.cpp b/core/fxge/ge/cfx_font.cpp index f58462479f..d1c31d0f51 100644 --- a/core/fxge/ge/cfx_font.cpp +++ b/core/fxge/ge/cfx_font.cpp @@ -39,7 +39,8 @@ unsigned long FTStreamRead(FXFT_Stream stream, if (count == 0) return 0; - IFX_FileRead* pFile = static_cast<IFX_FileRead*>(stream->descriptor.pointer); + IFX_SeekableReadStream* pFile = + static_cast<IFX_SeekableReadStream*>(stream->descriptor.pointer); return pFile->ReadBlock(buffer, offset, count) ? count : 0; } @@ -47,7 +48,7 @@ void FTStreamClose(FXFT_Stream stream) {} FX_BOOL LoadFileImp(FXFT_Library library, FXFT_Face* Face, - IFX_FileRead* pFile, + IFX_SeekableReadStream* pFile, int32_t faceIndex, std::unique_ptr<FXFT_StreamRec>* stream) { std::unique_ptr<FXFT_StreamRec> stream1(new FXFT_StreamRec()); @@ -331,7 +332,7 @@ void CFX_Font::LoadSubst(const CFX_ByteString& face_name, } #ifdef PDF_ENABLE_XFA -FX_BOOL CFX_Font::LoadFile(IFX_FileRead* pFile, +FX_BOOL CFX_Font::LoadFile(IFX_SeekableReadStream* pFile, int nFaceIndex, int* pFaceCount) { m_bEmbedded = FALSE; diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.cpp b/fpdfsdk/cpdfsdk_formfillenvironment.cpp index 71b83b2655..d93e309d2f 100644 --- a/fpdfsdk/cpdfsdk_formfillenvironment.cpp +++ b/fpdfsdk/cpdfsdk_formfillenvironment.cpp @@ -470,7 +470,7 @@ FPDF_FILEHANDLER* CPDFSDK_FormFillEnvironment::OpenFile(int fileType, return nullptr; } -IFX_FileRead* CPDFSDK_FormFillEnvironment::DownloadFromURL( +IFX_SeekableReadStream* CPDFSDK_FormFillEnvironment::DownloadFromURL( const FX_WCHAR* url) { if (!m_pInfo || !m_pInfo->FFI_DownloadFromURL) return nullptr; diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.h b/fpdfsdk/cpdfsdk_formfillenvironment.h index f59999f9ce..4cdbda3f7c 100644 --- a/fpdfsdk/cpdfsdk_formfillenvironment.h +++ b/fpdfsdk/cpdfsdk_formfillenvironment.h @@ -147,7 +147,7 @@ class CPDFSDK_FormFillEnvironment FPDF_FILEHANDLER* OpenFile(int fileType, FPDF_WIDESTRING wsURL, const char* mode); - IFX_FileRead* DownloadFromURL(const FX_WCHAR* url); + IFX_SeekableReadStream* DownloadFromURL(const FX_WCHAR* url); CFX_WideString PostRequestURL(const FX_WCHAR* wsURL, const FX_WCHAR* wsData, const FX_WCHAR* wsContentType, diff --git a/fpdfsdk/fpdf_dataavail.cpp b/fpdfsdk/fpdf_dataavail.cpp index fb866ec229..0bf67e9826 100644 --- a/fpdfsdk/fpdf_dataavail.cpp +++ b/fpdfsdk/fpdf_dataavail.cpp @@ -57,14 +57,14 @@ class CFPDF_FileAvailWrap : public CPDF_DataAvail::FileAvail { FX_FILEAVAIL* m_pfileAvail; }; -class CFPDF_FileAccessWrap : public IFX_FileRead { +class CFPDF_FileAccessWrap : public IFX_SeekableReadStream { public: CFPDF_FileAccessWrap() { m_pFileAccess = nullptr; } ~CFPDF_FileAccessWrap() override {} void Set(FPDF_FILEACCESS* pFile) { m_pFileAccess = pFile; } - // IFX_FileRead + // IFX_SeekableReadStream FX_FILESIZE GetSize() override { return m_pFileAccess->m_FileLen; } FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override { diff --git a/fpdfsdk/fpdfeditimg.cpp b/fpdfsdk/fpdfeditimg.cpp index 042ad2bf37..282244970d 100644 --- a/fpdfsdk/fpdfeditimg.cpp +++ b/fpdfsdk/fpdfeditimg.cpp @@ -32,7 +32,7 @@ FPDFImageObj_LoadJpegFile(FPDF_PAGE* pages, if (!image_object || !fileAccess || !pages) return FALSE; - IFX_FileRead* pFile = new CPDF_CustomAccess(fileAccess); + IFX_SeekableReadStream* pFile = new CPDF_CustomAccess(fileAccess); CPDF_ImageObject* pImgObj = reinterpret_cast<CPDF_ImageObject*>(image_object); for (int index = 0; index < nCount; index++) { CPDF_Page* pPage = CPDFPageFromFPDFPage(pages[index]); diff --git a/fpdfsdk/fpdfsave.cpp b/fpdfsdk/fpdfsave.cpp index 364f4d2d6f..9cdc714f3f 100644 --- a/fpdfsdk/fpdfsave.cpp +++ b/fpdfsdk/fpdfsave.cpp @@ -36,7 +36,7 @@ #include <ctime> #endif -class CFX_IFileWrite final : public IFX_StreamWrite { +class CFX_IFileWrite final : public IFX_WriteStream { public: CFX_IFileWrite(); FX_BOOL Init(FPDF_FILEWRITE* pFileWriteStruct); diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp index e0c24ec792..92ca34effa 100644 --- a/fpdfsdk/fpdfview.cpp +++ b/fpdfsdk/fpdfview.cpp @@ -96,7 +96,7 @@ CFPDF_FileStream::CFPDF_FileStream(FPDF_FILEHANDLER* pFS) { m_nCurPos = 0; } -IFX_FileStream* CFPDF_FileStream::Retain() { +IFX_SeekableStream* CFPDF_FileStream::Retain() { return this; } @@ -325,7 +325,8 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path, FPDF_BYTESTRING password) { // NOTE: the creation of the file needs to be by the embedder on the // other side of this API. - IFX_FileRead* pFileAccess = FX_CreateFileRead((const FX_CHAR*)file_path); + IFX_SeekableReadStream* pFileAccess = + FX_CreateFileRead((const FX_CHAR*)file_path); if (!pFileAccess) { return nullptr; } @@ -381,7 +382,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_LoadXFA(FPDF_DOCUMENT document) { } #endif // PDF_ENABLE_XFA -class CMemFile final : public IFX_FileRead { +class CMemFile final : public IFX_SeekableReadStream { public: CMemFile(uint8_t* pBuf, FX_FILESIZE size) : m_pBuf(pBuf), m_size(size) {} diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_app.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_app.cpp index 61694d0a28..dc5c4be0d6 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_app.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_app.cpp @@ -187,7 +187,7 @@ CFX_WideString CPDFXFA_App::Response(const CFX_WideString& wsQuestion, return wsAnswer; } -IFX_FileRead* CPDFXFA_App::DownloadURL(const CFX_WideString& wsURL) { +IFX_SeekableReadStream* CPDFXFA_App::DownloadURL(const CFX_WideString& wsURL) { CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pFormFillEnvList.GetAt(0); return pFormFillEnv ? pFormFillEnv->DownloadFromURL(wsURL.c_str()) : nullptr; } diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_app.h b/fpdfsdk/fpdfxfa/cpdfxfa_app.h index 78184d1434..9ec045f540 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_app.h +++ b/fpdfsdk/fpdfxfa/cpdfxfa_app.h @@ -48,7 +48,7 @@ class CPDFXFA_App : public IXFA_AppProvider { const CFX_WideString& wsDefaultAnswer, FX_BOOL bMark) override; - IFX_FileRead* DownloadURL(const CFX_WideString& wsURL) override; + IFX_SeekableReadStream* DownloadURL(const CFX_WideString& wsURL) override; FX_BOOL PostRequestURL(const CFX_WideString& wsURL, const CFX_WideString& wsData, const CFX_WideString& wsContentType, diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp index 7e7ee50825..13b79baf9b 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp @@ -704,7 +704,7 @@ FX_BOOL CPDFXFA_DocEnvironment::SubmitData(CXFA_FFDoc* hDoc, return ret; } -IFX_FileRead* CPDFXFA_DocEnvironment::OpenLinkedFile( +IFX_SeekableReadStream* CPDFXFA_DocEnvironment::OpenLinkedFile( CXFA_FFDoc* hDoc, const CFX_WideString& wsLink) { CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pDocument->GetFormFillEnv(); diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h index 537e1ebed3..999d44586c 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h +++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h @@ -85,8 +85,8 @@ class CPDFXFA_DocEnvironment : public IXFA_DocEnvironment { const CFX_ByteStringC& szPropName, CFXJSE_Value* pValue) override; - IFX_FileRead* OpenLinkedFile(CXFA_FFDoc* hDoc, - const CFX_WideString& wsLink) override; + IFX_SeekableReadStream* OpenLinkedFile(CXFA_FFDoc* hDoc, + const CFX_WideString& wsLink) override; private: FX_BOOL OnBeforeNotifySubmit(); diff --git a/fpdfsdk/fsdk_define.h b/fpdfsdk/fsdk_define.h index b59a3c2657..4fea138779 100644 --- a/fpdfsdk/fsdk_define.h +++ b/fpdfsdk/fsdk_define.h @@ -25,12 +25,12 @@ class CPDF_Page; class CPDF_PageRenderContext; class IFSDK_PAUSE_Adapter; -class CPDF_CustomAccess final : public IFX_FileRead { +class CPDF_CustomAccess final : public IFX_SeekableReadStream { public: explicit CPDF_CustomAccess(FPDF_FILEACCESS* pFileAccess); ~CPDF_CustomAccess() override {} - // IFX_FileRead + // IFX_SeekableReadStream FX_FILESIZE GetSize() override; void Release() override; FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override; @@ -40,13 +40,13 @@ class CPDF_CustomAccess final : public IFX_FileRead { }; #ifdef PDF_ENABLE_XFA -class CFPDF_FileStream : public IFX_FileStream { +class CFPDF_FileStream : public IFX_SeekableStream { public: explicit CFPDF_FileStream(FPDF_FILEHANDLER* pFS); ~CFPDF_FileStream() override {} - // IFX_FileStream: - IFX_FileStream* Retain() override; + // IFX_SeekableStream: + IFX_SeekableStream* Retain() override; void Release() override; FX_FILESIZE GetSize() override; FX_BOOL IsEOF() override; diff --git a/testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc b/testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc index 501c4ff38b..b32a182f23 100644 --- a/testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc +++ b/testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc @@ -16,8 +16,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { if (!stream) return 0; - std::unique_ptr<IFX_FileRead, ReleaseDeleter<IFX_FileRead>> fileRead( - FX_CreateFileRead(stream.get(), false)); + std::unique_ptr<IFX_SeekableReadStream, + ReleaseDeleter<IFX_SeekableReadStream>> + fileRead(FX_CreateFileRead(stream.get(), false)); if (!fileRead) return 0; diff --git a/testing/libfuzzer/xfa_codec_fuzzer.h b/testing/libfuzzer/xfa_codec_fuzzer.h index 13a467e1ef..c31761818f 100644 --- a/testing/libfuzzer/xfa_codec_fuzzer.h +++ b/testing/libfuzzer/xfa_codec_fuzzer.h @@ -41,7 +41,7 @@ class XFACodecFuzzer { } private: - class Reader : public IFX_FileRead { + class Reader : public IFX_SeekableReadStream { public: Reader(const uint8_t* data, size_t size) : m_data(data), m_size(size) {} ~Reader() {} diff --git a/xfa/fde/xml/cfx_saxreader.cpp b/xfa/fde/xml/cfx_saxreader.cpp index 187d14e98b..8f18451ea0 100644 --- a/xfa/fde/xml/cfx_saxreader.cpp +++ b/xfa/fde/xml/cfx_saxreader.cpp @@ -70,7 +70,7 @@ CFX_SAXFile::CFX_SAXFile() m_pBuf(nullptr), m_dwBufSize(0), m_dwBufIndex(0) {} -FX_BOOL CFX_SAXFile::StartFile(IFX_FileRead* pFile, +FX_BOOL CFX_SAXFile::StartFile(IFX_SeekableReadStream* pFile, uint32_t dwStart, uint32_t dwLen) { ASSERT(!m_pFile && pFile); @@ -214,7 +214,7 @@ FX_BOOL CFX_SAXReader::SkipSpace(uint8_t ch) { return (m_dwParseMode & CFX_SaxParseMode_NotSkipSpace) == 0 && ch < 0x21; } -int32_t CFX_SAXReader::StartParse(IFX_FileRead* pFile, +int32_t CFX_SAXReader::StartParse(IFX_SeekableReadStream* pFile, uint32_t dwStart, uint32_t dwLen, uint32_t dwParseMode) { diff --git a/xfa/fde/xml/cfx_saxreader.h b/xfa/fde/xml/cfx_saxreader.h index b6bedfe65c..10ba69f1f5 100644 --- a/xfa/fde/xml/cfx_saxreader.h +++ b/xfa/fde/xml/cfx_saxreader.h @@ -38,10 +38,12 @@ class CFX_SAXItem { class CFX_SAXFile { public: CFX_SAXFile(); - FX_BOOL StartFile(IFX_FileRead* pFile, uint32_t dwStart, uint32_t dwLen); + FX_BOOL StartFile(IFX_SeekableReadStream* pFile, + uint32_t dwStart, + uint32_t dwLen); FX_BOOL ReadNextBlock(); void Reset(); - IFX_FileRead* m_pFile; + IFX_SeekableReadStream* m_pFile; uint32_t m_dwStart; uint32_t m_dwEnd; uint32_t m_dwCur; @@ -70,7 +72,7 @@ class CFX_SAXReader { CFX_SAXReader(); ~CFX_SAXReader(); - int32_t StartParse(IFX_FileRead* pFile, + int32_t StartParse(IFX_SeekableReadStream* pFile, uint32_t dwStart = 0, uint32_t dwLen = -1, uint32_t dwParseMode = 0); diff --git a/xfa/fgas/crt/fgas_stream.cpp b/xfa/fgas/crt/fgas_stream.cpp index 74c19eab32..f0a2a88100 100644 --- a/xfa/fgas/crt/fgas_stream.cpp +++ b/xfa/fgas/crt/fgas_stream.cpp @@ -104,7 +104,7 @@ class CFX_FileReadStreamImp : public IFX_StreamImp { CFX_FileReadStreamImp(); ~CFX_FileReadStreamImp() override {} - FX_BOOL LoadFileRead(IFX_FileRead* pFileRead, uint32_t dwAccess); + FX_BOOL LoadFileRead(IFX_SeekableReadStream* pFileRead, uint32_t dwAccess); // IFX_StreamImp: int32_t GetLength() const override; @@ -125,7 +125,7 @@ class CFX_FileReadStreamImp : public IFX_StreamImp { FX_BOOL SetLength(int32_t iLength) override { return FALSE; } protected: - IFX_FileRead* m_pFileRead; + IFX_SeekableReadStream* m_pFileRead; int32_t m_iPosition; int32_t m_iLength; }; @@ -170,7 +170,7 @@ class CFX_FileWriteStreamImp : public IFX_StreamImp { CFX_FileWriteStreamImp(); ~CFX_FileWriteStreamImp() override {} - FX_BOOL LoadFileWrite(IFX_FileWrite* pFileWrite, uint32_t dwAccess); + FX_BOOL LoadFileWrite(IFX_SeekableWriteStream* pFileWrite, uint32_t dwAccess); // IFX_StreamImp: int32_t GetLength() const override; @@ -189,7 +189,7 @@ class CFX_FileWriteStreamImp : public IFX_StreamImp { FX_BOOL SetLength(int32_t iLength) override { return FALSE; } protected: - IFX_FileWrite* m_pFileWrite; + IFX_SeekableWriteStream* m_pFileWrite; int32_t m_iPosition; }; @@ -208,8 +208,8 @@ class CFX_Stream : public IFX_Stream { FX_BOOL LoadFile(const FX_WCHAR* pszSrcFileName, uint32_t dwAccess); FX_BOOL LoadBuffer(uint8_t* pData, int32_t iTotalSize, uint32_t dwAccess); - FX_BOOL LoadFileRead(IFX_FileRead* pFileRead, uint32_t dwAccess); - FX_BOOL LoadFileWrite(IFX_FileWrite* pFileWrite, uint32_t dwAccess); + FX_BOOL LoadFileRead(IFX_SeekableReadStream* pFileRead, uint32_t dwAccess); + FX_BOOL LoadFileWrite(IFX_SeekableWriteStream* pFileWrite, uint32_t dwAccess); FX_BOOL LoadBufferRead(IFX_BufferRead* pBufferRead, int32_t iFileSize, uint32_t dwAccess, @@ -289,12 +289,12 @@ class CFX_TextStream : public IFX_Stream { void InitStream(); }; -class CFGAS_FileRead : public IFX_FileRead { +class CFGAS_FileRead : public IFX_SeekableReadStream { public: CFGAS_FileRead(IFX_Stream* pStream, FX_BOOL bReleaseStream); ~CFGAS_FileRead() override; - // IFX_FileRead + // IFX_SeekableReadStream void Release() override; FX_FILESIZE GetSize() override; FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override; @@ -336,7 +336,7 @@ FX_BOOL FileSetSize(FXSYS_FILE* file, int32_t size) { } // namespace // static -IFX_Stream* IFX_Stream::CreateStream(IFX_FileRead* pFileRead, +IFX_Stream* IFX_Stream::CreateStream(IFX_SeekableReadStream* pFileRead, uint32_t dwAccess) { CFX_Stream* pSR = new CFX_Stream; if (!pSR->LoadFileRead(pFileRead, dwAccess)) { @@ -350,7 +350,7 @@ IFX_Stream* IFX_Stream::CreateStream(IFX_FileRead* pFileRead, } // static -IFX_Stream* IFX_Stream::CreateStream(IFX_FileWrite* pFileWrite, +IFX_Stream* IFX_Stream::CreateStream(IFX_SeekableWriteStream* pFileWrite, uint32_t dwAccess) { CFX_Stream* pSR = new CFX_Stream; if (!pSR->LoadFileWrite(pFileWrite, dwAccess)) { @@ -549,7 +549,7 @@ FX_BOOL CFX_FileStreamImp::SetLength(int32_t iLength) { } CFX_FileReadStreamImp::CFX_FileReadStreamImp() : m_pFileRead(nullptr), m_iPosition(0), m_iLength(0) {} -FX_BOOL CFX_FileReadStreamImp::LoadFileRead(IFX_FileRead* pFileRead, +FX_BOOL CFX_FileReadStreamImp::LoadFileRead(IFX_SeekableReadStream* pFileRead, uint32_t dwAccess) { ASSERT(!m_pFileRead && pFileRead); if (dwAccess & FX_STREAMACCESS_Write) { @@ -744,8 +744,9 @@ int32_t CFX_BufferReadStreamImp::ReadString(FX_WCHAR* pStr, } CFX_FileWriteStreamImp::CFX_FileWriteStreamImp() : m_pFileWrite(nullptr), m_iPosition(0) {} -FX_BOOL CFX_FileWriteStreamImp::LoadFileWrite(IFX_FileWrite* pFileWrite, - uint32_t dwAccess) { +FX_BOOL CFX_FileWriteStreamImp::LoadFileWrite( + IFX_SeekableWriteStream* pFileWrite, + uint32_t dwAccess) { ASSERT(!m_pFileWrite && pFileWrite); if (dwAccess & FX_STREAMACCESS_Read) { return FALSE; @@ -1152,7 +1153,8 @@ FX_BOOL CFX_Stream::LoadFile(const FX_WCHAR* pszSrcFileName, return TRUE; } -FX_BOOL CFX_Stream::LoadFileRead(IFX_FileRead* pFileRead, uint32_t dwAccess) { +FX_BOOL CFX_Stream::LoadFileRead(IFX_SeekableReadStream* pFileRead, + uint32_t dwAccess) { if (m_eStreamType != FX_SREAMTYPE_Unknown || m_pStreamImp) return FALSE; @@ -1170,7 +1172,7 @@ FX_BOOL CFX_Stream::LoadFileRead(IFX_FileRead* pFileRead, uint32_t dwAccess) { return TRUE; } -FX_BOOL CFX_Stream::LoadFileWrite(IFX_FileWrite* pFileWrite, +FX_BOOL CFX_Stream::LoadFileWrite(IFX_SeekableWriteStream* pFileWrite, uint32_t dwAccess) { if (m_eStreamType != FX_SREAMTYPE_Unknown || m_pStreamImp) return FALSE; @@ -1467,8 +1469,8 @@ IFX_Stream* CFX_Stream::CreateSharedStream(uint32_t dwAccess, } return pShared; } -IFX_FileRead* FX_CreateFileRead(IFX_Stream* pBaseStream, - FX_BOOL bReleaseStream) { +IFX_SeekableReadStream* FX_CreateFileRead(IFX_Stream* pBaseStream, + FX_BOOL bReleaseStream) { ASSERT(pBaseStream); return new CFGAS_FileRead(pBaseStream, bReleaseStream); } diff --git a/xfa/fgas/crt/fgas_stream.h b/xfa/fgas/crt/fgas_stream.h index 637402f1f5..c61688d7a7 100644 --- a/xfa/fgas/crt/fgas_stream.h +++ b/xfa/fgas/crt/fgas_stream.h @@ -12,8 +12,8 @@ class IFX_Stream; -IFX_FileRead* FX_CreateFileRead(IFX_Stream* pBaseStream, - FX_BOOL bReleaseStream); +IFX_SeekableReadStream* FX_CreateFileRead(IFX_Stream* pBaseStream, + FX_BOOL bReleaseStream); enum FX_STREAMACCESS { FX_STREAMACCESS_Binary = 0x00, @@ -33,8 +33,10 @@ enum FX_STREAMSEEK { class IFX_Stream { public: - static IFX_Stream* CreateStream(IFX_FileRead* pFileRead, uint32_t dwAccess); - static IFX_Stream* CreateStream(IFX_FileWrite* pFileWrite, uint32_t dwAccess); + static IFX_Stream* CreateStream(IFX_SeekableReadStream* pFileRead, + uint32_t dwAccess); + static IFX_Stream* CreateStream(IFX_SeekableWriteStream* pFileWrite, + uint32_t dwAccess); static IFX_Stream* CreateStream(uint8_t* pData, int32_t length, uint32_t dwAccess); diff --git a/xfa/fgas/font/fgas_gefont.h b/xfa/fgas/font/fgas_gefont.h index 5a13aec372..7245e836a1 100644 --- a/xfa/fgas/font/fgas_gefont.h +++ b/xfa/fgas/font/fgas_gefont.h @@ -101,7 +101,9 @@ class CFGAS_GEFont { int32_t m_iRefCount; bool m_bExternalFont; std::unique_ptr<IFX_Stream, ReleaseDeleter<IFX_Stream>> m_pStream; - std::unique_ptr<IFX_FileRead, ReleaseDeleter<IFX_FileRead>> m_pFileRead; + std::unique_ptr<IFX_SeekableReadStream, + ReleaseDeleter<IFX_SeekableReadStream>> + m_pFileRead; std::unique_ptr<CFX_UnicodeEncoding> m_pFontEncoding; std::unique_ptr<CFX_DiscreteArrayTemplate<uint16_t>> m_pCharWidthMap; std::unique_ptr<CFX_MassArrayTemplate<CFX_Rect>> m_pRectArray; diff --git a/xfa/fgas/font/fgas_stdfontmgr.cpp b/xfa/fgas/font/fgas_stdfontmgr.cpp index 59bd272a93..646eb94696 100644 --- a/xfa/fgas/font/fgas_stdfontmgr.cpp +++ b/xfa/fgas/font/fgas_stdfontmgr.cpp @@ -591,7 +591,7 @@ CFGAS_FontMgrImp::~CFGAS_FontMgrImp() { pos = m_IFXFont2FileRead.GetStartPosition(); while (pos) { CFGAS_GEFont* pFont; - IFX_FileRead* pFileRead; + IFX_SeekableReadStream* pFileRead; m_IFXFont2FileRead.GetNextAssoc(pos, pFont, pFileRead); pFileRead->Release(); } @@ -609,7 +609,7 @@ FX_BOOL CFGAS_FontMgrImp::EnumFontsFromFontMapper() { pSystemFontInfo->EnumFontList(pFontMapper); for (int32_t i = 0; i < pFontMapper->GetFaceSize(); ++i) { - IFX_FileRead* pFontStream = + IFX_SeekableReadStream* pFontStream = CreateFontStream(pFontMapper, pSystemFontInfo, i); if (!pFontStream) continue; @@ -629,7 +629,7 @@ FX_BOOL CFGAS_FontMgrImp::EnumFontsFromFiles() { CFX_GEModule::Get()->GetFontMgr()->InitFTLibrary(); FX_POSITION pos = m_pFontSource->GetStartPosition(); IFX_FileAccess* pFontSource = nullptr; - IFX_FileRead* pFontStream = nullptr; + IFX_SeekableReadStream* pFontStream = nullptr; while (pos) { pFontSource = m_pFontSource->GetNext(pos); pFontStream = pFontSource->CreateFileStream(FX_FILEMODE_ReadOnly); @@ -783,7 +783,8 @@ CFGAS_GEFont* CFGAS_FontMgrImp::GetFontByUnicode( FX_BOOL CFGAS_FontMgrImp::VerifyUnicode(CFX_FontDescriptor* pDesc, FX_WCHAR wcUnicode) { - IFX_FileRead* pFileRead = CreateFontStream(pDesc->m_wsFaceName.UTF8Encode()); + IFX_SeekableReadStream* pFileRead = + CreateFontStream(pDesc->m_wsFaceName.UTF8Encode()); if (!pFileRead) return FALSE; FXFT_Face pFace = LoadFace(pFileRead, pDesc->m_nFaceIndex); @@ -835,7 +836,8 @@ CFGAS_GEFont* CFGAS_FontMgrImp::LoadFont(const CFX_WideString& wsFaceName, if (!pSystemFontInfo) return nullptr; - IFX_FileRead* pFontStream = CreateFontStream(wsFaceName.UTF8Encode()); + IFX_SeekableReadStream* pFontStream = + CreateFontStream(wsFaceName.UTF8Encode()); if (!pFontStream) return nullptr; @@ -867,7 +869,8 @@ unsigned long _ftStreamRead(FXFT_Stream stream, if (count == 0) return 0; - IFX_FileRead* pFile = (IFX_FileRead*)stream->descriptor.pointer; + IFX_SeekableReadStream* pFile = + (IFX_SeekableReadStream*)stream->descriptor.pointer; int res = pFile->ReadBlock(buffer, offset, count); if (res) return count; @@ -878,7 +881,7 @@ void _ftStreamClose(FXFT_Stream stream) {} }; // extern "C" -FXFT_Face CFGAS_FontMgrImp::LoadFace(IFX_FileRead* pFontStream, +FXFT_Face CFGAS_FontMgrImp::LoadFace(IFX_SeekableReadStream* pFontStream, int32_t iFaceIndex) { if (!pFontStream) return nullptr; @@ -913,7 +916,7 @@ FXFT_Face CFGAS_FontMgrImp::LoadFace(IFX_FileRead* pFontStream, return pFace; } -IFX_FileRead* CFGAS_FontMgrImp::CreateFontStream( +IFX_SeekableReadStream* CFGAS_FontMgrImp::CreateFontStream( CFX_FontMapper* pFontMapper, IFX_SystemFontInfo* pSystemFontInfo, uint32_t index) { @@ -934,7 +937,7 @@ IFX_FileRead* CFGAS_FontMgrImp::CreateFontStream( return FX_CreateMemoryStream(pBuffer, dwFileSize, TRUE); } -IFX_FileRead* CFGAS_FontMgrImp::CreateFontStream( +IFX_SeekableReadStream* CFGAS_FontMgrImp::CreateFontStream( const CFX_ByteString& bsFaceName) { CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr(); CFX_FontMapper* pFontMapper = pFontMgr->GetBuiltinMapper(); @@ -1111,7 +1114,7 @@ void CFGAS_FontMgrImp::ClearFontCache() { pos = m_IFXFont2FileRead.GetStartPosition(); while (pos) { CFGAS_GEFont* pFont; - IFX_FileRead* pFileRead; + IFX_SeekableReadStream* pFileRead; m_IFXFont2FileRead.GetNextAssoc(pos, pFont, pFileRead); pFileRead->Release(); } @@ -1121,7 +1124,7 @@ void CFGAS_FontMgrImp::RemoveFont(CFGAS_GEFont* pEFont) { if (!pEFont) { return; } - IFX_FileRead* pFileRead; + IFX_SeekableReadStream* pFileRead; if (m_IFXFont2FileRead.Lookup(pEFont, pFileRead)) { pFileRead->Release(); m_IFXFont2FileRead.RemoveKey(pEFont); @@ -1179,7 +1182,7 @@ void CFGAS_FontMgrImp::RegisterFace(FXFT_Face pFace, m_InstalledFonts.Add(pFont.release()); } -void CFGAS_FontMgrImp::RegisterFaces(IFX_FileRead* pFontStream, +void CFGAS_FontMgrImp::RegisterFaces(IFX_SeekableReadStream* pFontStream, const CFX_WideString* pFaceName) { int32_t index = 0; int32_t num_faces = 0; diff --git a/xfa/fgas/font/fgas_stdfontmgr.h b/xfa/fgas/font/fgas_stdfontmgr.h index 785a47f854..fd7f9cd318 100644 --- a/xfa/fgas/font/fgas_stdfontmgr.h +++ b/xfa/fgas/font/fgas_stdfontmgr.h @@ -185,7 +185,7 @@ class CFGAS_FontMgrImp : public IFGAS_FontMgr { protected: void RegisterFace(FXFT_Face pFace, const CFX_WideString* pFaceName); - void RegisterFaces(IFX_FileRead* pFontStream, + void RegisterFaces(IFX_SeekableReadStream* pFontStream, const CFX_WideString* pFaceName); void GetNames(const uint8_t* name_table, CFX_WideStringArray& Names); std::vector<uint16_t> GetCharsets(FXFT_Face pFace) const; @@ -204,16 +204,16 @@ class CFGAS_FontMgrImp : public IFGAS_FontMgr { uint32_t dwFontStyles, const CFX_WideString& FontName, FX_WCHAR wcUnicode = 0xFFFE); - FXFT_Face LoadFace(IFX_FileRead* pFontStream, int32_t iFaceIndex); - IFX_FileRead* CreateFontStream(CFX_FontMapper* pFontMapper, - IFX_SystemFontInfo* pSystemFontInfo, - uint32_t index); - IFX_FileRead* CreateFontStream(const CFX_ByteString& bsFaceName); + FXFT_Face LoadFace(IFX_SeekableReadStream* pFontStream, int32_t iFaceIndex); + IFX_SeekableReadStream* CreateFontStream(CFX_FontMapper* pFontMapper, + IFX_SystemFontInfo* pSystemFontInfo, + uint32_t index); + IFX_SeekableReadStream* CreateFontStream(const CFX_ByteString& bsFaceName); CFX_FontDescriptors m_InstalledFonts; CFX_MapPtrTemplate<uint32_t, CFX_FontDescriptorInfos*> m_Hash2CandidateList; CFX_MapPtrTemplate<uint32_t, CFX_ArrayTemplate<CFGAS_GEFont*>*> m_Hash2Fonts; - CFX_MapPtrTemplate<CFGAS_GEFont*, IFX_FileRead*> m_IFXFont2FileRead; + CFX_MapPtrTemplate<CFGAS_GEFont*, IFX_SeekableReadStream*> m_IFXFont2FileRead; CFX_MapPtrTemplate<FX_WCHAR, CFGAS_GEFont*> m_FailedUnicodes2Nullptr; CFX_FontSourceEnum_File* const m_pFontSource; }; diff --git a/xfa/fxfa/app/xfa_checksum.cpp b/xfa/fxfa/app/xfa_checksum.cpp index 5e2b1feb0f..351ae73a03 100644 --- a/xfa/fxfa/app/xfa_checksum.cpp +++ b/xfa/fxfa/app/xfa_checksum.cpp @@ -225,7 +225,7 @@ void CXFA_ChecksumContext::StartChecksum() { m_pSAXReader = new CFX_SAXReader; } -FX_BOOL CXFA_ChecksumContext::UpdateChecksum(IFX_FileRead* pSrcFile, +FX_BOOL CXFA_ChecksumContext::UpdateChecksum(IFX_SeekableReadStream* pSrcFile, FX_FILESIZE offset, size_t size) { if (!m_pSAXReader || !pSrcFile) diff --git a/xfa/fxfa/app/xfa_ffapp.cpp b/xfa/fxfa/app/xfa_ffapp.cpp index f233eccf6f..d60d48fa75 100644 --- a/xfa/fxfa/app/xfa_ffapp.cpp +++ b/xfa/fxfa/app/xfa_ffapp.cpp @@ -90,7 +90,7 @@ CXFA_FFDocHandler* CXFA_FFApp::GetDocHandler() { } CXFA_FFDoc* CXFA_FFApp::CreateDoc(IXFA_DocEnvironment* pDocEnvironment, - IFX_FileRead* pStream, + IFX_SeekableReadStream* pStream, FX_BOOL bTakeOverFile) { std::unique_ptr<CXFA_FFDoc> pDoc(new CXFA_FFDoc(this, pDocEnvironment)); FX_BOOL bSuccess = pDoc->OpenDoc(pStream, bTakeOverFile); diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp index 25c78bd14b..494091b2f9 100644 --- a/xfa/fxfa/app/xfa_ffdoc.cpp +++ b/xfa/fxfa/app/xfa_ffdoc.cpp @@ -290,7 +290,8 @@ CXFA_FFDocView* CXFA_FFDoc::GetDocView() { return it != m_TypeToDocViewMap.end() ? it->second.get() : nullptr; } -FX_BOOL CXFA_FFDoc::OpenDoc(IFX_FileRead* pStream, FX_BOOL bTakeOverFile) { +FX_BOOL CXFA_FFDoc::OpenDoc(IFX_SeekableReadStream* pStream, + FX_BOOL bTakeOverFile) { m_bOwnStream = bTakeOverFile; m_pStream = pStream; return TRUE; @@ -324,7 +325,7 @@ FX_BOOL CXFA_FFDoc::OpenDoc(CPDF_Document* pPDFDoc) { if (xfaStreams.empty()) return FALSE; - IFX_FileRead* pFileRead = new CXFA_FileRead(xfaStreams); + IFX_SeekableReadStream* pFileRead = new CXFA_FileRead(xfaStreams); m_pPDFDoc = pPDFDoc; if (m_pStream) { m_pStream->Release(); @@ -416,7 +417,7 @@ CFX_DIBitmap* CXFA_FFDoc::GetPDFNamedImage(const CFX_WideStringC& wsName, CPDF_StreamAcc streamAcc; streamAcc.LoadAllData(pStream); - IFX_FileRead* pImageFileRead = + IFX_SeekableReadStream* pImageFileRead = FX_CreateMemoryStream((uint8_t*)streamAcc.GetData(), streamAcc.GetSize()); CFX_DIBitmap* pDibSource = XFA_LoadImageFromBuffer( @@ -427,7 +428,7 @@ CFX_DIBitmap* CXFA_FFDoc::GetPDFNamedImage(const CFX_WideStringC& wsName, } bool CXFA_FFDoc::SavePackage(XFA_HashCode code, - IFX_FileWrite* pFile, + IFX_SeekableWriteStream* pFile, CXFA_ChecksumContext* pCSContext) { CXFA_Document* doc = m_pDocumentParser->GetDocument(); @@ -445,7 +446,7 @@ bool CXFA_FFDoc::SavePackage(XFA_HashCode code, pFile, pNode, 0, bsChecksum.GetLength() ? bsChecksum.c_str() : nullptr); } -FX_BOOL CXFA_FFDoc::ImportData(IFX_FileRead* pStream, FX_BOOL bXDP) { +FX_BOOL CXFA_FFDoc::ImportData(IFX_SeekableReadStream* pStream, FX_BOOL bXDP) { std::unique_ptr<CXFA_DataImporter> importer( new CXFA_DataImporter(m_pDocumentParser->GetDocument())); return importer->ImportData(pStream); diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp index 0e84ad6be5..c0c559aaf5 100644 --- a/xfa/fxfa/app/xfa_ffwidget.cpp +++ b/xfa/fxfa/app/xfa_ffwidget.cpp @@ -1056,7 +1056,7 @@ CFX_DIBitmap* XFA_LoadImageData(CXFA_FFDoc* pDoc, FXCODEC_IMAGE_TYPE type = XFA_GetImageType(wsContentType); CFX_ByteString bsContent; uint8_t* pImageBuffer = nullptr; - IFX_FileRead* pImageFileRead = nullptr; + IFX_SeekableReadStream* pImageFileRead = nullptr; if (wsImage.GetLength() > 0) { XFA_ATTRIBUTEENUM iEncoding = (XFA_ATTRIBUTEENUM)pImage->GetTransferEncoding(); @@ -1117,7 +1117,7 @@ static FXDIB_Format XFA_GetDIBFormat(FXCODEC_IMAGE_TYPE type, } return dibFormat; } -CFX_DIBitmap* XFA_LoadImageFromBuffer(IFX_FileRead* pImageFileRead, +CFX_DIBitmap* XFA_LoadImageFromBuffer(IFX_SeekableReadStream* pImageFileRead, FXCODEC_IMAGE_TYPE type, int32_t& iImageXDpi, int32_t& iImageYDpi) { diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp index 59bbc89717..b5ba3f7fd9 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp @@ -4920,7 +4920,7 @@ void CXFA_FM2JSContext::Get(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); CFX_ByteString urlString; ValueToUTF8String(argOne.get(), urlString); - IFX_FileRead* pFile = pAppProvider->DownloadURL( + IFX_SeekableReadStream* pFile = pAppProvider->DownloadURL( CFX_WideString::FromUTF8(urlString.AsStringC())); if (!pFile) return; diff --git a/xfa/fxfa/fxfa.h b/xfa/fxfa/fxfa.h index a86fb63c4d..8abee52c36 100644 --- a/xfa/fxfa/fxfa.h +++ b/xfa/fxfa/fxfa.h @@ -230,7 +230,7 @@ class IXFA_AppProvider { * @param[in] wsURL - http, ftp, such as * "http://www.w3.org/TR/REC-xml-names/". */ - virtual IFX_FileRead* DownloadURL(const CFX_WideString& wsURL) = 0; + virtual IFX_SeekableReadStream* DownloadURL(const CFX_WideString& wsURL) = 0; /** * POST data to the given url. @@ -320,8 +320,9 @@ class IXFA_DocEnvironment { virtual FX_BOOL SetGlobalProperty(CXFA_FFDoc* hDoc, const CFX_ByteStringC& szPropName, CFXJSE_Value* pValue) = 0; - virtual IFX_FileRead* OpenLinkedFile(CXFA_FFDoc* hDoc, - const CFX_WideString& wsLink) = 0; + virtual IFX_SeekableReadStream* OpenLinkedFile( + CXFA_FFDoc* hDoc, + const CFX_WideString& wsLink) = 0; }; class IXFA_WidgetIterator { diff --git a/xfa/fxfa/parser/cxfa_dataexporter.cpp b/xfa/fxfa/parser/cxfa_dataexporter.cpp index 8f47b5324d..de2d08bbc2 100644 --- a/xfa/fxfa/parser/cxfa_dataexporter.cpp +++ b/xfa/fxfa/parser/cxfa_dataexporter.cpp @@ -199,9 +199,9 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode, IFX_MemoryStream* pMemStream = FX_CreateMemoryStream(TRUE); IFX_Stream* pTempStream = IFX_Stream::CreateStream( - (IFX_FileWrite*)pMemStream, FX_STREAMACCESS_Text | - FX_STREAMACCESS_Write | - FX_STREAMACCESS_Append); + (IFX_SeekableWriteStream*)pMemStream, FX_STREAMACCESS_Text | + FX_STREAMACCESS_Write | + FX_STREAMACCESS_Append); pTempStream->SetCodePage(FX_CODEPAGE_UTF8); pRichTextXML->SaveXMLNode(pTempStream); wsChildren += CFX_WideString::FromUTF8( @@ -444,11 +444,11 @@ CXFA_DataExporter::CXFA_DataExporter(CXFA_Document* pDocument) ASSERT(m_pDocument); } -FX_BOOL CXFA_DataExporter::Export(IFX_FileWrite* pWrite) { +FX_BOOL CXFA_DataExporter::Export(IFX_SeekableWriteStream* pWrite) { return Export(pWrite, m_pDocument->GetRoot(), 0, nullptr); } -FX_BOOL CXFA_DataExporter::Export(IFX_FileWrite* pWrite, +FX_BOOL CXFA_DataExporter::Export(IFX_SeekableWriteStream* pWrite, CXFA_Node* pNode, uint32_t dwFlag, const FX_CHAR* pChecksum) { diff --git a/xfa/fxfa/parser/cxfa_dataexporter.h b/xfa/fxfa/parser/cxfa_dataexporter.h index 868c20e294..c1123d1fe9 100644 --- a/xfa/fxfa/parser/cxfa_dataexporter.h +++ b/xfa/fxfa/parser/cxfa_dataexporter.h @@ -11,15 +11,15 @@ class CXFA_Document; class CXFA_Node; -class IFX_FileWrite; +class IFX_SeekableWriteStream; class IFX_Stream; class CXFA_DataExporter { public: explicit CXFA_DataExporter(CXFA_Document* pDocument); - FX_BOOL Export(IFX_FileWrite* pWrite); - FX_BOOL Export(IFX_FileWrite* pWrite, + FX_BOOL Export(IFX_SeekableWriteStream* pWrite); + FX_BOOL Export(IFX_SeekableWriteStream* pWrite, CXFA_Node* pNode, uint32_t dwFlag, const FX_CHAR* pChecksum); diff --git a/xfa/fxfa/parser/cxfa_dataimporter.cpp b/xfa/fxfa/parser/cxfa_dataimporter.cpp index 92559a1239..62c6536393 100644 --- a/xfa/fxfa/parser/cxfa_dataimporter.cpp +++ b/xfa/fxfa/parser/cxfa_dataimporter.cpp @@ -21,7 +21,7 @@ CXFA_DataImporter::CXFA_DataImporter(CXFA_Document* pDocument) ASSERT(m_pDocument); } -FX_BOOL CXFA_DataImporter::ImportData(IFX_FileRead* pDataDocument) { +FX_BOOL CXFA_DataImporter::ImportData(IFX_SeekableReadStream* pDataDocument) { std::unique_ptr<CXFA_SimpleParser> pDataDocumentParser( new CXFA_SimpleParser(m_pDocument, false)); if (pDataDocumentParser->StartParse(pDataDocument, XFA_XDPPACKET_Datasets) != diff --git a/xfa/fxfa/parser/cxfa_dataimporter.h b/xfa/fxfa/parser/cxfa_dataimporter.h index 519fef4410..d01f24cb05 100644 --- a/xfa/fxfa/parser/cxfa_dataimporter.h +++ b/xfa/fxfa/parser/cxfa_dataimporter.h @@ -10,13 +10,13 @@ #include "core/fxcrt/fx_system.h" class CXFA_Document; -class IFX_FileRead; +class IFX_SeekableReadStream; class CXFA_DataImporter { public: explicit CXFA_DataImporter(CXFA_Document* pDocument); - FX_BOOL ImportData(IFX_FileRead* pDataDocument); + FX_BOOL ImportData(IFX_SeekableReadStream* pDataDocument); protected: CXFA_Document* const m_pDocument; diff --git a/xfa/fxfa/parser/cxfa_document_parser.cpp b/xfa/fxfa/parser/cxfa_document_parser.cpp index 459edfa5ec..ea38b3eec9 100644 --- a/xfa/fxfa/parser/cxfa_document_parser.cpp +++ b/xfa/fxfa/parser/cxfa_document_parser.cpp @@ -15,7 +15,7 @@ CXFA_DocumentParser::CXFA_DocumentParser(CXFA_FFNotify* pNotify) CXFA_DocumentParser::~CXFA_DocumentParser() { } -int32_t CXFA_DocumentParser::StartParse(IFX_FileRead* pStream, +int32_t CXFA_DocumentParser::StartParse(IFX_SeekableReadStream* pStream, XFA_XDPPACKET ePacketID) { m_pDocument.reset(); m_nodeParser.CloseParser(); diff --git a/xfa/fxfa/parser/cxfa_document_parser.h b/xfa/fxfa/parser/cxfa_document_parser.h index 3e72f9b258..29aeca39bc 100644 --- a/xfa/fxfa/parser/cxfa_document_parser.h +++ b/xfa/fxfa/parser/cxfa_document_parser.h @@ -15,7 +15,7 @@ class CFDE_XMLDoc; class CXFA_Document; class CXFA_FFNotify; class CXFA_Notify; -class IFX_FileRead; +class IFX_SeekableReadStream; class IFX_Pause; class CXFA_DocumentParser { @@ -23,7 +23,7 @@ class CXFA_DocumentParser { explicit CXFA_DocumentParser(CXFA_FFNotify* pNotify); ~CXFA_DocumentParser(); - int32_t StartParse(IFX_FileRead* pStream, XFA_XDPPACKET ePacketID); + int32_t StartParse(IFX_SeekableReadStream* pStream, XFA_XDPPACKET ePacketID); int32_t DoParse(IFX_Pause* pPause); CFDE_XMLDoc* GetXMLDoc() const; diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index bf5b6bf964..9c209b23b7 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -1444,7 +1444,7 @@ void CXFA_Node::Script_NodeClass_SaveXML(CFXJSE_Arguments* pArguments) { pMemoryStream(FX_CreateMemoryStream(TRUE)); std::unique_ptr<IFX_Stream, ReleaseDeleter<IFX_Stream>> pStream( IFX_Stream::CreateStream( - static_cast<IFX_FileWrite*>(pMemoryStream.get()), + static_cast<IFX_SeekableWriteStream*>(pMemoryStream.get()), FX_STREAMACCESS_Text | FX_STREAMACCESS_Write | FX_STREAMACCESS_Append)); if (!pStream) { diff --git a/xfa/fxfa/parser/cxfa_simple_parser.cpp b/xfa/fxfa/parser/cxfa_simple_parser.cpp index b8d9fcb318..f40060bca2 100644 --- a/xfa/fxfa/parser/cxfa_simple_parser.cpp +++ b/xfa/fxfa/parser/cxfa_simple_parser.cpp @@ -277,7 +277,7 @@ void CXFA_SimpleParser::SetFactory(CXFA_Document* pFactory) { m_pFactory = pFactory; } -int32_t CXFA_SimpleParser::StartParse(IFX_FileRead* pStream, +int32_t CXFA_SimpleParser::StartParse(IFX_SeekableReadStream* pStream, XFA_XDPPACKET ePacketID) { CloseParser(); m_pFileRead = pStream; diff --git a/xfa/fxfa/parser/cxfa_simple_parser.h b/xfa/fxfa/parser/cxfa_simple_parser.h index f4d0095c1c..2b1e192e92 100644 --- a/xfa/fxfa/parser/cxfa_simple_parser.h +++ b/xfa/fxfa/parser/cxfa_simple_parser.h @@ -15,7 +15,7 @@ class CXFA_Document; class CXFA_Node; class CXFA_XMLParser; -class IFX_FileRead; +class IFX_SeekableReadStream; class IFX_Pause; class IFX_Stream; @@ -24,7 +24,7 @@ class CXFA_SimpleParser { CXFA_SimpleParser(CXFA_Document* pFactory, bool bDocumentParser); ~CXFA_SimpleParser(); - int32_t StartParse(IFX_FileRead* pStream, XFA_XDPPACKET ePacketID); + int32_t StartParse(IFX_SeekableReadStream* pStream, XFA_XDPPACKET ePacketID); int32_t DoParse(IFX_Pause* pPause); int32_t ParseXMLData(const CFX_WideString& wsXML, CFDE_XMLNode*& pXMLNode, @@ -78,7 +78,7 @@ class CXFA_SimpleParser { CXFA_XMLParser* m_pXMLParser; std::unique_ptr<CFDE_XMLDoc> m_pXMLDoc; std::unique_ptr<IFX_Stream, ReleaseDeleter<IFX_Stream>> m_pStream; - IFX_FileRead* m_pFileRead; + IFX_SeekableReadStream* m_pFileRead; CXFA_Document* m_pFactory; CXFA_Node* m_pRootNode; XFA_XDPPACKET m_ePacketID; diff --git a/xfa/fxfa/xfa_checksum.h b/xfa/fxfa/xfa_checksum.h index 69adc0a023..60312772a9 100644 --- a/xfa/fxfa/xfa_checksum.h +++ b/xfa/fxfa/xfa_checksum.h @@ -62,7 +62,7 @@ class CXFA_ChecksumContext { void StartChecksum(); void Update(const CFX_ByteStringC& bsText); - FX_BOOL UpdateChecksum(IFX_FileRead* pSrcFile, + FX_BOOL UpdateChecksum(IFX_SeekableReadStream* pSrcFile, FX_FILESIZE offset = 0, size_t size = 0); void FinishChecksum(); diff --git a/xfa/fxfa/xfa_ffapp.h b/xfa/fxfa/xfa_ffapp.h index dd670b83d7..5e8289538b 100644 --- a/xfa/fxfa/xfa_ffapp.h +++ b/xfa/fxfa/xfa_ffapp.h @@ -24,12 +24,12 @@ class CXFA_FFDocHandler; class CXFA_FontMgr; class IFWL_AdapterTimerMgr; -class CXFA_FileRead : public IFX_FileRead { +class CXFA_FileRead : public IFX_SeekableReadStream { public: explicit CXFA_FileRead(const std::vector<CPDF_Stream*>& streams); ~CXFA_FileRead() override; - // IFX_FileRead + // IFX_SeekableReadStream FX_FILESIZE GetSize() override; FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override; void Release() override; @@ -44,7 +44,7 @@ class CXFA_FFApp { ~CXFA_FFApp(); CXFA_FFDoc* CreateDoc(IXFA_DocEnvironment* pDocEnvironment, - IFX_FileRead* pStream, + IFX_SeekableReadStream* pStream, FX_BOOL bTakeOverFile); CXFA_FFDoc* CreateDoc(IXFA_DocEnvironment* pDocEnvironment, CPDF_Document* pPDFDoc); diff --git a/xfa/fxfa/xfa_ffdoc.h b/xfa/fxfa/xfa_ffdoc.h index 26b56faa82..f1ecd909e3 100644 --- a/xfa/fxfa/xfa_ffdoc.h +++ b/xfa/fxfa/xfa_ffdoc.h @@ -35,7 +35,7 @@ class CXFA_FFDoc { int32_t DoLoad(IFX_Pause* pPause = nullptr); void StopLoad(); CXFA_FFDocView* CreateDocView(uint32_t dwView = 0); - FX_BOOL OpenDoc(IFX_FileRead* pStream, FX_BOOL bTakeOverFile); + FX_BOOL OpenDoc(IFX_SeekableReadStream* pStream, FX_BOOL bTakeOverFile); FX_BOOL OpenDoc(CPDF_Document* pPDFDoc); FX_BOOL CloseDoc(); void SetDocType(uint32_t dwType); @@ -49,14 +49,14 @@ class CXFA_FFDoc { int32_t& iImageYDpi); bool SavePackage(XFA_HashCode code, - IFX_FileWrite* pFile, + IFX_SeekableWriteStream* pFile, CXFA_ChecksumContext* pCSContext); - FX_BOOL ImportData(IFX_FileRead* pStream, FX_BOOL bXDP = TRUE); + FX_BOOL ImportData(IFX_SeekableReadStream* pStream, FX_BOOL bXDP = TRUE); protected: IXFA_DocEnvironment* const m_pDocEnvironment; std::unique_ptr<CXFA_DocumentParser> m_pDocumentParser; - IFX_FileRead* m_pStream; + IFX_SeekableReadStream* m_pStream; CXFA_FFApp* m_pApp; std::unique_ptr<CXFA_FFNotify> m_pNotify; CPDF_Document* m_pPDFDoc; diff --git a/xfa/fxfa/xfa_ffwidget.h b/xfa/fxfa/xfa_ffwidget.h index fe7c136a17..1a09ad1fbd 100644 --- a/xfa/fxfa/xfa_ffwidget.h +++ b/xfa/fxfa/xfa_ffwidget.h @@ -164,7 +164,7 @@ CFX_DIBitmap* XFA_LoadImageData(CXFA_FFDoc* pDoc, FX_BOOL& bNameImage, int32_t& iImageXDpi, int32_t& iImageYDpi); -CFX_DIBitmap* XFA_LoadImageFromBuffer(IFX_FileRead* pImageFileRead, +CFX_DIBitmap* XFA_LoadImageFromBuffer(IFX_SeekableReadStream* pImageFileRead, FXCODEC_IMAGE_TYPE type, int32_t& iImageXDpi, int32_t& iImageYDpi); |