summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfapi/parser/cfdf_document.cpp4
-rw-r--r--core/fpdfapi/parser/cpdf_data_avail.cpp9
-rw-r--r--core/fpdfapi/parser/cpdf_parser.cpp4
-rw-r--r--core/fpdfapi/parser/cpdf_parser_unittest.cpp3
-rw-r--r--core/fpdfapi/parser/cpdf_syntax_parser_unittest.cpp26
-rw-r--r--core/fxcrt/fx_extension.cpp36
-rw-r--r--core/fxcrt/fx_stream.h25
-rw-r--r--fpdfsdk/fpdfsave.cpp6
-rw-r--r--fpdfsdk/fpdfview.cpp10
-rw-r--r--testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc2
-rw-r--r--xfa/fgas/crt/fgas_stream.cpp6
-rw-r--r--xfa/fgas/crt/fgas_stream.h5
-rw-r--r--xfa/fgas/font/cfgas_fontmgr.cpp2
-rw-r--r--xfa/fgas/font/cfgas_gefont.cpp2
-rw-r--r--xfa/fxfa/app/xfa_ffdoc.cpp4
-rw-r--r--xfa/fxfa/app/xfa_ffwidget.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_dataexporter.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp2
18 files changed, 79 insertions, 73 deletions
diff --git a/core/fpdfapi/parser/cfdf_document.cpp b/core/fpdfapi/parser/cfdf_document.cpp
index 41e285245d..a6045e7795 100644
--- a/core/fpdfapi/parser/cfdf_document.cpp
+++ b/core/fpdfapi/parser/cfdf_document.cpp
@@ -45,8 +45,8 @@ std::unique_ptr<CFDF_Document> CFDF_Document::ParseFile(
std::unique_ptr<CFDF_Document> CFDF_Document::ParseMemory(const uint8_t* pData,
uint32_t size) {
- return CFDF_Document::ParseFile(FX_CreateMemoryStream((uint8_t*)pData, size),
- true);
+ return CFDF_Document::ParseFile(
+ IFX_MemoryStream::Create((uint8_t*)pData, size), true);
}
void CFDF_Document::ParseStream(IFX_SeekableReadStream* pFile, bool bOwnFile) {
diff --git a/core/fpdfapi/parser/cpdf_data_avail.cpp b/core/fpdfapi/parser/cpdf_data_avail.cpp
index 1ac6e06a97..248748470c 100644
--- a/core/fpdfapi/parser/cpdf_data_avail.cpp
+++ b/core/fpdfapi/parser/cpdf_data_avail.cpp
@@ -718,7 +718,7 @@ bool CPDF_DataAvail::IsLinearizedFile(uint8_t* pData, uint32_t dwLen) {
if (m_pLinearized)
return true;
- ScopedFileStream file(FX_CreateMemoryStream(pData, (size_t)dwLen, false));
+ ScopedFileStream file(IFX_MemoryStream::Create(pData, (size_t)dwLen, false));
int32_t offset = GetHeaderOffset(file.get());
if (offset == -1) {
m_docStatus = PDF_DATAAVAIL_ERROR;
@@ -753,7 +753,8 @@ bool CPDF_DataAvail::CheckEnd(DownloadHints* pHints) {
uint8_t buffer[1024];
m_pFileRead->ReadBlock(buffer, req_pos, dwSize);
- ScopedFileStream file(FX_CreateMemoryStream(buffer, (size_t)dwSize, false));
+ ScopedFileStream file(
+ IFX_MemoryStream::Create(buffer, (size_t)dwSize, false));
m_syntaxParser.InitParser(file.get(), 0);
m_syntaxParser.RestorePos(dwSize - 1);
@@ -800,7 +801,7 @@ int32_t CPDF_DataAvail::CheckCrossRefStream(DownloadHints* pHints,
m_pFileRead->ReadBlock(pBuf, m_dwCurrentXRefSteam, iSize);
- ScopedFileStream file(FX_CreateMemoryStream(pBuf, (size_t)iSize, false));
+ ScopedFileStream file(IFX_MemoryStream::Create(pBuf, (size_t)iSize, false));
m_parser.m_pSyntax->InitParser(file.get(), 0);
bool bNumber;
@@ -1046,7 +1047,7 @@ bool CPDF_DataAvail::CheckTrailer(DownloadHints* pHints) {
if (!m_pFileRead->ReadBlock(pBuf, m_dwTrailerOffset, iSize))
return false;
- ScopedFileStream file(FX_CreateMemoryStream(pBuf, (size_t)iSize, false));
+ ScopedFileStream file(IFX_MemoryStream::Create(pBuf, (size_t)iSize, false));
m_syntaxParser.InitParser(file.get(), 0);
std::unique_ptr<CPDF_Object> pTrailer(
diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp
index 2f432ed9f9..1fae0d641c 100644
--- a/core/fpdfapi/parser/cpdf_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_parser.cpp
@@ -1124,7 +1124,7 @@ std::unique_ptr<CPDF_Object> CPDF_Parser::ParseIndirectObject(
if (!pObjStream)
return nullptr;
- ScopedFileStream file(FX_CreateMemoryStream(
+ ScopedFileStream file(IFX_MemoryStream::Create(
(uint8_t*)pObjStream->GetData(), (size_t)pObjStream->GetSize(), false));
CPDF_SyntaxParser syntax;
syntax.InitParser(file.get(), 0);
@@ -1204,7 +1204,7 @@ void CPDF_Parser::GetIndirectBinary(uint32_t objnum,
const uint8_t* pData = pObjStream->GetData();
uint32_t totalsize = pObjStream->GetSize();
ScopedFileStream file(
- FX_CreateMemoryStream((uint8_t*)pData, (size_t)totalsize, false));
+ IFX_MemoryStream::Create((uint8_t*)pData, (size_t)totalsize, false));
CPDF_SyntaxParser syntax;
syntax.InitParser(file.get(), 0);
diff --git a/core/fpdfapi/parser/cpdf_parser_unittest.cpp b/core/fpdfapi/parser/cpdf_parser_unittest.cpp
index 7148c54f30..0a70103d3a 100644
--- a/core/fpdfapi/parser/cpdf_parser_unittest.cpp
+++ b/core/fpdfapi/parser/cpdf_parser_unittest.cpp
@@ -45,7 +45,8 @@ class CPDF_TestParser : public CPDF_Parser {
// Setup reading from a file and initial states.
bool InitTestFromFile(const FX_CHAR* path) {
- IFX_SeekableReadStream* pFileAccess = FX_CreateFileRead(path);
+ IFX_SeekableReadStream* pFileAccess =
+ IFX_SeekableReadStream::CreateFromFilename(path);
if (!pFileAccess)
return false;
diff --git a/core/fpdfapi/parser/cpdf_syntax_parser_unittest.cpp b/core/fpdfapi/parser/cpdf_syntax_parser_unittest.cpp
index a23c0ed64e..f94b431c82 100644
--- a/core/fpdfapi/parser/cpdf_syntax_parser_unittest.cpp
+++ b/core/fpdfapi/parser/cpdf_syntax_parser_unittest.cpp
@@ -16,7 +16,7 @@ TEST(cpdf_syntax_parser, ReadHexString) {
{
// Empty string.
uint8_t data[] = "";
- ScopedFileStream stream(FX_CreateMemoryStream(data, 0, false));
+ ScopedFileStream stream(IFX_MemoryStream::Create(data, 0, false));
CPDF_SyntaxParser parser;
parser.InitParser(stream.get(), 0);
@@ -27,7 +27,7 @@ TEST(cpdf_syntax_parser, ReadHexString) {
{
// Blank string.
uint8_t data[] = " ";
- ScopedFileStream stream(FX_CreateMemoryStream(data, 2, false));
+ ScopedFileStream stream(IFX_MemoryStream::Create(data, 2, false));
CPDF_SyntaxParser parser;
parser.InitParser(stream.get(), 0);
@@ -38,7 +38,7 @@ TEST(cpdf_syntax_parser, ReadHexString) {
{
// Skips unknown characters.
uint8_t data[] = "z12b";
- ScopedFileStream stream(FX_CreateMemoryStream(data, 4, false));
+ ScopedFileStream stream(IFX_MemoryStream::Create(data, 4, false));
CPDF_SyntaxParser parser;
parser.InitParser(stream.get(), 0);
@@ -49,7 +49,7 @@ TEST(cpdf_syntax_parser, ReadHexString) {
{
// Skips unknown characters.
uint8_t data[] = "*<&*#$^&@1";
- ScopedFileStream stream(FX_CreateMemoryStream(data, 10, false));
+ ScopedFileStream stream(IFX_MemoryStream::Create(data, 10, false));
CPDF_SyntaxParser parser;
parser.InitParser(stream.get(), 0);
@@ -60,7 +60,7 @@ TEST(cpdf_syntax_parser, ReadHexString) {
{
// Skips unknown characters.
uint8_t data[] = "\x80zab";
- ScopedFileStream stream(FX_CreateMemoryStream(data, 4, false));
+ ScopedFileStream stream(IFX_MemoryStream::Create(data, 4, false));
CPDF_SyntaxParser parser;
parser.InitParser(stream.get(), 0);
@@ -71,7 +71,7 @@ TEST(cpdf_syntax_parser, ReadHexString) {
{
// Skips unknown characters.
uint8_t data[] = "\xffzab";
- ScopedFileStream stream(FX_CreateMemoryStream(data, 4, false));
+ ScopedFileStream stream(IFX_MemoryStream::Create(data, 4, false));
CPDF_SyntaxParser parser;
parser.InitParser(stream.get(), 0);
@@ -82,7 +82,7 @@ TEST(cpdf_syntax_parser, ReadHexString) {
{
// Regular conversion.
uint8_t data[] = "1A2b>abcd";
- ScopedFileStream stream(FX_CreateMemoryStream(data, 9, false));
+ ScopedFileStream stream(IFX_MemoryStream::Create(data, 9, false));
CPDF_SyntaxParser parser;
parser.InitParser(stream.get(), 0);
@@ -93,7 +93,7 @@ TEST(cpdf_syntax_parser, ReadHexString) {
{
// Position out of bounds.
uint8_t data[] = "12ab>";
- ScopedFileStream stream(FX_CreateMemoryStream(data, 5, false));
+ ScopedFileStream stream(IFX_MemoryStream::Create(data, 5, false));
CPDF_SyntaxParser parser;
parser.InitParser(stream.get(), 0);
@@ -117,7 +117,7 @@ TEST(cpdf_syntax_parser, ReadHexString) {
{
// Missing ending >.
uint8_t data[] = "1A2b";
- ScopedFileStream stream(FX_CreateMemoryStream(data, 4, false));
+ ScopedFileStream stream(IFX_MemoryStream::Create(data, 4, false));
CPDF_SyntaxParser parser;
parser.InitParser(stream.get(), 0);
@@ -128,7 +128,7 @@ TEST(cpdf_syntax_parser, ReadHexString) {
{
// Missing ending >.
uint8_t data[] = "12abz";
- ScopedFileStream stream(FX_CreateMemoryStream(data, 5, false));
+ ScopedFileStream stream(IFX_MemoryStream::Create(data, 5, false));
CPDF_SyntaxParser parser;
parser.InitParser(stream.get(), 0);
@@ -139,7 +139,7 @@ TEST(cpdf_syntax_parser, ReadHexString) {
{
// Uneven number of bytes.
uint8_t data[] = "1A2>asdf";
- ScopedFileStream stream(FX_CreateMemoryStream(data, 8, false));
+ ScopedFileStream stream(IFX_MemoryStream::Create(data, 8, false));
CPDF_SyntaxParser parser;
parser.InitParser(stream.get(), 0);
@@ -150,7 +150,7 @@ TEST(cpdf_syntax_parser, ReadHexString) {
{
// Uneven number of bytes.
uint8_t data[] = "1A2zasdf";
- ScopedFileStream stream(FX_CreateMemoryStream(data, 8, false));
+ ScopedFileStream stream(IFX_MemoryStream::Create(data, 8, false));
CPDF_SyntaxParser parser;
parser.InitParser(stream.get(), 0);
@@ -161,7 +161,7 @@ TEST(cpdf_syntax_parser, ReadHexString) {
{
// Just ending character.
uint8_t data[] = ">";
- ScopedFileStream stream(FX_CreateMemoryStream(data, 1, false));
+ ScopedFileStream stream(IFX_MemoryStream::Create(data, 1, false));
CPDF_SyntaxParser parser;
parser.InitParser(stream.get(), 0);
diff --git a/core/fxcrt/fx_extension.cpp b/core/fxcrt/fx_extension.cpp
index 39bf028205..6bf61f1fb5 100644
--- a/core/fxcrt/fx_extension.cpp
+++ b/core/fxcrt/fx_extension.cpp
@@ -40,7 +40,7 @@ void CFX_CRTFileAccess::GetPath(CFX_WideString& wsPath) {
}
IFX_SeekableStream* CFX_CRTFileAccess::CreateFileStream(uint32_t dwModes) {
- return FX_CreateFileStream(m_path.c_str(), dwModes);
+ return IFX_SeekableStream::CreateFromFilename(m_path.c_str(), dwModes);
}
bool CFX_CRTFileAccess::Init(const CFX_WideStringC& wsPath) {
@@ -338,33 +338,41 @@ IFX_FileAccess* FX_CreateDefaultFileAccess(const CFX_WideStringC& wsPath) {
}
#endif // PDF_ENABLE_XFA
-IFX_SeekableStream* FX_CreateFileStream(const FX_CHAR* filename,
- uint32_t dwModes) {
+// static
+IFX_SeekableStream* IFX_SeekableStream::CreateFromFilename(
+ 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_SeekableStream* FX_CreateFileStream(const FX_WCHAR* filename,
- uint32_t dwModes) {
+// static
+IFX_SeekableStream* IFX_SeekableStream::CreateFromFilename(
+ 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_SeekableReadStream* FX_CreateFileRead(const FX_CHAR* filename) {
- return FX_CreateFileStream(filename, FX_FILEMODE_ReadOnly);
-}
-IFX_SeekableReadStream* FX_CreateFileRead(const FX_WCHAR* filename) {
- return FX_CreateFileStream(filename, FX_FILEMODE_ReadOnly);
+
+// static
+IFX_SeekableReadStream* IFX_SeekableReadStream::CreateFromFilename(
+ const FX_CHAR* filename) {
+ return IFX_SeekableStream::CreateFromFilename(filename, FX_FILEMODE_ReadOnly);
}
-IFX_MemoryStream* FX_CreateMemoryStream(uint8_t* pBuffer,
- size_t dwSize,
- bool bTakeOver) {
+
+// static
+IFX_MemoryStream* IFX_MemoryStream::Create(uint8_t* pBuffer,
+ size_t dwSize,
+ bool bTakeOver) {
return new CFX_MemoryStream(pBuffer, dwSize, bTakeOver);
}
-IFX_MemoryStream* FX_CreateMemoryStream(bool bConsecutive) {
+
+// static
+IFX_MemoryStream* IFX_MemoryStream::Create(bool bConsecutive) {
return new CFX_MemoryStream(bConsecutive);
}
diff --git a/core/fxcrt/fx_stream.h b/core/fxcrt/fx_stream.h
index dc687cf653..fe92c939d9 100644
--- a/core/fxcrt/fx_stream.h
+++ b/core/fxcrt/fx_stream.h
@@ -85,6 +85,8 @@ class IFX_SeekableWriteStream : public IFX_WriteStream {
class IFX_SeekableReadStream : public IFX_ReadStream {
public:
+ static IFX_SeekableReadStream* CreateFromFilename(const FX_CHAR* filename);
+
// IFX_ReadStream:
void Release() override = 0;
bool IsEOF() override;
@@ -95,12 +97,14 @@ class IFX_SeekableReadStream : public IFX_ReadStream {
virtual FX_FILESIZE GetSize() = 0;
};
-IFX_SeekableReadStream* FX_CreateFileRead(const FX_CHAR* filename);
-IFX_SeekableReadStream* FX_CreateFileRead(const FX_WCHAR* filename);
-
class IFX_SeekableStream : public IFX_SeekableReadStream,
public IFX_SeekableWriteStream {
public:
+ static IFX_SeekableStream* CreateFromFilename(const FX_CHAR* filename,
+ uint32_t dwModes);
+ static IFX_SeekableStream* CreateFromFilename(const FX_WCHAR* filename,
+ uint32_t dwModes);
+
virtual IFX_SeekableStream* Retain() = 0;
// IFX_SeekableReadStream:
@@ -119,11 +123,6 @@ class IFX_SeekableStream : public IFX_SeekableReadStream,
bool Flush() override = 0;
};
-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 {
public:
@@ -138,6 +137,11 @@ IFX_FileAccess* FX_CreateDefaultFileAccess(const CFX_WideStringC& wsPath);
class IFX_MemoryStream : public IFX_SeekableStream {
public:
+ static IFX_MemoryStream* Create(uint8_t* pBuffer,
+ size_t nSize,
+ bool bTakeOver = false);
+ static IFX_MemoryStream* Create(bool bConsecutive = false);
+
virtual bool IsConsecutive() const = 0;
virtual void EstimateSize(size_t nInitSize, size_t nGrowSize) = 0;
virtual uint8_t* GetBuffer() const = 0;
@@ -147,11 +151,6 @@ class IFX_MemoryStream : public IFX_SeekableStream {
virtual void DetachBuffer() = 0;
};
-IFX_MemoryStream* FX_CreateMemoryStream(uint8_t* pBuffer,
- size_t nSize,
- bool bTakeOver = false);
-IFX_MemoryStream* FX_CreateMemoryStream(bool bConsecutive = false);
-
class IFX_BufferRead : public IFX_ReadStream {
public:
// IFX_ReadStream:
diff --git a/fpdfsdk/fpdfsave.cpp b/fpdfsdk/fpdfsave.cpp
index cb01ab697b..c65ff88f3d 100644
--- a/fpdfsdk/fpdfsave.cpp
+++ b/fpdfsdk/fpdfsave.cpp
@@ -136,7 +136,7 @@ bool SaveXFADocumentData(CPDFXFA_Context* pContext,
streamAcc.LoadAllData(pTemplateStream);
uint8_t* pData = (uint8_t*)streamAcc.GetData();
uint32_t dwSize2 = streamAcc.GetSize();
- ScopedFileStream pTemplate(FX_CreateMemoryStream(pData, dwSize2));
+ ScopedFileStream pTemplate(IFX_MemoryStream::Create(pData, dwSize2));
pChecksum->UpdateChecksum(pTemplate.get());
}
CPDF_Stream* pFormStream = nullptr;
@@ -169,7 +169,7 @@ bool SaveXFADocumentData(CPDFXFA_Context* pContext,
}
// L"datasets"
{
- ScopedFileStream pDsfileWrite(FX_CreateMemoryStream());
+ ScopedFileStream pDsfileWrite(IFX_MemoryStream::Create());
if (pXFADocView->GetDoc()->SavePackage(XFA_HASHCODE_Datasets,
pDsfileWrite.get(), nullptr) &&
pDsfileWrite->GetSize() > 0) {
@@ -196,7 +196,7 @@ bool SaveXFADocumentData(CPDFXFA_Context* pContext,
}
// L"form"
{
- ScopedFileStream pfileWrite(FX_CreateMemoryStream());
+ ScopedFileStream pfileWrite(IFX_MemoryStream::Create());
if (pXFADocView->GetDoc()->SavePackage(XFA_HASHCODE_Form, pfileWrite.get(),
pChecksum.get()) &&
pfileWrite->GetSize() > 0) {
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp
index c7cc1242fe..1c27b6c69b 100644
--- a/fpdfsdk/fpdfview.cpp
+++ b/fpdfsdk/fpdfview.cpp
@@ -393,16 +393,14 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path,
// NOTE: the creation of the file needs to be by the embedder on the
// other side of this API.
IFX_SeekableReadStream* pFileAccess =
- FX_CreateFileRead((const FX_CHAR*)file_path);
- if (!pFileAccess) {
+ IFX_SeekableReadStream::CreateFromFilename((const FX_CHAR*)file_path);
+ if (!pFileAccess)
return nullptr;
- }
- std::unique_ptr<CPDF_Parser> pParser(new CPDF_Parser);
+ auto pParser = pdfium::MakeUnique<CPDF_Parser>();
pParser->SetPassword(password);
- std::unique_ptr<CPDF_Document> pDocument(
- new CPDF_Document(std::move(pParser)));
+ auto pDocument = pdfium::MakeUnique<CPDF_Document>(std::move(pParser));
CPDF_Parser::Error error =
pDocument->GetParser()->StartParse(pFileAccess, pDocument.get());
if (error != CPDF_Parser::SUCCESS) {
diff --git a/testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc b/testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc
index b32a182f23..923a732d06 100644
--- a/testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc
+++ b/testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc
@@ -18,7 +18,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
std::unique_ptr<IFX_SeekableReadStream,
ReleaseDeleter<IFX_SeekableReadStream>>
- fileRead(FX_CreateFileRead(stream.get(), false));
+ fileRead(stream->MakeSeekableReadStream());
if (!fileRead)
return 0;
diff --git a/xfa/fgas/crt/fgas_stream.cpp b/xfa/fgas/crt/fgas_stream.cpp
index c3850c00bb..73d3d0b661 100644
--- a/xfa/fgas/crt/fgas_stream.cpp
+++ b/xfa/fgas/crt/fgas_stream.cpp
@@ -1452,10 +1452,8 @@ IFX_Stream* CFX_Stream::CreateSharedStream(uint32_t dwAccess,
return pShared;
}
-IFX_SeekableReadStream* FX_CreateFileRead(IFX_Stream* pBaseStream,
- bool bReleaseStream) {
- ASSERT(pBaseStream);
- return new CFGAS_FileRead(pBaseStream, bReleaseStream);
+IFX_SeekableReadStream* IFX_Stream::MakeSeekableReadStream() {
+ return new CFGAS_FileRead(this, false);
}
CFGAS_FileRead::CFGAS_FileRead(IFX_Stream* pStream, bool bReleaseStream)
diff --git a/xfa/fgas/crt/fgas_stream.h b/xfa/fgas/crt/fgas_stream.h
index 674007e935..413927d22f 100644
--- a/xfa/fgas/crt/fgas_stream.h
+++ b/xfa/fgas/crt/fgas_stream.h
@@ -37,6 +37,7 @@ class IFX_Stream {
uint32_t dwAccess);
static IFX_Stream* CreateTextStream(IFX_Stream* pBaseStream,
bool bDeleteOnRelease);
+
virtual ~IFX_Stream() {}
virtual void Release() = 0;
virtual IFX_Stream* Retain() = 0;
@@ -61,9 +62,9 @@ class IFX_Stream {
virtual int32_t GetBOM(uint8_t bom[4]) const = 0;
virtual uint16_t GetCodePage() const = 0;
virtual uint16_t SetCodePage(uint16_t wCodePage) = 0;
+
+ IFX_SeekableReadStream* MakeSeekableReadStream();
};
-IFX_SeekableReadStream* FX_CreateFileRead(IFX_Stream* pBaseStream,
- bool bReleaseStream);
#endif // XFA_FGAS_CRT_FGAS_STREAM_H_
diff --git a/xfa/fgas/font/cfgas_fontmgr.cpp b/xfa/fgas/font/cfgas_fontmgr.cpp
index 9b95318bd0..219e67dbc6 100644
--- a/xfa/fgas/font/cfgas_fontmgr.cpp
+++ b/xfa/fgas/font/cfgas_fontmgr.cpp
@@ -909,7 +909,7 @@ IFX_SeekableReadStream* CFGAS_FontMgr::CreateFontStream(
uint8_t* pBuffer = FX_Alloc(uint8_t, dwFileSize + 1);
dwFileSize = pSystemFontInfo->GetFontData(hFont, 0, pBuffer, dwFileSize);
- return FX_CreateMemoryStream(pBuffer, dwFileSize, true);
+ return IFX_MemoryStream::Create(pBuffer, dwFileSize, true);
}
IFX_SeekableReadStream* CFGAS_FontMgr::CreateFontStream(
diff --git a/xfa/fgas/font/cfgas_gefont.cpp b/xfa/fgas/font/cfgas_gefont.cpp
index ffe791aab5..c1dfa2b5b9 100644
--- a/xfa/fgas/font/cfgas_gefont.cpp
+++ b/xfa/fgas/font/cfgas_gefont.cpp
@@ -209,7 +209,7 @@ bool CFGAS_GEFont::LoadFontInternal(IFX_Stream* pFontStream, bool bSaveStream) {
if (bSaveStream)
m_pStream.reset(pFontStream);
- m_pFileRead.reset(FX_CreateFileRead(pFontStream, false));
+ m_pFileRead.reset(pFontStream->MakeSeekableReadStream());
m_pFont = new CFX_Font;
if (m_pFont->LoadFile(m_pFileRead.get()))
return InitFont();
diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp
index 1b5665bb08..cf5b289613 100644
--- a/xfa/fxfa/app/xfa_ffdoc.cpp
+++ b/xfa/fxfa/app/xfa_ffdoc.cpp
@@ -417,8 +417,8 @@ CFX_DIBitmap* CXFA_FFDoc::GetPDFNamedImage(const CFX_WideStringC& wsName,
CPDF_StreamAcc streamAcc;
streamAcc.LoadAllData(pStream);
- IFX_SeekableReadStream* pImageFileRead =
- FX_CreateMemoryStream((uint8_t*)streamAcc.GetData(), streamAcc.GetSize());
+ IFX_SeekableReadStream* pImageFileRead = IFX_MemoryStream::Create(
+ (uint8_t*)streamAcc.GetData(), streamAcc.GetSize());
CFX_DIBitmap* pDibSource = XFA_LoadImageFromBuffer(
pImageFileRead, FXCODEC_IMAGE_UNKNOWN, iImageXDpi, iImageYDpi);
diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp
index e6c0c595b2..bc1854eb42 100644
--- a/xfa/fxfa/app/xfa_ffwidget.cpp
+++ b/xfa/fxfa/app/xfa_ffwidget.cpp
@@ -1066,11 +1066,11 @@ CFX_DIBitmap* XFA_LoadImageData(CXFA_FFDoc* pDoc,
pImageBuffer = FX_Alloc(uint8_t, iLength);
int32_t iRead = XFA_Base64Decode(bsData.c_str(), pImageBuffer);
if (iRead > 0) {
- pImageFileRead = FX_CreateMemoryStream(pImageBuffer, iRead);
+ pImageFileRead = IFX_MemoryStream::Create(pImageBuffer, iRead);
}
} else {
bsContent = CFX_ByteString::FromUnicode(wsImage);
- pImageFileRead = FX_CreateMemoryStream(
+ pImageFileRead = IFX_MemoryStream::Create(
const_cast<uint8_t*>(bsContent.raw_str()), bsContent.GetLength());
}
} else {
diff --git a/xfa/fxfa/parser/cxfa_dataexporter.cpp b/xfa/fxfa/parser/cxfa_dataexporter.cpp
index ad9693f98f..1ec9c44de6 100644
--- a/xfa/fxfa/parser/cxfa_dataexporter.cpp
+++ b/xfa/fxfa/parser/cxfa_dataexporter.cpp
@@ -197,7 +197,7 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode,
if (!pRichTextXML)
break;
- IFX_MemoryStream* pMemStream = FX_CreateMemoryStream(true);
+ IFX_MemoryStream* pMemStream = IFX_MemoryStream::Create(true);
IFX_Stream* pTempStream = IFX_Stream::CreateStream(
(IFX_SeekableWriteStream*)pMemStream, FX_STREAMACCESS_Text |
FX_STREAMACCESS_Write |
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 18ea41419a..05ddcfc71b 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -1442,7 +1442,7 @@ void CXFA_Node::Script_NodeClass_SaveXML(CFXJSE_Arguments* pArguments) {
XFA_DataExporter_DealWithDataGroupNode(this);
}
std::unique_ptr<IFX_MemoryStream, ReleaseDeleter<IFX_MemoryStream>>
- pMemoryStream(FX_CreateMemoryStream(true));
+ pMemoryStream(IFX_MemoryStream::Create(true));
std::unique_ptr<IFX_Stream, ReleaseDeleter<IFX_Stream>> pStream(
IFX_Stream::CreateStream(
static_cast<IFX_SeekableWriteStream*>(pMemoryStream.get()),