summaryrefslogtreecommitdiff
path: root/xfa/fde/xml
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fde/xml')
-rw-r--r--xfa/fde/xml/cfde_xmldoc.cpp2
-rw-r--r--xfa/fde/xml/cfde_xmldoc.h6
-rw-r--r--xfa/fde/xml/cfde_xmlnode.cpp2
-rw-r--r--xfa/fde/xml/cfde_xmlnode.h4
-rw-r--r--xfa/fde/xml/cfde_xmlparser.cpp2
-rw-r--r--xfa/fde/xml/cfde_xmlparser.h6
-rw-r--r--xfa/fde/xml/cfde_xmlsyntaxparser.cpp8
-rw-r--r--xfa/fde/xml/cfde_xmlsyntaxparser.h6
-rw-r--r--xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp77
9 files changed, 49 insertions, 64 deletions
diff --git a/xfa/fde/xml/cfde_xmldoc.cpp b/xfa/fde/xml/cfde_xmldoc.cpp
index 209ce9c68f..256164c5f8 100644
--- a/xfa/fde/xml/cfde_xmldoc.cpp
+++ b/xfa/fde/xml/cfde_xmldoc.cpp
@@ -47,7 +47,7 @@ void CFDE_XMLDoc::CloseXML() {
m_pXMLParser.reset();
}
-void CFDE_XMLDoc::SaveXMLNode(const CFX_RetainPtr<IFGAS_Stream>& pXMLStream,
+void CFDE_XMLDoc::SaveXMLNode(const CFX_RetainPtr<CFGAS_Stream>& pXMLStream,
CFDE_XMLNode* pINode) {
CFDE_XMLNode* pNode = (CFDE_XMLNode*)pINode;
switch (pNode->GetType()) {
diff --git a/xfa/fde/xml/cfde_xmldoc.h b/xfa/fde/xml/cfde_xmldoc.h
index 6143750428..b84c9c00a0 100644
--- a/xfa/fde/xml/cfde_xmldoc.h
+++ b/xfa/fde/xml/cfde_xmldoc.h
@@ -12,7 +12,7 @@
#include "core/fxcrt/cfx_retain_ptr.h"
#include "xfa/fde/xml/cfde_xmlnode.h"
#include "xfa/fde/xml/cfde_xmlparser.h"
-#include "xfa/fgas/crt/ifgas_stream.h"
+#include "xfa/fgas/crt/cfgas_stream.h"
class CFDE_XMLDoc {
public:
@@ -24,14 +24,14 @@ class CFDE_XMLDoc {
void CloseXML();
CFDE_XMLNode* GetRoot() const { return m_pRoot.get(); }
- void SaveXMLNode(const CFX_RetainPtr<IFGAS_Stream>& pXMLStream,
+ void SaveXMLNode(const CFX_RetainPtr<CFGAS_Stream>& pXMLStream,
CFDE_XMLNode* pNode);
private:
int32_t m_iStatus;
std::unique_ptr<CFDE_XMLNode> m_pRoot;
std::unique_ptr<CFDE_XMLParser> m_pXMLParser;
- CFX_RetainPtr<IFGAS_Stream> m_pStream;
+ CFX_RetainPtr<CFGAS_Stream> m_pStream;
};
#endif // XFA_FDE_XML_CFDE_XMLDOC_H_
diff --git a/xfa/fde/xml/cfde_xmlnode.cpp b/xfa/fde/xml/cfde_xmlnode.cpp
index e4d7880cac..149d18c3d6 100644
--- a/xfa/fde/xml/cfde_xmlnode.cpp
+++ b/xfa/fde/xml/cfde_xmlnode.cpp
@@ -329,7 +329,7 @@ std::unique_ptr<CFDE_XMLNode> CFDE_XMLNode::Clone() {
return nullptr;
}
-void CFDE_XMLNode::SaveXMLNode(const CFX_RetainPtr<IFGAS_Stream>& pXMLStream) {
+void CFDE_XMLNode::SaveXMLNode(const CFX_RetainPtr<CFGAS_Stream>& pXMLStream) {
CFDE_XMLNode* pNode = (CFDE_XMLNode*)this;
switch (pNode->GetType()) {
case FDE_XMLNODE_Instruction: {
diff --git a/xfa/fde/xml/cfde_xmlnode.h b/xfa/fde/xml/cfde_xmlnode.h
index 3cfcd5c980..a04bd8c812 100644
--- a/xfa/fde/xml/cfde_xmlnode.h
+++ b/xfa/fde/xml/cfde_xmlnode.h
@@ -10,7 +10,7 @@
#include <memory>
#include "core/fxcrt/cfx_retain_ptr.h"
-#include "xfa/fgas/crt/ifgas_stream.h"
+#include "xfa/fgas/crt/cfgas_stream.h"
enum FDE_XMLNODETYPE {
FDE_XMLNODE_Unknown = 0,
@@ -64,7 +64,7 @@ class CFDE_XMLNode {
bool InsertNodeItem(CFDE_XMLNode::NodeItem eItem, CFDE_XMLNode* pNode);
CFDE_XMLNode* RemoveNodeItem(CFDE_XMLNode::NodeItem eItem);
- void SaveXMLNode(const CFX_RetainPtr<IFGAS_Stream>& pXMLStream);
+ void SaveXMLNode(const CFX_RetainPtr<CFGAS_Stream>& pXMLStream);
CFDE_XMLNode* m_pParent;
CFDE_XMLNode* m_pChild;
diff --git a/xfa/fde/xml/cfde_xmlparser.cpp b/xfa/fde/xml/cfde_xmlparser.cpp
index 5b8993de1b..c29dfc38ab 100644
--- a/xfa/fde/xml/cfde_xmlparser.cpp
+++ b/xfa/fde/xml/cfde_xmlparser.cpp
@@ -15,7 +15,7 @@
#include "xfa/fde/xml/cfde_xmltext.h"
CFDE_XMLParser::CFDE_XMLParser(CFDE_XMLNode* pParent,
- const CFX_RetainPtr<IFGAS_Stream>& pStream)
+ const CFX_RetainPtr<CFGAS_Stream>& pStream)
: m_nElementStart(0),
m_dwCheckStatus(0),
m_dwCurrentCheckStatus(0),
diff --git a/xfa/fde/xml/cfde_xmlparser.h b/xfa/fde/xml/cfde_xmlparser.h
index 42f590ce21..f1a7888fa7 100644
--- a/xfa/fde/xml/cfde_xmlparser.h
+++ b/xfa/fde/xml/cfde_xmlparser.h
@@ -16,13 +16,13 @@
class CFDE_XMLElement;
class CFDE_XMLNode;
-class IFGAS_Stream;
+class CFGAS_Stream;
class IFX_Pause;
class CFDE_XMLParser {
public:
CFDE_XMLParser(CFDE_XMLNode* pParent,
- const CFX_RetainPtr<IFGAS_Stream>& pStream);
+ const CFX_RetainPtr<CFGAS_Stream>& pStream);
~CFDE_XMLParser();
int32_t DoParser(IFX_Pause* pPause);
@@ -34,7 +34,7 @@ class CFDE_XMLParser {
uint16_t m_dwCurrentCheckStatus;
private:
- CFX_RetainPtr<IFGAS_Stream> m_pStream;
+ CFX_RetainPtr<CFGAS_Stream> m_pStream;
std::unique_ptr<CFDE_XMLSyntaxParser> m_pParser;
CFDE_XMLNode* m_pParent;
CFDE_XMLNode* m_pChild;
diff --git a/xfa/fde/xml/cfde_xmlsyntaxparser.cpp b/xfa/fde/xml/cfde_xmlsyntaxparser.cpp
index 78382058ec..10eefdc012 100644
--- a/xfa/fde/xml/cfde_xmlsyntaxparser.cpp
+++ b/xfa/fde/xml/cfde_xmlsyntaxparser.cpp
@@ -80,7 +80,7 @@ int32_t GetUTF8EncodeLength(const std::vector<wchar_t>& src,
} // namespace
CFDE_XMLSyntaxParser::CFDE_XMLSyntaxParser(
- const CFX_RetainPtr<IFGAS_Stream>& pStream)
+ const CFX_RetainPtr<CFGAS_Stream>& pStream)
: m_pStream(pStream),
m_iXMLPlaneSize(32 * 1024),
m_iCurrentPos(0),
@@ -144,9 +144,9 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
}
m_ParsedChars += m_End;
m_iParsedBytes = m_iCurrentPos;
- if (m_pStream->GetPosition() != m_iCurrentPos) {
- m_pStream->Seek(FX_STREAMSEEK_Begin, m_iCurrentPos);
- }
+ if (m_pStream->GetPosition() != m_iCurrentPos)
+ m_pStream->Seek(CFGAS_Stream::Pos::Begin, m_iCurrentPos);
+
m_iBufferChars =
m_pStream->ReadString(m_Buffer.data(), m_iXMLPlaneSize, &m_bEOS);
iPos = m_pStream->GetPosition();
diff --git a/xfa/fde/xml/cfde_xmlsyntaxparser.h b/xfa/fde/xml/cfde_xmlsyntaxparser.h
index f229cc02b1..aa4e91827e 100644
--- a/xfa/fde/xml/cfde_xmlsyntaxparser.h
+++ b/xfa/fde/xml/cfde_xmlsyntaxparser.h
@@ -14,7 +14,7 @@
#include "core/fxcrt/cfx_retain_ptr.h"
#include "core/fxcrt/fx_string.h"
#include "xfa/fde/xml/cfde_xmlnode.h"
-#include "xfa/fgas/crt/ifgas_stream.h"
+#include "xfa/fgas/crt/cfgas_stream.h"
enum class FDE_XmlSyntaxResult {
None,
@@ -36,7 +36,7 @@ enum class FDE_XmlSyntaxResult {
class CFDE_XMLSyntaxParser {
public:
- explicit CFDE_XMLSyntaxParser(const CFX_RetainPtr<IFGAS_Stream>& pStream);
+ explicit CFDE_XMLSyntaxParser(const CFX_RetainPtr<CFGAS_Stream>& pStream);
~CFDE_XMLSyntaxParser();
FDE_XmlSyntaxResult DoSyntaxParse();
@@ -97,7 +97,7 @@ class CFDE_XMLSyntaxParser {
void ParseTextChar(wchar_t ch);
- CFX_RetainPtr<IFGAS_Stream> m_pStream;
+ CFX_RetainPtr<CFGAS_Stream> m_pStream;
FX_STRSIZE m_iXMLPlaneSize;
int32_t m_iCurrentPos;
int32_t m_iCurrentNodeNum;
diff --git a/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp b/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp
index a45bb1276a..aecb3ee39e 100644
--- a/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp
+++ b/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp
@@ -8,8 +8,8 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/test_support.h"
+#include "xfa/fgas/crt/cfgas_stream.h"
#include "xfa/fgas/crt/fgas_codepage.h"
-#include "xfa/fgas/crt/ifgas_stream.h"
class CFDE_XMLSyntaxParserTest : public pdfium::FPDF_Test {};
@@ -28,9 +28,8 @@ TEST_F(CFDE_XMLSyntaxParserTest, CData) {
L" app.alert(\"Tclams\");\n"
L" ";
- CFX_RetainPtr<IFGAS_Stream> stream =
- IFGAS_Stream::CreateReadStream(IFX_MemoryStream::Create(
- reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)));
+ CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>(
+ reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
stream->SetCodePage(FX_CODEPAGE_UTF8);
CFDE_XMLSyntaxParser parser(stream);
@@ -76,9 +75,8 @@ TEST_F(CFDE_XMLSyntaxParserTest, CDataWithInnerScript) {
L" </script>\n"
L" ";
- CFX_RetainPtr<IFGAS_Stream> stream =
- IFGAS_Stream::CreateReadStream(IFX_MemoryStream::Create(
- reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)));
+ CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>(
+ reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
stream->SetCodePage(FX_CODEPAGE_UTF8);
CFDE_XMLSyntaxParser parser(stream);
@@ -113,9 +111,8 @@ TEST_F(CFDE_XMLSyntaxParserTest, ArrowBangArrow) {
" <!>\n"
"</script>";
- CFX_RetainPtr<IFGAS_Stream> stream =
- IFGAS_Stream::CreateReadStream(IFX_MemoryStream::Create(
- reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)));
+ CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>(
+ reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
stream->SetCodePage(FX_CODEPAGE_UTF8);
CFDE_XMLSyntaxParser parser(stream);
@@ -148,9 +145,8 @@ TEST_F(CFDE_XMLSyntaxParserTest, ArrowBangBracketArrow) {
" <![>\n"
"</script>";
- CFX_RetainPtr<IFGAS_Stream> stream =
- IFGAS_Stream::CreateReadStream(IFX_MemoryStream::Create(
- reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)));
+ CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>(
+ reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
stream->SetCodePage(FX_CODEPAGE_UTF8);
CFDE_XMLSyntaxParser parser(stream);
@@ -178,9 +174,8 @@ TEST_F(CFDE_XMLSyntaxParserTest, IncompleteCData) {
" <![CDATA>\n"
"</script>";
- CFX_RetainPtr<IFGAS_Stream> stream =
- IFGAS_Stream::CreateReadStream(IFX_MemoryStream::Create(
- reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)));
+ CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>(
+ reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
stream->SetCodePage(FX_CODEPAGE_UTF8);
CFDE_XMLSyntaxParser parser(stream);
@@ -208,9 +203,8 @@ TEST_F(CFDE_XMLSyntaxParserTest, UnClosedCData) {
" <![CDATA[\n"
"</script>";
- CFX_RetainPtr<IFGAS_Stream> stream =
- IFGAS_Stream::CreateReadStream(IFX_MemoryStream::Create(
- reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)));
+ CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>(
+ reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
stream->SetCodePage(FX_CODEPAGE_UTF8);
CFDE_XMLSyntaxParser parser(stream);
@@ -238,9 +232,8 @@ TEST_F(CFDE_XMLSyntaxParserTest, EmptyCData) {
" <![CDATA[]]>\n"
"</script>";
- CFX_RetainPtr<IFGAS_Stream> stream =
- IFGAS_Stream::CreateReadStream(IFX_MemoryStream::Create(
- reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)));
+ CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>(
+ reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
stream->SetCodePage(FX_CODEPAGE_UTF8);
CFDE_XMLSyntaxParser parser(stream);
@@ -275,9 +268,8 @@ TEST_F(CFDE_XMLSyntaxParserTest, Comment) {
" <!-- A Comment -->\n"
"</script>";
- CFX_RetainPtr<IFGAS_Stream> stream =
- IFGAS_Stream::CreateReadStream(IFX_MemoryStream::Create(
- reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)));
+ CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>(
+ reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
stream->SetCodePage(FX_CODEPAGE_UTF8);
CFDE_XMLSyntaxParser parser(stream);
@@ -309,9 +301,8 @@ TEST_F(CFDE_XMLSyntaxParserTest, IncorrectCommentStart) {
" <!- A Comment -->\n"
"</script>";
- CFX_RetainPtr<IFGAS_Stream> stream =
- IFGAS_Stream::CreateReadStream(IFX_MemoryStream::Create(
- reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)));
+ CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>(
+ reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
stream->SetCodePage(FX_CODEPAGE_UTF8);
CFDE_XMLSyntaxParser parser(stream);
@@ -343,9 +334,8 @@ TEST_F(CFDE_XMLSyntaxParserTest, CommentEmpty) {
" <!---->\n"
"</script>";
- CFX_RetainPtr<IFGAS_Stream> stream =
- IFGAS_Stream::CreateReadStream(IFX_MemoryStream::Create(
- reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)));
+ CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>(
+ reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
stream->SetCodePage(FX_CODEPAGE_UTF8);
CFDE_XMLSyntaxParser parser(stream);
@@ -377,9 +367,8 @@ TEST_F(CFDE_XMLSyntaxParserTest, CommentThreeDash) {
" <!--->\n"
"</script>";
- CFX_RetainPtr<IFGAS_Stream> stream =
- IFGAS_Stream::CreateReadStream(IFX_MemoryStream::Create(
- reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)));
+ CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>(
+ reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
stream->SetCodePage(FX_CODEPAGE_UTF8);
CFDE_XMLSyntaxParser parser(stream);
@@ -405,9 +394,8 @@ TEST_F(CFDE_XMLSyntaxParserTest, CommentTwoDash) {
" <!-->\n"
"</script>";
- CFX_RetainPtr<IFGAS_Stream> stream =
- IFGAS_Stream::CreateReadStream(IFX_MemoryStream::Create(
- reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)));
+ CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>(
+ reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
stream->SetCodePage(FX_CODEPAGE_UTF8);
CFDE_XMLSyntaxParser parser(stream);
@@ -437,9 +425,8 @@ TEST_F(CFDE_XMLSyntaxParserTest, Entities) {
"&#x0000000000000000000;"
"</script>";
- CFX_RetainPtr<IFGAS_Stream> stream =
- IFGAS_Stream::CreateReadStream(IFX_MemoryStream::Create(
- reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)));
+ CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>(
+ reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
stream->SetCodePage(FX_CODEPAGE_UTF8);
CFDE_XMLSyntaxParser parser(stream);
@@ -469,9 +456,8 @@ TEST_F(CFDE_XMLSyntaxParserTest, EntityOverflowHex) {
"&#xafffffffffffffffffffffffffffffffff;"
"</script>";
- CFX_RetainPtr<IFGAS_Stream> stream =
- IFGAS_Stream::CreateReadStream(IFX_MemoryStream::Create(
- reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)));
+ CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>(
+ reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
stream->SetCodePage(FX_CODEPAGE_UTF8);
CFDE_XMLSyntaxParser parser(stream);
@@ -501,9 +487,8 @@ TEST_F(CFDE_XMLSyntaxParserTest, EntityOverflowDecimal) {
"&#29149102052342342134521341234512351234213452315;"
"</script>";
- CFX_RetainPtr<IFGAS_Stream> stream =
- IFGAS_Stream::CreateReadStream(IFX_MemoryStream::Create(
- reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input)));
+ CFX_RetainPtr<CFGAS_Stream> stream = pdfium::MakeRetain<CFGAS_Stream>(
+ reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
stream->SetCodePage(FX_CODEPAGE_UTF8);
CFDE_XMLSyntaxParser parser(stream);