diff options
Diffstat (limited to 'xfa')
26 files changed, 100 insertions, 87 deletions
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); |