summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfapi/parser/cpdf_parser_unittest.cpp4
-rw-r--r--testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc2
-rw-r--r--testing/libfuzzer/pdf_css_fuzzer.cc2
-rw-r--r--testing/libfuzzer/pdf_xml_fuzzer.cc2
-rw-r--r--xfa/fde/cfde_txtedtengine.cpp2
-rw-r--r--xfa/fde/cfde_txtedtengine.h2
-rw-r--r--xfa/fde/css/fde_css.h2
-rw-r--r--xfa/fde/css/fde_cssstylesheet.cpp4
-rw-r--r--xfa/fde/css/fde_cssstylesheet.h2
-rw-r--r--xfa/fde/css/fde_csssyntax.cpp4
-rw-r--r--xfa/fde/css/fde_csssyntax.h6
-rw-r--r--xfa/fde/xml/fde_xml_imp.cpp8
-rw-r--r--xfa/fde/xml/fde_xml_imp.h12
-rw-r--r--xfa/fde/xml/fde_xml_imp_unittest.cpp30
-rw-r--r--xfa/fgas/crt/fgas_stream.cpp471
-rw-r--r--xfa/fgas/crt/fgas_stream.h30
-rw-r--r--xfa/fgas/font/cfgas_gefont.cpp5
-rw-r--r--xfa/fgas/font/cfgas_gefont.h6
-rw-r--r--xfa/fxfa/parser/cxfa_dataexporter.cpp10
-rw-r--r--xfa/fxfa/parser/cxfa_dataexporter.h4
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_simple_parser.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_simple_parser.h4
-rw-r--r--xfa/fxfa/parser/cxfa_widetextread.cpp8
-rw-r--r--xfa/fxfa/parser/cxfa_widetextread.h12
-rw-r--r--xfa/fxfa/parser/cxfa_xml_parser.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_xml_parser.h6
-rw-r--r--xfa/fxfa/parser/xfa_utils.h2
28 files changed, 338 insertions, 312 deletions
diff --git a/core/fpdfapi/parser/cpdf_parser_unittest.cpp b/core/fpdfapi/parser/cpdf_parser_unittest.cpp
index 0a70103d3a..61496a1562 100644
--- a/core/fpdfapi/parser/cpdf_parser_unittest.cpp
+++ b/core/fpdfapi/parser/cpdf_parser_unittest.cpp
@@ -18,10 +18,10 @@ class CFX_TestBufferRead : public IFX_SeekableReadStream {
CFX_TestBufferRead(const unsigned char* buffer_in, size_t buf_size)
: buffer_(buffer_in), total_size_(buf_size) {}
- // IFX_Stream
+ // IFX_ReadStream:
void Release() override { delete this; }
- // IFX_SeekableReadStream
+ // IFX_SeekableReadStream:
bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override {
if (offset < 0 || offset + size > total_size_)
return false;
diff --git a/testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc b/testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc
index 923a732d06..63d0e3c75d 100644
--- a/testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc
+++ b/testing/libfuzzer/pdf_cfx_saxreader_fuzzer.cc
@@ -11,7 +11,7 @@
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
CFX_WideString input = CFX_WideString::FromUTF8(
CFX_ByteStringC(data, static_cast<FX_STRSIZE>(size)));
- std::unique_ptr<IFX_Stream, ReleaseDeleter<IFX_Stream>> stream(
+ std::unique_ptr<IFGAS_Stream, ReleaseDeleter<IFGAS_Stream>> stream(
new CXFA_WideTextRead(input));
if (!stream)
return 0;
diff --git a/testing/libfuzzer/pdf_css_fuzzer.cc b/testing/libfuzzer/pdf_css_fuzzer.cc
index ca3cf1a79d..96877f40be 100644
--- a/testing/libfuzzer/pdf_css_fuzzer.cc
+++ b/testing/libfuzzer/pdf_css_fuzzer.cc
@@ -15,7 +15,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
CFX_WideString input = CFX_WideString::FromUTF8(
CFX_ByteStringC(data, static_cast<FX_STRSIZE>(size)));
- std::unique_ptr<IFX_Stream, ReleaseDeleter<IFX_Stream>> stream(
+ std::unique_ptr<IFGAS_Stream, ReleaseDeleter<IFGAS_Stream>> stream(
new CXFA_WideTextRead(input));
if (!stream)
return 0;
diff --git a/testing/libfuzzer/pdf_xml_fuzzer.cc b/testing/libfuzzer/pdf_xml_fuzzer.cc
index 91b4d6026c..d28522c2ea 100644
--- a/testing/libfuzzer/pdf_xml_fuzzer.cc
+++ b/testing/libfuzzer/pdf_xml_fuzzer.cc
@@ -52,7 +52,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
CFX_WideString input =
CFX_WideString::FromUTF8(CFX_ByteStringC(data, safe_size.ValueOrDie()));
- std::unique_ptr<IFX_Stream, ReleaseDeleter<IFX_Stream>> stream(
+ std::unique_ptr<IFGAS_Stream, ReleaseDeleter<IFGAS_Stream>> stream(
new CXFA_WideTextRead(input));
if (!stream)
return 0;
diff --git a/xfa/fde/cfde_txtedtengine.cpp b/xfa/fde/cfde_txtedtengine.cpp
index 63a0748cd1..1250043fc7 100644
--- a/xfa/fde/cfde_txtedtengine.cpp
+++ b/xfa/fde/cfde_txtedtengine.cpp
@@ -107,7 +107,7 @@ IFDE_TxtEdtPage* CFDE_TxtEdtEngine::GetPage(int32_t nIndex) {
return m_PagePtrArray[nIndex];
}
-void CFDE_TxtEdtEngine::SetTextByStream(IFX_Stream* pStream) {
+void CFDE_TxtEdtEngine::SetTextByStream(IFGAS_Stream* pStream) {
ResetEngine();
int32_t nIndex = 0;
if (pStream && pStream->GetLength()) {
diff --git a/xfa/fde/cfde_txtedtengine.h b/xfa/fde/cfde_txtedtengine.h
index 6b4c34a958..bd02c9b9e7 100644
--- a/xfa/fde/cfde_txtedtengine.h
+++ b/xfa/fde/cfde_txtedtengine.h
@@ -28,7 +28,7 @@ class CFDE_TxtEdtEngine {
int32_t CountPages() const;
IFDE_TxtEdtPage* GetPage(int32_t nIndex);
- void SetTextByStream(IFX_Stream* pStream);
+ void SetTextByStream(IFGAS_Stream* pStream);
void SetText(const CFX_WideString& wsText);
int32_t GetTextLength() const;
CFX_WideString GetText(int32_t nStart, int32_t nCount = -1) const;
diff --git a/xfa/fde/css/fde_css.h b/xfa/fde/css/fde_css.h
index b9a0d2be5d..3c216290d2 100644
--- a/xfa/fde/css/fde_css.h
+++ b/xfa/fde/css/fde_css.h
@@ -751,7 +751,7 @@ class IFDE_CSSStyleSheet : public IFX_Retainable {
static IFDE_CSSStyleSheet* LoadHTMLStandardStyleSheet();
static IFDE_CSSStyleSheet* LoadFromStream(
const CFX_WideString& szUrl,
- IFX_Stream* pStream,
+ IFGAS_Stream* pStream,
uint16_t wCodePage,
uint32_t dwMediaList = FDE_CSSMEDIATYPE_ALL);
static IFDE_CSSStyleSheet* LoadFromBuffer(
diff --git a/xfa/fde/css/fde_cssstylesheet.cpp b/xfa/fde/css/fde_cssstylesheet.cpp
index e376aca399..9c91e43cce 100644
--- a/xfa/fde/css/fde_cssstylesheet.cpp
+++ b/xfa/fde/css/fde_cssstylesheet.cpp
@@ -49,7 +49,7 @@ IFDE_CSSStyleSheet* IFDE_CSSStyleSheet::LoadHTMLStandardStyleSheet() {
IFDE_CSSStyleSheet* IFDE_CSSStyleSheet::LoadFromStream(
const CFX_WideString& szUrl,
- IFX_Stream* pStream,
+ IFGAS_Stream* pStream,
uint16_t wCodePage,
uint32_t dwMediaList) {
CFDE_CSSStyleSheet* pStyleSheet = new CFDE_CSSStyleSheet(dwMediaList);
@@ -144,7 +144,7 @@ IFDE_CSSRule* CFDE_CSSStyleSheet::GetRule(int32_t index) {
}
bool CFDE_CSSStyleSheet::LoadFromStream(const CFX_WideString& szUrl,
- IFX_Stream* pStream,
+ IFGAS_Stream* pStream,
uint16_t wCodePage) {
std::unique_ptr<CFDE_CSSSyntaxParser> pSyntax(new CFDE_CSSSyntaxParser);
if (pStream->GetCodePage() != wCodePage)
diff --git a/xfa/fde/css/fde_cssstylesheet.h b/xfa/fde/css/fde_cssstylesheet.h
index 7d3ec98844..2460959a97 100644
--- a/xfa/fde/css/fde_cssstylesheet.h
+++ b/xfa/fde/css/fde_cssstylesheet.h
@@ -111,7 +111,7 @@ class CFDE_CSSStyleSheet : public IFDE_CSSStyleSheet, public CFX_Target {
IFDE_CSSRule* GetRule(int32_t index) override;
bool LoadFromStream(const CFX_WideString& szUrl,
- IFX_Stream* pStream,
+ IFGAS_Stream* pStream,
uint16_t wCodePage);
bool LoadFromBuffer(const CFX_WideString& szUrl,
const FX_WCHAR* pBuffer,
diff --git a/xfa/fde/css/fde_csssyntax.cpp b/xfa/fde/css/fde_csssyntax.cpp
index 27094e1376..bdad0155d5 100644
--- a/xfa/fde/css/fde_csssyntax.cpp
+++ b/xfa/fde/css/fde_csssyntax.cpp
@@ -35,7 +35,7 @@ CFDE_CSSSyntaxParser::~CFDE_CSSSyntaxParser() {
m_TextPlane.Reset();
}
-bool CFDE_CSSSyntaxParser::Init(IFX_Stream* pStream,
+bool CFDE_CSSSyntaxParser::Init(IFGAS_Stream* pStream,
int32_t iCSSPlaneSize,
int32_t iTextDataSize,
bool bOnlyDeclaration) {
@@ -433,7 +433,7 @@ bool CFDE_CSSTextBuf::EstimateSize(int32_t iAllocSize) {
m_bExtBuf = false;
return ExpandBuf(iAllocSize);
}
-int32_t CFDE_CSSTextBuf::LoadFromStream(IFX_Stream* pTxtStream,
+int32_t CFDE_CSSTextBuf::LoadFromStream(IFGAS_Stream* pTxtStream,
int32_t iStreamOffset,
int32_t iMaxChars,
bool& bEOS) {
diff --git a/xfa/fde/css/fde_csssyntax.h b/xfa/fde/css/fde_csssyntax.h
index c2c80c5e67..03662037d9 100644
--- a/xfa/fde/css/fde_csssyntax.h
+++ b/xfa/fde/css/fde_csssyntax.h
@@ -18,7 +18,7 @@ class CFDE_CSSTextBuf : public CFX_Target {
bool AttachBuffer(const FX_WCHAR* pBuffer, int32_t iBufLen);
bool EstimateSize(int32_t iAllocSize);
- int32_t LoadFromStream(IFX_Stream* pTxtStream,
+ int32_t LoadFromStream(IFGAS_Stream* pTxtStream,
int32_t iStreamOffset,
int32_t iMaxChars,
bool& bEOS);
@@ -80,7 +80,7 @@ class CFDE_CSSSyntaxParser : public CFX_Target {
CFDE_CSSSyntaxParser();
~CFDE_CSSSyntaxParser() override;
- bool Init(IFX_Stream* pStream,
+ bool Init(IFGAS_Stream* pStream,
int32_t iCSSPlaneSize,
int32_t iTextDataSize = 32,
bool bOnlyDeclaration = false);
@@ -106,7 +106,7 @@ class CFDE_CSSSyntaxParser : public CFX_Target {
bool IsImportEnabled() const;
void DisableImport() { m_dwCheck = 0; }
- IFX_Stream* m_pStream;
+ IFGAS_Stream* m_pStream;
int32_t m_iStreamPos;
int32_t m_iPlaneSize;
CFDE_CSSTextBuf m_TextData;
diff --git a/xfa/fde/xml/fde_xml_imp.cpp b/xfa/fde/xml/fde_xml_imp.cpp
index cf145fdb65..1fbb1cdda7 100644
--- a/xfa/fde/xml/fde_xml_imp.cpp
+++ b/xfa/fde/xml/fde_xml_imp.cpp
@@ -394,7 +394,7 @@ CFDE_XMLNode* CFDE_XMLNode::Clone(bool bRecursive) {
return nullptr;
}
-void CFDE_XMLNode::SaveXMLNode(IFX_Stream* pXMLStream) {
+void CFDE_XMLNode::SaveXMLNode(IFGAS_Stream* pXMLStream) {
CFDE_XMLNode* pNode = (CFDE_XMLNode*)this;
switch (pNode->GetType()) {
case FDE_XMLNODE_Instruction: {
@@ -986,7 +986,7 @@ void CFDE_XMLDoc::CloseXML() {
ReleaseParser();
}
-void CFDE_XMLDoc::SaveXMLNode(IFX_Stream* pXMLStream, CFDE_XMLNode* pINode) {
+void CFDE_XMLDoc::SaveXMLNode(IFGAS_Stream* pXMLStream, CFDE_XMLNode* pINode) {
CFDE_XMLNode* pNode = (CFDE_XMLNode*)pINode;
switch (pNode->GetType()) {
case FDE_XMLNODE_Instruction: {
@@ -1096,7 +1096,7 @@ void CFDE_XMLDoc::SaveXMLNode(IFX_Stream* pXMLStream, CFDE_XMLNode* pINode) {
}
}
-void CFDE_XMLDoc::SaveXML(IFX_Stream* pXMLStream, bool bSaveBOM) {
+void CFDE_XMLDoc::SaveXML(IFGAS_Stream* pXMLStream, bool bSaveBOM) {
if (!pXMLStream || pXMLStream == m_pStream) {
m_pStream->Seek(FX_STREAMSEEK_Begin, 0);
pXMLStream = m_pStream;
@@ -1288,7 +1288,7 @@ CFDE_XMLSyntaxParser::CFDE_XMLSyntaxParser()
m_CurNode.eNodeType = FDE_XMLNODE_Unknown;
}
-void CFDE_XMLSyntaxParser::Init(IFX_Stream* pStream,
+void CFDE_XMLSyntaxParser::Init(IFGAS_Stream* pStream,
int32_t iXMLPlaneSize,
int32_t iTextDataSize) {
ASSERT(!m_pStream && !m_pBuffer);
diff --git a/xfa/fde/xml/fde_xml_imp.h b/xfa/fde/xml/fde_xml_imp.h
index 1119ef2ff5..924f958b86 100644
--- a/xfa/fde/xml/fde_xml_imp.h
+++ b/xfa/fde/xml/fde_xml_imp.h
@@ -63,7 +63,7 @@ class CFDE_XMLNode : public CFX_Target {
bool InsertNodeItem(CFDE_XMLNode::NodeItem eItem, CFDE_XMLNode* pNode);
CFDE_XMLNode* RemoveNodeItem(CFDE_XMLNode::NodeItem eItem);
- void SaveXMLNode(IFX_Stream* pXMLStream);
+ void SaveXMLNode(IFGAS_Stream* pXMLStream);
CFDE_XMLNode* m_pParent;
CFDE_XMLNode* m_pChild;
@@ -197,14 +197,14 @@ class CFDE_XMLDoc : public CFX_Target {
int32_t DoLoad(IFX_Pause* pPause = nullptr);
void CloseXML();
CFDE_XMLNode* GetRoot() const { return m_pRoot; }
- void SaveXML(IFX_Stream* pXMLStream = nullptr, bool bSaveBOM = true);
- void SaveXMLNode(IFX_Stream* pXMLStream, CFDE_XMLNode* pNode);
+ void SaveXML(IFGAS_Stream* pXMLStream = nullptr, bool bSaveBOM = true);
+ void SaveXMLNode(IFGAS_Stream* pXMLStream, CFDE_XMLNode* pNode);
protected:
void Reset(bool bInitRoot);
void ReleaseParser();
- IFX_Stream* m_pStream;
+ IFGAS_Stream* m_pStream;
int32_t m_iStatus;
CFDE_XMLNode* m_pRoot;
CFDE_XMLSyntaxParser* m_pSyntaxParser;
@@ -261,7 +261,7 @@ class CFDE_XMLSyntaxParser : public CFX_Target {
~CFDE_XMLSyntaxParser() override;
void Release() { delete this; }
- void Init(IFX_Stream* pStream,
+ void Init(IFGAS_Stream* pStream,
int32_t iXMLPlaneSize,
int32_t iTextDataSize = 256);
@@ -320,7 +320,7 @@ class CFDE_XMLSyntaxParser : public CFX_Target {
void ParseTextChar(FX_WCHAR ch);
- IFX_Stream* m_pStream;
+ IFGAS_Stream* m_pStream;
int32_t m_iXMLPlaneSize;
int32_t m_iCurrentPos;
int32_t m_iCurrentNodeNum;
diff --git a/xfa/fde/xml/fde_xml_imp_unittest.cpp b/xfa/fde/xml/fde_xml_imp_unittest.cpp
index e5bcb0acb2..553afffd86 100644
--- a/xfa/fde/xml/fde_xml_imp_unittest.cpp
+++ b/xfa/fde/xml/fde_xml_imp_unittest.cpp
@@ -26,7 +26,7 @@ TEST(CFDE_XMLSyntaxParser, CData) {
// We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR.
size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR);
- std::unique_ptr<IFX_Stream> stream(IFX_Stream::CreateStream(
+ std::unique_ptr<IFGAS_Stream> stream(IFGAS_Stream::CreateStream(
reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0));
CFDE_XMLSyntaxParser parser;
parser.Init(stream.get(), 256);
@@ -84,7 +84,7 @@ TEST(CFDE_XMLSyntaxParser, CDataWithInnerScript) {
// We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR.
size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR);
- std::unique_ptr<IFX_Stream> stream(IFX_Stream::CreateStream(
+ std::unique_ptr<IFGAS_Stream> stream(IFGAS_Stream::CreateStream(
reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0));
CFDE_XMLSyntaxParser parser;
parser.Init(stream.get(), 256);
@@ -131,7 +131,7 @@ TEST(CFDE_XMLSyntaxParser, ArrowBangArrow) {
// We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR.
size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR);
- std::unique_ptr<IFX_Stream> stream(IFX_Stream::CreateStream(
+ std::unique_ptr<IFGAS_Stream> stream(IFGAS_Stream::CreateStream(
reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0));
CFDE_XMLSyntaxParser parser;
parser.Init(stream.get(), 256);
@@ -174,7 +174,7 @@ TEST(CFDE_XMLSyntaxParser, ArrowBangBracketArrow) {
// We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR.
size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR);
- std::unique_ptr<IFX_Stream> stream(IFX_Stream::CreateStream(
+ std::unique_ptr<IFGAS_Stream> stream(IFGAS_Stream::CreateStream(
reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0));
CFDE_XMLSyntaxParser parser;
parser.Init(stream.get(), 256);
@@ -211,7 +211,7 @@ TEST(CFDE_XMLSyntaxParser, IncompleteCData) {
// We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR.
size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR);
- std::unique_ptr<IFX_Stream> stream(IFX_Stream::CreateStream(
+ std::unique_ptr<IFGAS_Stream> stream(IFGAS_Stream::CreateStream(
reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0));
CFDE_XMLSyntaxParser parser;
parser.Init(stream.get(), 256);
@@ -248,7 +248,7 @@ TEST(CFDE_XMLSyntaxParser, UnClosedCData) {
// We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR.
size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR);
- std::unique_ptr<IFX_Stream> stream(IFX_Stream::CreateStream(
+ std::unique_ptr<IFGAS_Stream> stream(IFGAS_Stream::CreateStream(
reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0));
CFDE_XMLSyntaxParser parser;
parser.Init(stream.get(), 256);
@@ -285,7 +285,7 @@ TEST(CFDE_XMLSyntaxParser, EmptyCData) {
// We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR.
size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR);
- std::unique_ptr<IFX_Stream> stream(IFX_Stream::CreateStream(
+ std::unique_ptr<IFGAS_Stream> stream(IFGAS_Stream::CreateStream(
reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0));
CFDE_XMLSyntaxParser parser;
parser.Init(stream.get(), 256);
@@ -332,7 +332,7 @@ TEST(CFDE_XMLSyntaxParser, Comment) {
// We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR.
size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR);
- std::unique_ptr<IFX_Stream> stream(IFX_Stream::CreateStream(
+ std::unique_ptr<IFGAS_Stream> stream(IFGAS_Stream::CreateStream(
reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0));
CFDE_XMLSyntaxParser parser;
parser.Init(stream.get(), 256);
@@ -375,7 +375,7 @@ TEST(CFDE_XMLSyntaxParser, IncorrectCommentStart) {
// We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR.
size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR);
- std::unique_ptr<IFX_Stream> stream(IFX_Stream::CreateStream(
+ std::unique_ptr<IFGAS_Stream> stream(IFGAS_Stream::CreateStream(
reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0));
CFDE_XMLSyntaxParser parser;
parser.Init(stream.get(), 256);
@@ -418,7 +418,7 @@ TEST(CFDE_XMLSyntaxParser, CommentEmpty) {
// We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR.
size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR);
- std::unique_ptr<IFX_Stream> stream(IFX_Stream::CreateStream(
+ std::unique_ptr<IFGAS_Stream> stream(IFGAS_Stream::CreateStream(
reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0));
CFDE_XMLSyntaxParser parser;
parser.Init(stream.get(), 256);
@@ -461,7 +461,7 @@ TEST(CFDE_XMLSyntaxParser, CommentThreeDash) {
// We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR.
size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR);
- std::unique_ptr<IFX_Stream> stream(IFX_Stream::CreateStream(
+ std::unique_ptr<IFGAS_Stream> stream(IFGAS_Stream::CreateStream(
reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0));
CFDE_XMLSyntaxParser parser;
parser.Init(stream.get(), 256);
@@ -496,7 +496,7 @@ TEST(CFDE_XMLSyntaxParser, CommentTwoDash) {
// We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR.
size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR);
- std::unique_ptr<IFX_Stream> stream(IFX_Stream::CreateStream(
+ std::unique_ptr<IFGAS_Stream> stream(IFGAS_Stream::CreateStream(
reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0));
CFDE_XMLSyntaxParser parser;
parser.Init(stream.get(), 256);
@@ -535,7 +535,7 @@ TEST(CFDE_XMLSyntaxParser, Entities) {
// We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR.
size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR);
- std::unique_ptr<IFX_Stream> stream(IFX_Stream::CreateStream(
+ std::unique_ptr<IFGAS_Stream> stream(IFGAS_Stream::CreateStream(
reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0));
CFDE_XMLSyntaxParser parser;
parser.Init(stream.get(), 256);
@@ -575,7 +575,7 @@ TEST(CFDE_XMLSyntaxParser, EntityOverflowHex) {
// We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR.
size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR);
- std::unique_ptr<IFX_Stream> stream(IFX_Stream::CreateStream(
+ std::unique_ptr<IFGAS_Stream> stream(IFGAS_Stream::CreateStream(
reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0));
CFDE_XMLSyntaxParser parser;
parser.Init(stream.get(), 256);
@@ -615,7 +615,7 @@ TEST(CFDE_XMLSyntaxParser, EntityOverflowDecimal) {
// We * sizeof(FX_WCHAR) because we pass in the uint8_t, not the FX_WCHAR.
size_t len = FXSYS_wcslen(input) * sizeof(FX_WCHAR);
- std::unique_ptr<IFX_Stream> stream(IFX_Stream::CreateStream(
+ std::unique_ptr<IFGAS_Stream> stream(IFGAS_Stream::CreateStream(
reinterpret_cast<uint8_t*>(const_cast<FX_WCHAR*>(input)), len, 0));
CFDE_XMLSyntaxParser parser;
parser.Init(stream.get(), 256);
diff --git a/xfa/fgas/crt/fgas_stream.cpp b/xfa/fgas/crt/fgas_stream.cpp
index 485d229282..18d8e0bfe1 100644
--- a/xfa/fgas/crt/fgas_stream.cpp
+++ b/xfa/fgas/crt/fgas_stream.cpp
@@ -18,9 +18,9 @@
namespace {
-class IFX_StreamImp {
+class IFGAS_StreamImp {
public:
- virtual ~IFX_StreamImp() {}
+ virtual ~IFGAS_StreamImp() {}
virtual int32_t GetLength() const = 0;
virtual int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) = 0;
@@ -36,7 +36,7 @@ class IFX_StreamImp {
virtual bool SetLength(int32_t iLength) = 0;
protected:
- IFX_StreamImp();
+ IFGAS_StreamImp();
uint32_t GetAccessModes() const { return m_dwAccess; }
void SetAccessModes(uint32_t modes) { m_dwAccess = modes; }
@@ -45,14 +45,14 @@ class IFX_StreamImp {
uint32_t m_dwAccess;
};
-class CFX_FileStreamImp : public IFX_StreamImp {
+class CFGAS_FileStreamImp : public IFGAS_StreamImp {
public:
- CFX_FileStreamImp();
- ~CFX_FileStreamImp() override;
+ CFGAS_FileStreamImp();
+ ~CFGAS_FileStreamImp() override;
bool LoadFile(const FX_WCHAR* pszSrcFileName, uint32_t dwAccess);
- // IFX_StreamImp:
+ // IFGAS_StreamImp:
int32_t GetLength() const override;
int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) override;
int32_t GetPosition() override;
@@ -69,14 +69,14 @@ class CFX_FileStreamImp : public IFX_StreamImp {
int32_t m_iLength;
};
-class CFX_BufferStreamImp : public IFX_StreamImp {
+class CFGAS_BufferStreamImp : public IFGAS_StreamImp {
public:
- CFX_BufferStreamImp();
- ~CFX_BufferStreamImp() override {}
+ CFGAS_BufferStreamImp();
+ ~CFGAS_BufferStreamImp() override {}
bool LoadBuffer(uint8_t* pData, int32_t iTotalSize, uint32_t dwAccess);
- // IFX_StreamImp:
+ // IFGAS_StreamImp:
int32_t GetLength() const override;
int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) override;
int32_t GetPosition() override;
@@ -95,14 +95,14 @@ class CFX_BufferStreamImp : public IFX_StreamImp {
int32_t m_iLength;
};
-class CFX_FileReadStreamImp : public IFX_StreamImp {
+class CFGAS_FileReadStreamImp : public IFGAS_StreamImp {
public:
- CFX_FileReadStreamImp();
- ~CFX_FileReadStreamImp() override {}
+ CFGAS_FileReadStreamImp();
+ ~CFGAS_FileReadStreamImp() override {}
bool LoadFileRead(IFX_SeekableReadStream* pFileRead, uint32_t dwAccess);
- // IFX_StreamImp:
+ // IFGAS_StreamImp:
int32_t GetLength() const override;
int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) override;
int32_t GetPosition() override { return m_iPosition; }
@@ -124,17 +124,17 @@ class CFX_FileReadStreamImp : public IFX_StreamImp {
int32_t m_iLength;
};
-class CFX_BufferReadStreamImp : public IFX_StreamImp {
+class CFGAS_BufferReadStreamImp : public IFGAS_StreamImp {
public:
- CFX_BufferReadStreamImp();
- ~CFX_BufferReadStreamImp() override;
+ CFGAS_BufferReadStreamImp();
+ ~CFGAS_BufferReadStreamImp() override;
bool LoadBufferRead(IFX_BufferedReadStream* pBufferRead,
int32_t iFileSize,
uint32_t dwAccess,
bool bReleaseBufferRead);
- // IFX_StreamImp:
+ // IFGAS_StreamImp:
int32_t GetLength() const override;
int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) override;
int32_t GetPosition() override { return m_iPosition; }
@@ -157,14 +157,14 @@ class CFX_BufferReadStreamImp : public IFX_StreamImp {
int32_t m_iBufferSize;
};
-class CFX_FileWriteStreamImp : public IFX_StreamImp {
+class CFGAS_FileWriteStreamImp : public IFGAS_StreamImp {
public:
- CFX_FileWriteStreamImp();
- ~CFX_FileWriteStreamImp() override {}
+ CFGAS_FileWriteStreamImp();
+ ~CFGAS_FileWriteStreamImp() override {}
bool LoadFileWrite(IFX_SeekableWriteStream* pFileWrite, uint32_t dwAccess);
- // IFX_StreamImp:
+ // IFGAS_StreamImp:
int32_t GetLength() const override;
int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) override;
int32_t GetPosition() override { return m_iPosition; }
@@ -191,10 +191,10 @@ enum FX_STREAMTYPE {
FX_STREAMTYPE_BufferRead,
};
-class CFX_Stream : public IFX_Stream {
+class CFGAS_Stream : public IFGAS_Stream {
public:
- CFX_Stream();
- ~CFX_Stream() override;
+ CFGAS_Stream();
+ ~CFGAS_Stream() override;
bool LoadFile(const FX_WCHAR* pszSrcFileName, uint32_t dwAccess);
bool LoadBuffer(uint8_t* pData, int32_t iTotalSize, uint32_t dwAccess);
@@ -205,9 +205,9 @@ class CFX_Stream : public IFX_Stream {
uint32_t dwAccess,
bool bReleaseBufferRead);
- // IFX_Stream
+ // IFGAS_Stream
void Release() override;
- IFX_Stream* Retain() override;
+ IFGAS_Stream* Retain() override;
uint32_t GetAccessModes() const override;
int32_t GetLength() const override;
int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) override;
@@ -222,13 +222,13 @@ class CFX_Stream : public IFX_Stream {
int32_t GetBOM(uint8_t bom[4]) const override;
uint16_t GetCodePage() const override;
uint16_t SetCodePage(uint16_t wCodePage) override;
- IFX_Stream* CreateSharedStream(uint32_t dwAccess,
- int32_t iOffset,
- int32_t iLength) override;
+ IFGAS_Stream* CreateSharedStream(uint32_t dwAccess,
+ int32_t iOffset,
+ int32_t iLength) override;
protected:
FX_STREAMTYPE m_eStreamType;
- IFX_StreamImp* m_pStreamImp;
+ IFGAS_StreamImp* m_pStreamImp;
uint32_t m_dwAccess;
int32_t m_iTotalSize;
int32_t m_iPosition;
@@ -237,14 +237,14 @@ class CFX_Stream : public IFX_Stream {
int32_t m_iRefCount;
};
-class CFX_TextStream : public IFX_Stream {
+class CFGAS_TextStream : public IFGAS_Stream {
public:
- CFX_TextStream(IFX_Stream* pStream, bool bDelStream);
- ~CFX_TextStream() override;
+ CFGAS_TextStream(IFGAS_Stream* pStream, bool bDelStream);
+ ~CFGAS_TextStream() override;
- // IFX_Stream
+ // IFGAS_Stream
void Release() override;
- IFX_Stream* Retain() override;
+ IFGAS_Stream* Retain() override;
uint32_t GetAccessModes() const override;
int32_t GetLength() const override;
int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) override;
@@ -259,9 +259,9 @@ class CFX_TextStream : public IFX_Stream {
int32_t GetBOM(uint8_t bom[4]) const override;
uint16_t GetCodePage() const override;
uint16_t SetCodePage(uint16_t wCodePage) override;
- IFX_Stream* CreateSharedStream(uint32_t dwAccess,
- int32_t iOffset,
- int32_t iLength) override;
+ IFGAS_Stream* CreateSharedStream(uint32_t dwAccess,
+ int32_t iOffset,
+ int32_t iLength) override;
protected:
uint16_t m_wCodePage;
@@ -270,14 +270,14 @@ class CFX_TextStream : public IFX_Stream {
uint8_t* m_pBuf;
int32_t m_iBufSize;
bool m_bDelStream;
- IFX_Stream* m_pStreamImp;
+ IFGAS_Stream* m_pStreamImp;
int32_t m_iRefCount;
void InitStream();
};
class CFGAS_FileRead : public IFX_SeekableReadStream {
public:
- CFGAS_FileRead(IFX_Stream* pStream, bool bReleaseStream);
+ CFGAS_FileRead(IFGAS_Stream* pStream, bool bReleaseStream);
~CFGAS_FileRead() override;
// IFX_SeekableReadStream
@@ -287,7 +287,7 @@ class CFGAS_FileRead : public IFX_SeekableReadStream {
protected:
bool m_bReleaseStream;
- IFX_Stream* m_pStream;
+ IFGAS_Stream* m_pStream;
};
int32_t FileLength(FXSYS_FILE* file) {
@@ -322,59 +322,59 @@ bool FileSetSize(FXSYS_FILE* file, int32_t size) {
} // namespace
// static
-IFX_Stream* IFX_Stream::CreateStream(IFX_SeekableReadStream* pFileRead,
- uint32_t dwAccess) {
- CFX_Stream* pSR = new CFX_Stream;
+IFGAS_Stream* IFGAS_Stream::CreateStream(IFX_SeekableReadStream* pFileRead,
+ uint32_t dwAccess) {
+ CFGAS_Stream* pSR = new CFGAS_Stream;
if (!pSR->LoadFileRead(pFileRead, dwAccess)) {
pSR->Release();
return nullptr;
}
- if (dwAccess & FX_STREAMACCESS_Text) {
- return new CFX_TextStream(pSR, true);
- }
+ if (dwAccess & FX_STREAMACCESS_Text)
+ return new CFGAS_TextStream(pSR, true);
+
return pSR;
}
// static
-IFX_Stream* IFX_Stream::CreateStream(IFX_SeekableWriteStream* pFileWrite,
- uint32_t dwAccess) {
- CFX_Stream* pSR = new CFX_Stream;
+IFGAS_Stream* IFGAS_Stream::CreateStream(IFX_SeekableWriteStream* pFileWrite,
+ uint32_t dwAccess) {
+ CFGAS_Stream* pSR = new CFGAS_Stream;
if (!pSR->LoadFileWrite(pFileWrite, dwAccess)) {
pSR->Release();
return nullptr;
}
- if (dwAccess & FX_STREAMACCESS_Text) {
- return new CFX_TextStream(pSR, true);
- }
+ if (dwAccess & FX_STREAMACCESS_Text)
+ return new CFGAS_TextStream(pSR, true);
+
return pSR;
}
// static
-IFX_Stream* IFX_Stream::CreateStream(uint8_t* pData,
- int32_t length,
- uint32_t dwAccess) {
- CFX_Stream* pSR = new CFX_Stream;
+IFGAS_Stream* IFGAS_Stream::CreateStream(uint8_t* pData,
+ int32_t length,
+ uint32_t dwAccess) {
+ CFGAS_Stream* pSR = new CFGAS_Stream;
if (!pSR->LoadBuffer(pData, length, dwAccess)) {
pSR->Release();
return nullptr;
}
- if (dwAccess & FX_STREAMACCESS_Text) {
- return new CFX_TextStream(pSR, true);
- }
+ if (dwAccess & FX_STREAMACCESS_Text)
+ return new CFGAS_TextStream(pSR, true);
+
return pSR;
}
-IFX_StreamImp::IFX_StreamImp() : m_dwAccess(0) {}
+IFGAS_StreamImp::IFGAS_StreamImp() : m_dwAccess(0) {}
-CFX_FileStreamImp::CFX_FileStreamImp() : m_hFile(nullptr), m_iLength(0) {}
+CFGAS_FileStreamImp::CFGAS_FileStreamImp() : m_hFile(nullptr), m_iLength(0) {}
-CFX_FileStreamImp::~CFX_FileStreamImp() {
+CFGAS_FileStreamImp::~CFGAS_FileStreamImp() {
if (m_hFile)
FXSYS_fclose(m_hFile);
}
-bool CFX_FileStreamImp::LoadFile(const FX_WCHAR* pszSrcFileName,
- uint32_t dwAccess) {
+bool CFGAS_FileStreamImp::LoadFile(const FX_WCHAR* pszSrcFileName,
+ uint32_t dwAccess) {
ASSERT(!m_hFile);
ASSERT(pszSrcFileName && FXSYS_wcslen(pszSrcFileName) > 0);
#if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || \
@@ -451,31 +451,31 @@ bool CFX_FileStreamImp::LoadFile(const FX_WCHAR* pszSrcFileName,
}
return true;
}
-int32_t CFX_FileStreamImp::GetLength() const {
+int32_t CFGAS_FileStreamImp::GetLength() const {
ASSERT(m_hFile);
return m_iLength;
}
-int32_t CFX_FileStreamImp::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) {
+int32_t CFGAS_FileStreamImp::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) {
ASSERT(m_hFile);
FXSYS_fseek(m_hFile, iOffset, eSeek);
return FXSYS_ftell(m_hFile);
}
-int32_t CFX_FileStreamImp::GetPosition() {
+int32_t CFGAS_FileStreamImp::GetPosition() {
ASSERT(m_hFile);
return FXSYS_ftell(m_hFile);
}
-bool CFX_FileStreamImp::IsEOF() const {
+bool CFGAS_FileStreamImp::IsEOF() const {
ASSERT(m_hFile);
return FXSYS_ftell(m_hFile) >= m_iLength;
}
-int32_t CFX_FileStreamImp::ReadData(uint8_t* pBuffer, int32_t iBufferSize) {
+int32_t CFGAS_FileStreamImp::ReadData(uint8_t* pBuffer, int32_t iBufferSize) {
ASSERT(m_hFile);
ASSERT(pBuffer && iBufferSize > 0);
return FXSYS_fread(pBuffer, 1, iBufferSize, m_hFile);
}
-int32_t CFX_FileStreamImp::ReadString(FX_WCHAR* pStr,
- int32_t iMaxLength,
- bool& bEOS) {
+int32_t CFGAS_FileStreamImp::ReadString(FX_WCHAR* pStr,
+ int32_t iMaxLength,
+ bool& bEOS) {
ASSERT(m_hFile);
ASSERT(pStr && iMaxLength > 0);
if (m_iLength <= 0) {
@@ -498,8 +498,8 @@ int32_t CFX_FileStreamImp::ReadString(FX_WCHAR* pStr,
bEOS = (iPosition >= m_iLength);
return iCount;
}
-int32_t CFX_FileStreamImp::WriteData(const uint8_t* pBuffer,
- int32_t iBufferSize) {
+int32_t CFGAS_FileStreamImp::WriteData(const uint8_t* pBuffer,
+ int32_t iBufferSize) {
ASSERT(m_hFile && (GetAccessModes() & FX_STREAMACCESS_Write) != 0);
ASSERT(pBuffer && iBufferSize > 0);
int32_t iRet = FXSYS_fwrite(pBuffer, 1, iBufferSize, m_hFile);
@@ -511,7 +511,8 @@ int32_t CFX_FileStreamImp::WriteData(const uint8_t* pBuffer,
}
return iRet;
}
-int32_t CFX_FileStreamImp::WriteString(const FX_WCHAR* pStr, int32_t iLength) {
+int32_t CFGAS_FileStreamImp::WriteString(const FX_WCHAR* pStr,
+ int32_t iLength) {
ASSERT(m_hFile && (GetAccessModes() & FX_STREAMACCESS_Write) != 0);
ASSERT(pStr && iLength > 0);
int32_t iRet = FXSYS_fwrite(pStr, 2, iLength, m_hFile);
@@ -523,20 +524,20 @@ int32_t CFX_FileStreamImp::WriteString(const FX_WCHAR* pStr, int32_t iLength) {
}
return iRet;
}
-void CFX_FileStreamImp::Flush() {
+void CFGAS_FileStreamImp::Flush() {
ASSERT(m_hFile && (GetAccessModes() & FX_STREAMACCESS_Write) != 0);
FXSYS_fflush(m_hFile);
}
-bool CFX_FileStreamImp::SetLength(int32_t iLength) {
+bool CFGAS_FileStreamImp::SetLength(int32_t iLength) {
ASSERT(m_hFile && (GetAccessModes() & FX_STREAMACCESS_Write) != 0);
bool bRet = FileSetSize(m_hFile, iLength);
m_iLength = FileLength(m_hFile);
return bRet;
}
-CFX_FileReadStreamImp::CFX_FileReadStreamImp()
+CFGAS_FileReadStreamImp::CFGAS_FileReadStreamImp()
: m_pFileRead(nullptr), m_iPosition(0), m_iLength(0) {}
-bool CFX_FileReadStreamImp::LoadFileRead(IFX_SeekableReadStream* pFileRead,
- uint32_t dwAccess) {
+bool CFGAS_FileReadStreamImp::LoadFileRead(IFX_SeekableReadStream* pFileRead,
+ uint32_t dwAccess) {
ASSERT(!m_pFileRead && pFileRead);
if (dwAccess & FX_STREAMACCESS_Write) {
return false;
@@ -545,10 +546,10 @@ bool CFX_FileReadStreamImp::LoadFileRead(IFX_SeekableReadStream* pFileRead,
m_iLength = m_pFileRead->GetSize();
return true;
}
-int32_t CFX_FileReadStreamImp::GetLength() const {
+int32_t CFGAS_FileReadStreamImp::GetLength() const {
return m_iLength;
}
-int32_t CFX_FileReadStreamImp::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) {
+int32_t CFGAS_FileReadStreamImp::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) {
switch (eSeek) {
case FX_STREAMSEEK_Begin:
m_iPosition = iOffset;
@@ -567,10 +568,11 @@ int32_t CFX_FileReadStreamImp::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) {
}
return m_iPosition;
}
-bool CFX_FileReadStreamImp::IsEOF() const {
+bool CFGAS_FileReadStreamImp::IsEOF() const {
return m_iPosition >= m_iLength;
}
-int32_t CFX_FileReadStreamImp::ReadData(uint8_t* pBuffer, int32_t iBufferSize) {
+int32_t CFGAS_FileReadStreamImp::ReadData(uint8_t* pBuffer,
+ int32_t iBufferSize) {
ASSERT(m_pFileRead);
ASSERT(pBuffer && iBufferSize > 0);
if (iBufferSize > m_iLength - m_iPosition) {
@@ -582,9 +584,9 @@ int32_t CFX_FileReadStreamImp::ReadData(uint8_t* pBuffer, int32_t iBufferSize) {
}
return 0;
}
-int32_t CFX_FileReadStreamImp::ReadString(FX_WCHAR* pStr,
- int32_t iMaxLength,
- bool& bEOS) {
+int32_t CFGAS_FileReadStreamImp::ReadString(FX_WCHAR* pStr,
+ int32_t iMaxLength,
+ bool& bEOS) {
ASSERT(m_pFileRead);
ASSERT(pStr && iMaxLength > 0);
iMaxLength = ReadData((uint8_t*)pStr, iMaxLength * 2) / 2;
@@ -598,17 +600,17 @@ int32_t CFX_FileReadStreamImp::ReadString(FX_WCHAR* pStr,
bEOS = (m_iPosition >= m_iLength) || pStr[i] == L'\0';
return i;
}
-CFX_BufferReadStreamImp::CFX_BufferReadStreamImp()
+CFGAS_BufferReadStreamImp::CFGAS_BufferReadStreamImp()
: m_pBufferRead(nullptr),
m_bReleaseBufferRead(false),
m_iPosition(0),
m_iBufferSize(0) {}
-CFX_BufferReadStreamImp::~CFX_BufferReadStreamImp() {
+CFGAS_BufferReadStreamImp::~CFGAS_BufferReadStreamImp() {
if (m_bReleaseBufferRead && m_pBufferRead) {
m_pBufferRead->Release();
}
}
-bool CFX_BufferReadStreamImp::LoadBufferRead(
+bool CFGAS_BufferReadStreamImp::LoadBufferRead(
IFX_BufferedReadStream* pBufferRead,
int32_t iFileSize,
uint32_t dwAccess,
@@ -633,10 +635,10 @@ bool CFX_BufferReadStreamImp::LoadBufferRead(
}
return true;
}
-int32_t CFX_BufferReadStreamImp::GetLength() const {
+int32_t CFGAS_BufferReadStreamImp::GetLength() const {
return m_iBufferSize;
}
-int32_t CFX_BufferReadStreamImp::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) {
+int32_t CFGAS_BufferReadStreamImp::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) {
int32_t iLength = GetLength();
switch (eSeek) {
case FX_STREAMSEEK_Begin:
@@ -656,11 +658,11 @@ int32_t CFX_BufferReadStreamImp::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) {
}
return m_iPosition;
}
-bool CFX_BufferReadStreamImp::IsEOF() const {
+bool CFGAS_BufferReadStreamImp::IsEOF() const {
return m_pBufferRead ? m_pBufferRead->IsEOF() : true;
}
-int32_t CFX_BufferReadStreamImp::ReadData(uint8_t* pBuffer,
- int32_t iBufferSize) {
+int32_t CFGAS_BufferReadStreamImp::ReadData(uint8_t* pBuffer,
+ int32_t iBufferSize) {
ASSERT(m_pBufferRead);
ASSERT(pBuffer && iBufferSize > 0);
int32_t iLength = GetLength();
@@ -713,9 +715,9 @@ int32_t CFX_BufferReadStreamImp::ReadData(uint8_t* pBuffer,
m_iPosition += dwOffsetTmp;
return dwOffsetTmp;
}
-int32_t CFX_BufferReadStreamImp::ReadString(FX_WCHAR* pStr,
- int32_t iMaxLength,
- bool& bEOS) {
+int32_t CFGAS_BufferReadStreamImp::ReadString(FX_WCHAR* pStr,
+ int32_t iMaxLength,
+ bool& bEOS) {
ASSERT(m_pBufferRead);
ASSERT(pStr && iMaxLength > 0);
iMaxLength = ReadData((uint8_t*)pStr, iMaxLength * 2) / 2;
@@ -729,10 +731,11 @@ int32_t CFX_BufferReadStreamImp::ReadString(FX_WCHAR* pStr,
bEOS = (m_iPosition >= GetLength()) || pStr[i] == L'\0';
return i;
}
-CFX_FileWriteStreamImp::CFX_FileWriteStreamImp()
+CFGAS_FileWriteStreamImp::CFGAS_FileWriteStreamImp()
: m_pFileWrite(nullptr), m_iPosition(0) {}
-bool CFX_FileWriteStreamImp::LoadFileWrite(IFX_SeekableWriteStream* pFileWrite,
- uint32_t dwAccess) {
+bool CFGAS_FileWriteStreamImp::LoadFileWrite(
+ IFX_SeekableWriteStream* pFileWrite,
+ uint32_t dwAccess) {
ASSERT(!m_pFileWrite && pFileWrite);
if (dwAccess & FX_STREAMACCESS_Read) {
return false;
@@ -743,13 +746,13 @@ bool CFX_FileWriteStreamImp::LoadFileWrite(IFX_SeekableWriteStream* pFileWrite,
m_pFileWrite = pFileWrite;
return true;
}
-int32_t CFX_FileWriteStreamImp::GetLength() const {
+int32_t CFGAS_FileWriteStreamImp::GetLength() const {
if (!m_pFileWrite) {
return 0;
}
return (int32_t)m_pFileWrite->GetSize();
}
-int32_t CFX_FileWriteStreamImp::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) {
+int32_t CFGAS_FileWriteStreamImp::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) {
int32_t iLength = GetLength();
switch (eSeek) {
case FX_STREAMSEEK_Begin:
@@ -769,11 +772,11 @@ int32_t CFX_FileWriteStreamImp::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) {
}
return m_iPosition;
}
-bool CFX_FileWriteStreamImp::IsEOF() const {
+bool CFGAS_FileWriteStreamImp::IsEOF() const {
return m_iPosition >= GetLength();
}
-int32_t CFX_FileWriteStreamImp::WriteData(const uint8_t* pBuffer,
- int32_t iBufferSize) {
+int32_t CFGAS_FileWriteStreamImp::WriteData(const uint8_t* pBuffer,
+ int32_t iBufferSize) {
if (!m_pFileWrite) {
return 0;
}
@@ -782,21 +785,21 @@ int32_t CFX_FileWriteStreamImp::WriteData(const uint8_t* pBuffer,
}
return iBufferSize;
}
-int32_t CFX_FileWriteStreamImp::WriteString(const FX_WCHAR* pStr,
- int32_t iLength) {
+int32_t CFGAS_FileWriteStreamImp::WriteString(const FX_WCHAR* pStr,
+ int32_t iLength) {
return WriteData((const uint8_t*)pStr, iLength * sizeof(FX_WCHAR));
}
-void CFX_FileWriteStreamImp::Flush() {
+void CFGAS_FileWriteStreamImp::Flush() {
if (m_pFileWrite) {
m_pFileWrite->Flush();
}
}
-CFX_BufferStreamImp::CFX_BufferStreamImp()
+CFGAS_BufferStreamImp::CFGAS_BufferStreamImp()
: m_pData(nullptr), m_iTotalSize(0), m_iPosition(0), m_iLength(0) {}
-bool CFX_BufferStreamImp::LoadBuffer(uint8_t* pData,
- int32_t iTotalSize,
- uint32_t dwAccess) {
+bool CFGAS_BufferStreamImp::LoadBuffer(uint8_t* pData,
+ int32_t iTotalSize,
+ uint32_t dwAccess) {
ASSERT(!m_pData && pData && iTotalSize > 0);
SetAccessModes(dwAccess);
m_pData = pData;
@@ -805,11 +808,11 @@ bool CFX_BufferStreamImp::LoadBuffer(uint8_t* pData,
m_iLength = (dwAccess & FX_STREAMACCESS_Write) != 0 ? 0 : iTotalSize;
return true;
}
-int32_t CFX_BufferStreamImp::GetLength() const {
+int32_t CFGAS_BufferStreamImp::GetLength() const {
ASSERT(m_pData);
return m_iLength;
}
-int32_t CFX_BufferStreamImp::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) {
+int32_t CFGAS_BufferStreamImp::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) {
ASSERT(m_pData);
if (eSeek == FX_STREAMSEEK_Begin) {
m_iPosition = iOffset;
@@ -826,15 +829,15 @@ int32_t CFX_BufferStreamImp::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) {
}
return m_iPosition;
}
-int32_t CFX_BufferStreamImp::GetPosition() {
+int32_t CFGAS_BufferStreamImp::GetPosition() {
ASSERT(m_pData);
return m_iPosition;
}
-bool CFX_BufferStreamImp::IsEOF() const {
+bool CFGAS_BufferStreamImp::IsEOF() const {
ASSERT(m_pData);
return m_iPosition >= m_iLength;
}
-int32_t CFX_BufferStreamImp::ReadData(uint8_t* pBuffer, int32_t iBufferSize) {
+int32_t CFGAS_BufferStreamImp::ReadData(uint8_t* pBuffer, int32_t iBufferSize) {
ASSERT(m_pData);
ASSERT(pBuffer && iBufferSize > 0);
int32_t iLen = std::min(m_iLength - m_iPosition, iBufferSize);
@@ -845,9 +848,9 @@ int32_t CFX_BufferStreamImp::ReadData(uint8_t* pBuffer, int32_t iBufferSize) {
m_iPosition += iLen;
return iLen;
}
-int32_t CFX_BufferStreamImp::ReadString(FX_WCHAR* pStr,
- int32_t iMaxLength,
- bool& bEOS) {
+int32_t CFGAS_BufferStreamImp::ReadString(FX_WCHAR* pStr,
+ int32_t iMaxLength,
+ bool& bEOS) {
ASSERT(m_pData);
ASSERT(pStr && iMaxLength > 0);
int32_t iLen = std::min((m_iLength - m_iPosition) / 2, iMaxLength);
@@ -864,8 +867,8 @@ int32_t CFX_BufferStreamImp::ReadString(FX_WCHAR* pStr,
bEOS = (*pSrc == L'\0') || (m_iPosition >= m_iLength);
return iCount;
}
-int32_t CFX_BufferStreamImp::WriteData(const uint8_t* pBuffer,
- int32_t iBufferSize) {
+int32_t CFGAS_BufferStreamImp::WriteData(const uint8_t* pBuffer,
+ int32_t iBufferSize) {
ASSERT(m_pData && (GetAccessModes() & FX_STREAMACCESS_Write) != 0);
ASSERT(pBuffer && iBufferSize > 0);
int32_t iLen = std::min(m_iTotalSize - m_iPosition, iBufferSize);
@@ -879,8 +882,8 @@ int32_t CFX_BufferStreamImp::WriteData(const uint8_t* pBuffer,
}
return iLen;
}
-int32_t CFX_BufferStreamImp::WriteString(const FX_WCHAR* pStr,
- int32_t iLength) {
+int32_t CFGAS_BufferStreamImp::WriteString(const FX_WCHAR* pStr,
+ int32_t iLength) {
ASSERT(m_pData && (GetAccessModes() & FX_STREAMACCESS_Write) != 0);
ASSERT(pStr && iLength > 0);
int32_t iLen = std::min((m_iTotalSize - m_iPosition) / 2, iLength);
@@ -896,13 +899,13 @@ int32_t CFX_BufferStreamImp::WriteString(const FX_WCHAR* pStr,
}
// static
-IFX_Stream* IFX_Stream::CreateTextStream(IFX_Stream* pBaseStream,
- bool bDeleteOnRelease) {
+IFGAS_Stream* IFGAS_Stream::CreateTextStream(IFGAS_Stream* pBaseStream,
+ bool bDeleteOnRelease) {
ASSERT(pBaseStream);
- return new CFX_TextStream(pBaseStream, bDeleteOnRelease);
+ return new CFGAS_TextStream(pBaseStream, bDeleteOnRelease);
}
-CFX_TextStream::CFX_TextStream(IFX_Stream* pStream, bool bDelStream)
+CFGAS_TextStream::CFGAS_TextStream(IFGAS_Stream* pStream, bool bDelStream)
: m_wCodePage(FX_CODEPAGE_DefANSI),
m_wBOMLength(0),
m_dwBOM(0),
@@ -915,16 +918,16 @@ CFX_TextStream::CFX_TextStream(IFX_Stream* pStream, bool bDelStream)
m_pStreamImp->Retain();
InitStream();
}
-CFX_TextStream::~CFX_TextStream() {
+
+CFGAS_TextStream::~CFGAS_TextStream() {
m_pStreamImp->Release();
- if (m_bDelStream) {
+ if (m_bDelStream)
m_pStreamImp->Release();
- }
- if (m_pBuf) {
+ if (m_pBuf)
FX_Free(m_pBuf);
- }
}
-void CFX_TextStream::InitStream() {
+
+void CFGAS_TextStream::InitStream() {
int32_t iPosition = m_pStreamImp->GetPosition();
m_pStreamImp->Seek(FX_STREAMSEEK_Begin, 0);
m_pStreamImp->ReadData((uint8_t*)&m_dwBOM, 3);
@@ -969,76 +972,92 @@ void CFX_TextStream::InitStream() {
#endif
m_pStreamImp->Seek(FX_STREAMSEEK_Begin, std::max(m_wBOMLength, iPosition));
}
-void CFX_TextStream::Release() {
- if (--m_iRefCount < 1) {
+
+void CFGAS_TextStream::Release() {
+ if (--m_iRefCount < 1)
delete this;
- }
}
-IFX_Stream* CFX_TextStream::Retain() {
+
+IFGAS_Stream* CFGAS_TextStream::Retain() {
m_iRefCount++;
return this;
}
-uint32_t CFX_TextStream::GetAccessModes() const {
+
+uint32_t CFGAS_TextStream::GetAccessModes() const {
return m_pStreamImp->GetAccessModes() | FX_STREAMACCESS_Text;
}
-int32_t CFX_TextStream::GetLength() const {
+
+int32_t CFGAS_TextStream::GetLength() const {
return m_pStreamImp->GetLength();
}
-int32_t CFX_TextStream::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) {
+
+int32_t CFGAS_TextStream::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) {
return m_pStreamImp->Seek(eSeek, iOffset);
}
-int32_t CFX_TextStream::GetPosition() {
+
+int32_t CFGAS_TextStream::GetPosition() {
return m_pStreamImp->GetPosition();
}
-bool CFX_TextStream::IsEOF() const {
+
+bool CFGAS_TextStream::IsEOF() const {
return m_pStreamImp->IsEOF();
}
-int32_t CFX_TextStream::ReadData(uint8_t* pBuffer, int32_t iBufferSize) {
+
+int32_t CFGAS_TextStream::ReadData(uint8_t* pBuffer, int32_t iBufferSize) {
return m_pStreamImp->ReadData(pBuffer, iBufferSize);
}
-int32_t CFX_TextStream::WriteData(const uint8_t* pBuffer, int32_t iBufferSize) {
+
+int32_t CFGAS_TextStream::WriteData(const uint8_t* pBuffer,
+ int32_t iBufferSize) {
return m_pStreamImp->WriteData(pBuffer, iBufferSize);
}
-void CFX_TextStream::Flush() {
+
+void CFGAS_TextStream::Flush() {
m_pStreamImp->Flush();
}
-bool CFX_TextStream::SetLength(int32_t iLength) {
+
+bool CFGAS_TextStream::SetLength(int32_t iLength) {
return m_pStreamImp->SetLength(iLength);
}
-uint16_t CFX_TextStream::GetCodePage() const {
+
+uint16_t CFGAS_TextStream::GetCodePage() const {
return m_wCodePage;
}
-IFX_Stream* CFX_TextStream::CreateSharedStream(uint32_t dwAccess,
- int32_t iOffset,
- int32_t iLength) {
- IFX_Stream* pSR =
+
+IFGAS_Stream* CFGAS_TextStream::CreateSharedStream(uint32_t dwAccess,
+ int32_t iOffset,
+ int32_t iLength) {
+ IFGAS_Stream* pSR =
m_pStreamImp->CreateSharedStream(dwAccess, iOffset, iLength);
- if (!pSR) {
+ if (!pSR)
return nullptr;
- }
- if (dwAccess & FX_STREAMACCESS_Text) {
- return new CFX_TextStream(pSR, true);
- }
+
+ if (dwAccess & FX_STREAMACCESS_Text)
+ return new CFGAS_TextStream(pSR, true);
+
return pSR;
}
-int32_t CFX_TextStream::GetBOM(uint8_t bom[4]) const {
- if (m_wBOMLength < 1) {
+
+int32_t CFGAS_TextStream::GetBOM(uint8_t bom[4]) const {
+ if (m_wBOMLength < 1)
return 0;
- }
+
*(uint32_t*)bom = m_dwBOM;
return m_wBOMLength;
}
-uint16_t CFX_TextStream::SetCodePage(uint16_t wCodePage) {
- if (m_wBOMLength > 0) {
+
+uint16_t CFGAS_TextStream::SetCodePage(uint16_t wCodePage) {
+ if (m_wBOMLength > 0)
return m_wCodePage;
- }
+
uint16_t v = m_wCodePage;
m_wCodePage = wCodePage;
return v;
}
-int32_t CFX_TextStream::ReadString(FX_WCHAR* pStr,
- int32_t iMaxLength,
- bool& bEOS) {
+
+int32_t CFGAS_TextStream::ReadString(FX_WCHAR* pStr,
+ int32_t iMaxLength,
+ bool& bEOS) {
ASSERT(pStr && iMaxLength > 0);
if (!m_pStreamImp) {
return -1;
@@ -1088,11 +1107,12 @@ int32_t CFX_TextStream::ReadString(FX_WCHAR* pStr,
bEOS = m_pStreamImp->IsEOF();
return iMaxLength;
}
-int32_t CFX_TextStream::WriteString(const FX_WCHAR* pStr, int32_t iLength) {
+
+int32_t CFGAS_TextStream::WriteString(const FX_WCHAR* pStr, int32_t iLength) {
ASSERT(pStr && iLength > 0);
- if ((m_pStreamImp->GetAccessModes() & FX_STREAMACCESS_Write) == 0) {
+ if ((m_pStreamImp->GetAccessModes() & FX_STREAMACCESS_Write) == 0)
return -1;
- }
+
if (m_wCodePage == FX_CODEPAGE_UTF8) {
int32_t len = iLength;
CFX_UTF8Encoder encoder;
@@ -1105,7 +1125,8 @@ int32_t CFX_TextStream::WriteString(const FX_WCHAR* pStr, int32_t iLength) {
}
return iLength;
}
-CFX_Stream::CFX_Stream()
+
+CFGAS_Stream::CFGAS_Stream()
: m_eStreamType(FX_SREAMTYPE_Unknown),
m_pStreamImp(nullptr),
m_dwAccess(0),
@@ -1115,19 +1136,19 @@ CFX_Stream::CFX_Stream()
m_iLength(0),
m_iRefCount(1) {}
-CFX_Stream::~CFX_Stream() {
+CFGAS_Stream::~CFGAS_Stream() {
if (m_eStreamType != FX_STREAMTYPE_Stream)
delete m_pStreamImp;
}
-bool CFX_Stream::LoadFile(const FX_WCHAR* pszSrcFileName, uint32_t dwAccess) {
+bool CFGAS_Stream::LoadFile(const FX_WCHAR* pszSrcFileName, uint32_t dwAccess) {
if (m_eStreamType != FX_SREAMTYPE_Unknown || m_pStreamImp)
return false;
if (!pszSrcFileName || FXSYS_wcslen(pszSrcFileName) < 1)
return false;
- std::unique_ptr<CFX_FileStreamImp> pImp(new CFX_FileStreamImp());
+ std::unique_ptr<CFGAS_FileStreamImp> pImp(new CFGAS_FileStreamImp());
if (!pImp->LoadFile(pszSrcFileName, dwAccess))
return false;
@@ -1138,15 +1159,15 @@ bool CFX_Stream::LoadFile(const FX_WCHAR* pszSrcFileName, uint32_t dwAccess) {
return true;
}
-bool CFX_Stream::LoadFileRead(IFX_SeekableReadStream* pFileRead,
- uint32_t dwAccess) {
+bool CFGAS_Stream::LoadFileRead(IFX_SeekableReadStream* pFileRead,
+ uint32_t dwAccess) {
if (m_eStreamType != FX_SREAMTYPE_Unknown || m_pStreamImp)
return false;
if (!pFileRead)
return false;
- std::unique_ptr<CFX_FileReadStreamImp> pImp(new CFX_FileReadStreamImp());
+ std::unique_ptr<CFGAS_FileReadStreamImp> pImp(new CFGAS_FileReadStreamImp());
if (!pImp->LoadFileRead(pFileRead, dwAccess))
return false;
@@ -1157,15 +1178,16 @@ bool CFX_Stream::LoadFileRead(IFX_SeekableReadStream* pFileRead,
return true;
}
-bool CFX_Stream::LoadFileWrite(IFX_SeekableWriteStream* pFileWrite,
- uint32_t dwAccess) {
+bool CFGAS_Stream::LoadFileWrite(IFX_SeekableWriteStream* pFileWrite,
+ uint32_t dwAccess) {
if (m_eStreamType != FX_SREAMTYPE_Unknown || m_pStreamImp)
return false;
if (!pFileWrite)
return false;
- std::unique_ptr<CFX_FileWriteStreamImp> pImp(new CFX_FileWriteStreamImp());
+ std::unique_ptr<CFGAS_FileWriteStreamImp> pImp(
+ new CFGAS_FileWriteStreamImp());
if (!pImp->LoadFileWrite(pFileWrite, dwAccess))
return false;
@@ -1176,16 +1198,16 @@ bool CFX_Stream::LoadFileWrite(IFX_SeekableWriteStream* pFileWrite,
return true;
}
-bool CFX_Stream::LoadBuffer(uint8_t* pData,
- int32_t iTotalSize,
- uint32_t dwAccess) {
+bool CFGAS_Stream::LoadBuffer(uint8_t* pData,
+ int32_t iTotalSize,
+ uint32_t dwAccess) {
if (m_eStreamType != FX_SREAMTYPE_Unknown || m_pStreamImp)
return false;
if (!pData || iTotalSize < 1)
return false;
- std::unique_ptr<CFX_BufferStreamImp> pImp(new CFX_BufferStreamImp());
+ std::unique_ptr<CFGAS_BufferStreamImp> pImp(new CFGAS_BufferStreamImp());
if (!pImp->LoadBuffer(pData, iTotalSize, dwAccess))
return false;
@@ -1196,17 +1218,18 @@ bool CFX_Stream::LoadBuffer(uint8_t* pData,
return true;
}
-bool CFX_Stream::LoadBufferRead(IFX_BufferedReadStream* pBufferRead,
- int32_t iFileSize,
- uint32_t dwAccess,
- bool bReleaseBufferRead) {
+bool CFGAS_Stream::LoadBufferRead(IFX_BufferedReadStream* pBufferRead,
+ int32_t iFileSize,
+ uint32_t dwAccess,
+ bool bReleaseBufferRead) {
if (m_eStreamType != FX_SREAMTYPE_Unknown || m_pStreamImp)
return false;
if (!pBufferRead)
return false;
- std::unique_ptr<CFX_BufferReadStreamImp> pImp(new CFX_BufferReadStreamImp);
+ std::unique_ptr<CFGAS_BufferReadStreamImp> pImp(
+ new CFGAS_BufferReadStreamImp);
if (!pImp->LoadBufferRead(pBufferRead, iFileSize, dwAccess,
bReleaseBufferRead))
return false;
@@ -1218,21 +1241,21 @@ bool CFX_Stream::LoadBufferRead(IFX_BufferedReadStream* pBufferRead,
return true;
}
-void CFX_Stream::Release() {
+void CFGAS_Stream::Release() {
if (--m_iRefCount < 1) {
delete this;
}
}
-IFX_Stream* CFX_Stream::Retain() {
+IFGAS_Stream* CFGAS_Stream::Retain() {
m_iRefCount++;
return this;
}
-uint32_t CFX_Stream::GetAccessModes() const {
+uint32_t CFGAS_Stream::GetAccessModes() const {
return m_dwAccess;
}
-int32_t CFX_Stream::GetLength() const {
+int32_t CFGAS_Stream::GetLength() const {
if (!m_pStreamImp) {
return -1;
}
@@ -1242,7 +1265,7 @@ int32_t CFX_Stream::GetLength() const {
}
return m_iLength;
}
-int32_t CFX_Stream::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) {
+int32_t CFGAS_Stream::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) {
if (!m_pStreamImp) {
return -1;
}
@@ -1267,7 +1290,7 @@ int32_t CFX_Stream::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) {
}
return m_iPosition - m_iStart;
}
-int32_t CFX_Stream::GetPosition() {
+int32_t CFGAS_Stream::GetPosition() {
if (!m_pStreamImp) {
return -1;
}
@@ -1277,7 +1300,7 @@ int32_t CFX_Stream::GetPosition() {
}
return m_iPosition - m_iStart;
}
-bool CFX_Stream::IsEOF() const {
+bool CFGAS_Stream::IsEOF() const {
if (!m_pStreamImp) {
return true;
}
@@ -1287,7 +1310,7 @@ bool CFX_Stream::IsEOF() const {
}
return m_iPosition >= m_iStart + m_iLength;
}
-int32_t CFX_Stream::ReadData(uint8_t* pBuffer, int32_t iBufferSize) {
+int32_t CFGAS_Stream::ReadData(uint8_t* pBuffer, int32_t iBufferSize) {
ASSERT(pBuffer && iBufferSize > 0);
if (!m_pStreamImp) {
return -1;
@@ -1303,7 +1326,9 @@ int32_t CFX_Stream::ReadData(uint8_t* pBuffer, int32_t iBufferSize) {
m_iPosition = m_pStreamImp->GetPosition();
return iLen;
}
-int32_t CFX_Stream::ReadString(FX_WCHAR* pStr, int32_t iMaxLength, bool& bEOS) {
+int32_t CFGAS_Stream::ReadString(FX_WCHAR* pStr,
+ int32_t iMaxLength,
+ bool& bEOS) {
ASSERT(pStr && iMaxLength > 0);
if (!m_pStreamImp) {
return -1;
@@ -1325,7 +1350,7 @@ int32_t CFX_Stream::ReadString(FX_WCHAR* pStr, int32_t iMaxLength, bool& bEOS) {
return iLen;
}
-int32_t CFX_Stream::WriteData(const uint8_t* pBuffer, int32_t iBufferSize) {
+int32_t CFGAS_Stream::WriteData(const uint8_t* pBuffer, int32_t iBufferSize) {
ASSERT(pBuffer && iBufferSize > 0);
if (!m_pStreamImp) {
return -1;
@@ -1351,7 +1376,7 @@ int32_t CFX_Stream::WriteData(const uint8_t* pBuffer, int32_t iBufferSize) {
}
return iLen;
}
-int32_t CFX_Stream::WriteString(const FX_WCHAR* pStr, int32_t iLength) {
+int32_t CFGAS_Stream::WriteString(const FX_WCHAR* pStr, int32_t iLength) {
ASSERT(pStr && iLength > 0);
if (!m_pStreamImp) {
return -1;
@@ -1377,7 +1402,7 @@ int32_t CFX_Stream::WriteString(const FX_WCHAR* pStr, int32_t iLength) {
}
return iLen;
}
-void CFX_Stream::Flush() {
+void CFGAS_Stream::Flush() {
if (!m_pStreamImp) {
return;
}
@@ -1386,7 +1411,7 @@ void CFX_Stream::Flush() {
}
m_pStreamImp->Flush();
}
-bool CFX_Stream::SetLength(int32_t iLength) {
+bool CFGAS_Stream::SetLength(int32_t iLength) {
if (!m_pStreamImp) {
return false;
}
@@ -1395,33 +1420,33 @@ bool CFX_Stream::SetLength(int32_t iLength) {
}
return m_pStreamImp->SetLength(iLength);
}
-int32_t CFX_Stream::GetBOM(uint8_t bom[4]) const {
+int32_t CFGAS_Stream::GetBOM(uint8_t bom[4]) const {
if (!m_pStreamImp) {
return -1;
}
return 0;
}
-uint16_t CFX_Stream::GetCodePage() const {
+uint16_t CFGAS_Stream::GetCodePage() const {
#if _FX_ENDIAN_ == _FX_LITTLE_ENDIAN_
return FX_CODEPAGE_UTF16LE;
#else
return FX_CODEPAGE_UTF16BE;
#endif
}
-uint16_t CFX_Stream::SetCodePage(uint16_t wCodePage) {
+uint16_t CFGAS_Stream::SetCodePage(uint16_t wCodePage) {
#if _FX_ENDIAN_ == _FX_LITTLE_ENDIAN_
return FX_CODEPAGE_UTF16LE;
#else
return FX_CODEPAGE_UTF16BE;
#endif
}
-IFX_Stream* CFX_Stream::CreateSharedStream(uint32_t dwAccess,
- int32_t iOffset,
- int32_t iLength) {
+IFGAS_Stream* CFGAS_Stream::CreateSharedStream(uint32_t dwAccess,
+ int32_t iOffset,
+ int32_t iLength) {
ASSERT(iLength > 0);
- if (!m_pStreamImp) {
+ if (!m_pStreamImp)
return nullptr;
- }
+
if ((m_dwAccess & FX_STREAMACCESS_Text) != 0 &&
(dwAccess & FX_STREAMACCESS_Text) == 0) {
return nullptr;
@@ -1432,14 +1457,14 @@ IFX_Stream* CFX_Stream::CreateSharedStream(uint32_t dwAccess,
}
int32_t iStart = m_iStart + iOffset;
int32_t iTotal = m_iStart + m_iLength;
- if (iStart < m_iStart || iStart >= iTotal) {
+ if (iStart < m_iStart || iStart >= iTotal)
return nullptr;
- }
+
int32_t iEnd = iStart + iLength;
- if (iEnd < iStart || iEnd > iTotal) {
+ if (iEnd < iStart || iEnd > iTotal)
return nullptr;
- }
- CFX_Stream* pShared = new CFX_Stream;
+
+ CFGAS_Stream* pShared = new CFGAS_Stream;
pShared->m_eStreamType = FX_STREAMTYPE_Stream;
pShared->m_pStreamImp = m_pStreamImp;
pShared->m_dwAccess = dwAccess;
@@ -1447,17 +1472,17 @@ IFX_Stream* CFX_Stream::CreateSharedStream(uint32_t dwAccess,
pShared->m_iPosition = iStart;
pShared->m_iStart = iStart;
pShared->m_iLength = (dwAccess & FX_STREAMACCESS_Write) != 0 ? 0 : iLength;
- if (dwAccess & FX_STREAMACCESS_Text) {
- return IFX_Stream::CreateTextStream(pShared, true);
- }
+ if (dwAccess & FX_STREAMACCESS_Text)
+ return IFGAS_Stream::CreateTextStream(pShared, true);
+
return pShared;
}
-IFX_SeekableReadStream* IFX_Stream::MakeSeekableReadStream() {
+IFX_SeekableReadStream* IFGAS_Stream::MakeSeekableReadStream() {
return new CFGAS_FileRead(this, false);
}
-CFGAS_FileRead::CFGAS_FileRead(IFX_Stream* pStream, bool bReleaseStream)
+CFGAS_FileRead::CFGAS_FileRead(IFGAS_Stream* pStream, bool bReleaseStream)
: m_bReleaseStream(bReleaseStream), m_pStream(pStream) {
ASSERT(m_pStream);
}
diff --git a/xfa/fgas/crt/fgas_stream.h b/xfa/fgas/crt/fgas_stream.h
index 413927d22f..bd065ff308 100644
--- a/xfa/fgas/crt/fgas_stream.h
+++ b/xfa/fgas/crt/fgas_stream.h
@@ -26,25 +26,25 @@ enum FX_STREAMSEEK {
FX_STREAMSEEK_End,
};
-class IFX_Stream {
+class IFGAS_Stream {
public:
- 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);
- static IFX_Stream* CreateTextStream(IFX_Stream* pBaseStream,
- bool bDeleteOnRelease);
+ static IFGAS_Stream* CreateStream(IFX_SeekableReadStream* pFileRead,
+ uint32_t dwAccess);
+ static IFGAS_Stream* CreateStream(IFX_SeekableWriteStream* pFileWrite,
+ uint32_t dwAccess);
+ static IFGAS_Stream* CreateStream(uint8_t* pData,
+ int32_t length,
+ uint32_t dwAccess);
+ static IFGAS_Stream* CreateTextStream(IFGAS_Stream* pBaseStream,
+ bool bDeleteOnRelease);
- virtual ~IFX_Stream() {}
+ virtual ~IFGAS_Stream() {}
virtual void Release() = 0;
- virtual IFX_Stream* Retain() = 0;
+ virtual IFGAS_Stream* Retain() = 0;
- virtual IFX_Stream* CreateSharedStream(uint32_t dwAccess,
- int32_t iOffset,
- int32_t iLength) = 0;
+ virtual IFGAS_Stream* CreateSharedStream(uint32_t dwAccess,
+ int32_t iOffset,
+ int32_t iLength) = 0;
virtual uint32_t GetAccessModes() const = 0;
virtual int32_t GetLength() const = 0;
diff --git a/xfa/fgas/font/cfgas_gefont.cpp b/xfa/fgas/font/cfgas_gefont.cpp
index c1dfa2b5b9..1d4624fb0d 100644
--- a/xfa/fgas/font/cfgas_gefont.cpp
+++ b/xfa/fgas/font/cfgas_gefont.cpp
@@ -72,7 +72,7 @@ CFGAS_GEFont* CFGAS_GEFont::LoadFont(const uint8_t* pBuffer,
}
// static
-CFGAS_GEFont* CFGAS_GEFont::LoadFont(IFX_Stream* pFontStream,
+CFGAS_GEFont* CFGAS_GEFont::LoadFont(IFGAS_Stream* pFontStream,
CFGAS_FontMgr* pFontMgr,
bool bSaveStream) {
CFGAS_GEFont* pFont = new CFGAS_GEFont(pFontMgr);
@@ -203,7 +203,8 @@ bool CFGAS_GEFont::LoadFontInternal(const uint8_t* pBuffer, int32_t length) {
return InitFont();
}
-bool CFGAS_GEFont::LoadFontInternal(IFX_Stream* pFontStream, bool bSaveStream) {
+bool CFGAS_GEFont::LoadFontInternal(IFGAS_Stream* pFontStream,
+ bool bSaveStream) {
if (m_pFont || m_pFileRead || !pFontStream || pFontStream->GetLength() < 1)
return false;
if (bSaveStream)
diff --git a/xfa/fgas/font/cfgas_gefont.h b/xfa/fgas/font/cfgas_gefont.h
index acad51af79..2b4179e711 100644
--- a/xfa/fgas/font/cfgas_gefont.h
+++ b/xfa/fgas/font/cfgas_gefont.h
@@ -33,7 +33,7 @@ class CFGAS_GEFont {
static CFGAS_GEFont* LoadFont(const uint8_t* pBuffer,
int32_t iLength,
CFGAS_FontMgr* pFontMgr);
- static CFGAS_GEFont* LoadFont(IFX_Stream* pFontStream,
+ static CFGAS_GEFont* LoadFont(IFGAS_Stream* pFontStream,
CFGAS_FontMgr* pFontMgr,
bool bSaveStream);
#endif
@@ -69,7 +69,7 @@ class CFGAS_GEFont {
uint32_t dwFontStyles,
uint16_t wCodePage);
bool LoadFontInternal(const uint8_t* pBuffer, int32_t length);
- bool LoadFontInternal(IFX_Stream* pFontStream, bool bSaveStream);
+ bool LoadFontInternal(IFGAS_Stream* pFontStream, bool bSaveStream);
#endif
bool LoadFontInternal(CFX_Font* pExternalFont);
bool LoadFontInternal(std::unique_ptr<CFX_Font> pInternalFont);
@@ -97,7 +97,7 @@ class CFGAS_GEFont {
CFGAS_FontMgr* const m_pFontMgr;
int32_t m_iRefCount;
bool m_bExternalFont;
- std::unique_ptr<IFX_Stream, ReleaseDeleter<IFX_Stream>> m_pStream;
+ std::unique_ptr<IFGAS_Stream, ReleaseDeleter<IFGAS_Stream>> m_pStream;
std::unique_ptr<IFX_SeekableReadStream,
ReleaseDeleter<IFX_SeekableReadStream>>
m_pFileRead;
diff --git a/xfa/fxfa/parser/cxfa_dataexporter.cpp b/xfa/fxfa/parser/cxfa_dataexporter.cpp
index 1ec9c44de6..f97e8a34ed 100644
--- a/xfa/fxfa/parser/cxfa_dataexporter.cpp
+++ b/xfa/fxfa/parser/cxfa_dataexporter.cpp
@@ -198,7 +198,7 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode,
break;
IFX_MemoryStream* pMemStream = IFX_MemoryStream::Create(true);
- IFX_Stream* pTempStream = IFX_Stream::CreateStream(
+ IFGAS_Stream* pTempStream = IFGAS_Stream::CreateStream(
(IFX_SeekableWriteStream*)pMemStream, FX_STREAMACCESS_Text |
FX_STREAMACCESS_Write |
FX_STREAMACCESS_Append);
@@ -317,7 +317,7 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode,
}
void RegenerateFormFile_Container(CXFA_Node* pNode,
- IFX_Stream* pStream,
+ IFGAS_Stream* pStream,
bool bSaveXML = false) {
XFA_Element eType = pNode->GetElementType();
if (eType == XFA_Element::Field || eType == XFA_Element::Draw ||
@@ -371,7 +371,7 @@ void RegenerateFormFile_Container(CXFA_Node* pNode,
} // namespace
void XFA_DataExporter_RegenerateFormFile(CXFA_Node* pNode,
- IFX_Stream* pStream,
+ IFGAS_Stream* pStream,
const FX_CHAR* pChecksum,
bool bSaveXML) {
if (pNode->IsModelNode()) {
@@ -456,7 +456,7 @@ bool CXFA_DataExporter::Export(IFX_SeekableWriteStream* pWrite,
ASSERT(false);
return false;
}
- IFX_Stream* pStream = IFX_Stream::CreateStream(
+ IFGAS_Stream* pStream = IFGAS_Stream::CreateStream(
pWrite,
FX_STREAMACCESS_Text | FX_STREAMACCESS_Write | FX_STREAMACCESS_Append);
if (!pStream)
@@ -468,7 +468,7 @@ bool CXFA_DataExporter::Export(IFX_SeekableWriteStream* pWrite,
return bRet;
}
-bool CXFA_DataExporter::Export(IFX_Stream* pStream,
+bool CXFA_DataExporter::Export(IFGAS_Stream* pStream,
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 41f32a2fad..8496e0d9a6 100644
--- a/xfa/fxfa/parser/cxfa_dataexporter.h
+++ b/xfa/fxfa/parser/cxfa_dataexporter.h
@@ -12,7 +12,7 @@
class CXFA_Document;
class CXFA_Node;
class IFX_SeekableWriteStream;
-class IFX_Stream;
+class IFGAS_Stream;
class CXFA_DataExporter {
public:
@@ -25,7 +25,7 @@ class CXFA_DataExporter {
const FX_CHAR* pChecksum);
protected:
- bool Export(IFX_Stream* pStream,
+ bool Export(IFGAS_Stream* pStream,
CXFA_Node* pNode,
uint32_t dwFlag,
const FX_CHAR* pChecksum);
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 05ddcfc71b..16062f7b6f 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -1443,8 +1443,8 @@ void CXFA_Node::Script_NodeClass_SaveXML(CFXJSE_Arguments* pArguments) {
}
std::unique_ptr<IFX_MemoryStream, ReleaseDeleter<IFX_MemoryStream>>
pMemoryStream(IFX_MemoryStream::Create(true));
- std::unique_ptr<IFX_Stream, ReleaseDeleter<IFX_Stream>> pStream(
- IFX_Stream::CreateStream(
+ std::unique_ptr<IFGAS_Stream, ReleaseDeleter<IFGAS_Stream>> pStream(
+ IFGAS_Stream::CreateStream(
static_cast<IFX_SeekableWriteStream*>(pMemoryStream.get()),
FX_STREAMACCESS_Text | FX_STREAMACCESS_Write |
FX_STREAMACCESS_Append));
diff --git a/xfa/fxfa/parser/cxfa_simple_parser.cpp b/xfa/fxfa/parser/cxfa_simple_parser.cpp
index 4599b1c4fc..a9025fa42a 100644
--- a/xfa/fxfa/parser/cxfa_simple_parser.cpp
+++ b/xfa/fxfa/parser/cxfa_simple_parser.cpp
@@ -281,7 +281,7 @@ int32_t CXFA_SimpleParser::StartParse(IFX_SeekableReadStream* pStream,
XFA_XDPPACKET ePacketID) {
CloseParser();
m_pFileRead = pStream;
- m_pStream.reset(IFX_Stream::CreateStream(
+ m_pStream.reset(IFGAS_Stream::CreateStream(
pStream, FX_STREAMACCESS_Read | FX_STREAMACCESS_Text));
if (!m_pStream)
return XFA_PARSESTATUS_StreamErr;
@@ -325,7 +325,7 @@ int32_t CXFA_SimpleParser::ParseXMLData(const CFX_WideString& wsXML,
CloseParser();
pXMLNode = nullptr;
- std::unique_ptr<IFX_Stream> pStream(new CXFA_WideTextRead(wsXML));
+ std::unique_ptr<IFGAS_Stream> pStream(new CXFA_WideTextRead(wsXML));
m_pXMLDoc.reset(new CFDE_XMLDoc);
CXFA_XMLParser* pParser =
new CXFA_XMLParser(m_pXMLDoc->GetRoot(), pStream.get());
diff --git a/xfa/fxfa/parser/cxfa_simple_parser.h b/xfa/fxfa/parser/cxfa_simple_parser.h
index db6765f400..fa9fdb3014 100644
--- a/xfa/fxfa/parser/cxfa_simple_parser.h
+++ b/xfa/fxfa/parser/cxfa_simple_parser.h
@@ -17,7 +17,7 @@ class CXFA_Node;
class CXFA_XMLParser;
class IFX_SeekableReadStream;
class IFX_Pause;
-class IFX_Stream;
+class IFGAS_Stream;
class CXFA_SimpleParser {
public:
@@ -77,7 +77,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;
+ std::unique_ptr<IFGAS_Stream, ReleaseDeleter<IFGAS_Stream>> m_pStream;
IFX_SeekableReadStream* m_pFileRead;
CXFA_Document* m_pFactory;
CXFA_Node* m_pRootNode;
diff --git a/xfa/fxfa/parser/cxfa_widetextread.cpp b/xfa/fxfa/parser/cxfa_widetextread.cpp
index be2de7c9e4..cf03a09e7c 100644
--- a/xfa/fxfa/parser/cxfa_widetextread.cpp
+++ b/xfa/fxfa/parser/cxfa_widetextread.cpp
@@ -19,7 +19,7 @@ void CXFA_WideTextRead::Release() {
delete this;
}
-IFX_Stream* CXFA_WideTextRead::Retain() {
+IFGAS_Stream* CXFA_WideTextRead::Retain() {
m_iRefCount++;
return this;
}
@@ -98,9 +98,9 @@ uint16_t CXFA_WideTextRead::SetCodePage(uint16_t wCodePage) {
return GetCodePage();
}
-IFX_Stream* CXFA_WideTextRead::CreateSharedStream(uint32_t dwAccess,
- int32_t iOffset,
- int32_t iLength) {
+IFGAS_Stream* CXFA_WideTextRead::CreateSharedStream(uint32_t dwAccess,
+ int32_t iOffset,
+ int32_t iLength) {
return nullptr;
}
diff --git a/xfa/fxfa/parser/cxfa_widetextread.h b/xfa/fxfa/parser/cxfa_widetextread.h
index 3a39061079..bea3ab8fba 100644
--- a/xfa/fxfa/parser/cxfa_widetextread.h
+++ b/xfa/fxfa/parser/cxfa_widetextread.h
@@ -9,13 +9,13 @@
#include "xfa/fgas/crt/fgas_stream.h"
-class CXFA_WideTextRead : public IFX_Stream {
+class CXFA_WideTextRead : public IFGAS_Stream {
public:
explicit CXFA_WideTextRead(const CFX_WideString& wsBuffer);
- // IFX_Stream
+ // IFGAS_Stream
void Release() override;
- IFX_Stream* Retain() override;
+ IFGAS_Stream* Retain() override;
uint32_t GetAccessModes() const override;
int32_t GetLength() const override;
int32_t Seek(FX_STREAMSEEK eSeek, int32_t iOffset) override;
@@ -30,9 +30,9 @@ class CXFA_WideTextRead : public IFX_Stream {
int32_t GetBOM(uint8_t bom[4]) const override;
uint16_t GetCodePage() const override;
uint16_t SetCodePage(uint16_t wCodePage) override;
- IFX_Stream* CreateSharedStream(uint32_t dwAccess,
- int32_t iOffset,
- int32_t iLength) override;
+ IFGAS_Stream* CreateSharedStream(uint32_t dwAccess,
+ int32_t iOffset,
+ int32_t iLength) override;
CFX_WideString GetSrcText() const;
diff --git a/xfa/fxfa/parser/cxfa_xml_parser.cpp b/xfa/fxfa/parser/cxfa_xml_parser.cpp
index 70e0d7cc9e..ac378f0b95 100644
--- a/xfa/fxfa/parser/cxfa_xml_parser.cpp
+++ b/xfa/fxfa/parser/cxfa_xml_parser.cpp
@@ -6,7 +6,7 @@
#include "xfa/fxfa/parser/cxfa_xml_parser.h"
-CXFA_XMLParser::CXFA_XMLParser(CFDE_XMLNode* pRoot, IFX_Stream* pStream)
+CXFA_XMLParser::CXFA_XMLParser(CFDE_XMLNode* pRoot, IFGAS_Stream* pStream)
: m_nElementStart(0),
m_dwCheckStatus(0),
m_dwCurrentCheckStatus(0),
diff --git a/xfa/fxfa/parser/cxfa_xml_parser.h b/xfa/fxfa/parser/cxfa_xml_parser.h
index 59def4be67..cff279453d 100644
--- a/xfa/fxfa/parser/cxfa_xml_parser.h
+++ b/xfa/fxfa/parser/cxfa_xml_parser.h
@@ -11,12 +11,12 @@
#include "xfa/fde/xml/fde_xml_imp.h"
-class IFX_Stream;
+class IFGAS_Stream;
class IFX_Pause;
class CXFA_XMLParser : public CFDE_XMLParser {
public:
- CXFA_XMLParser(CFDE_XMLNode* pRoot, IFX_Stream* pStream);
+ CXFA_XMLParser(CFDE_XMLNode* pRoot, IFGAS_Stream* pStream);
~CXFA_XMLParser() override;
// CFDE_XMLParser
@@ -31,7 +31,7 @@ class CXFA_XMLParser : public CFDE_XMLParser {
protected:
CFDE_XMLNode* m_pRoot;
- IFX_Stream* m_pStream;
+ IFGAS_Stream* m_pStream;
std::unique_ptr<CFDE_XMLSyntaxParser, ReleaseDeleter<CFDE_XMLSyntaxParser>>
m_pParser;
CFDE_XMLNode* m_pParent;
diff --git a/xfa/fxfa/parser/xfa_utils.h b/xfa/fxfa/parser/xfa_utils.h
index 7981704973..961c0a4189 100644
--- a/xfa/fxfa/parser/xfa_utils.h
+++ b/xfa/fxfa/parser/xfa_utils.h
@@ -173,7 +173,7 @@ bool XFA_FieldIsMultiListBox(CXFA_Node* pFieldNode);
void XFA_DataExporter_DealWithDataGroupNode(CXFA_Node* pDataNode);
void XFA_DataExporter_RegenerateFormFile(CXFA_Node* pNode,
- IFX_Stream* pStream,
+ IFGAS_Stream* pStream,
const FX_CHAR* pChecksum = nullptr,
bool bSaveXML = false);