summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fde/xml/cfde_xmldoc.h3
-rw-r--r--xfa/fde/xml/cfde_xmlparser.cpp28
-rw-r--r--xfa/fde/xml/cfde_xmlsyntaxparser.cpp3
-rw-r--r--xfa/fde/xml/cfde_xmlsyntaxparser.h28
-rw-r--r--xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp269
5 files changed, 109 insertions, 222 deletions
diff --git a/xfa/fde/xml/cfde_xmldoc.h b/xfa/fde/xml/cfde_xmldoc.h
index 3eb07a87e1..6143750428 100644
--- a/xfa/fde/xml/cfde_xmldoc.h
+++ b/xfa/fde/xml/cfde_xmldoc.h
@@ -20,8 +20,9 @@ class CFDE_XMLDoc {
~CFDE_XMLDoc();
bool LoadXML(std::unique_ptr<CFDE_XMLParser> pXMLParser);
- int32_t DoLoad(IFX_Pause* pPause = nullptr);
+ int32_t DoLoad(IFX_Pause* pPause);
void CloseXML();
+
CFDE_XMLNode* GetRoot() const { return m_pRoot.get(); }
void SaveXMLNode(const CFX_RetainPtr<IFGAS_Stream>& pXMLStream,
CFDE_XMLNode* pNode);
diff --git a/xfa/fde/xml/cfde_xmlparser.cpp b/xfa/fde/xml/cfde_xmlparser.cpp
index ad7b9e1a6f..f4d2a0f113 100644
--- a/xfa/fde/xml/cfde_xmlparser.cpp
+++ b/xfa/fde/xml/cfde_xmlparser.cpp
@@ -26,7 +26,7 @@ CFDE_XMLParser::CFDE_XMLParser(CFDE_XMLNode* pParent,
m_syntaxParserResult(FDE_XmlSyntaxResult::None) {
ASSERT(m_pParent && m_pStream);
m_NodeStack.push(m_pParent);
- m_pParser->Init(m_pStream, 32 * 1024, 1024 * 1024);
+ m_pParser->Init(m_pStream, 32 * 1024);
}
CFDE_XMLParser::~CFDE_XMLParser() {}
@@ -63,7 +63,7 @@ int32_t CFDE_XMLParser::DoParser(IFX_Pause* pPause) {
m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
break;
}
- m_pParser->GetTagName(m_ws1);
+ m_ws1 = m_pParser->GetTagName();
m_ws2 = static_cast<CFDE_XMLElement*>(m_pChild)->GetName();
if (m_ws1.GetLength() > 0 && m_ws1 != m_ws2) {
m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
@@ -85,7 +85,7 @@ int32_t CFDE_XMLParser::DoParser(IFX_Pause* pPause) {
iCount++;
break;
case FDE_XmlSyntaxResult::TargetName:
- m_pParser->GetTargetName(m_ws1);
+ m_ws1 = m_pParser->GetTargetName();
if (m_ws1 == L"originalXFAVersion" || m_ws1 == L"acrobat") {
m_pChild = new CFDE_XMLInstruction(m_ws1);
m_pParent->InsertChildNode(m_pChild);
@@ -95,7 +95,7 @@ int32_t CFDE_XMLParser::DoParser(IFX_Pause* pPause) {
m_ws1.clear();
break;
case FDE_XmlSyntaxResult::TagName:
- m_pParser->GetTagName(m_ws1);
+ m_ws1 = m_pParser->GetTagName();
m_pChild = new CFDE_XMLElement(m_ws1);
m_pParent->InsertChildNode(m_pChild);
m_NodeStack.push(m_pChild);
@@ -118,25 +118,24 @@ int32_t CFDE_XMLParser::DoParser(IFX_Pause* pPause) {
}
break;
case FDE_XmlSyntaxResult::AttriName:
- m_pParser->GetAttributeName(m_ws1);
+ m_ws1 = m_pParser->GetAttributeName();
break;
case FDE_XmlSyntaxResult::AttriValue:
if (m_pChild) {
- m_pParser->GetAttributeName(m_ws2);
- if (m_pChild->GetType() == FDE_XMLNODE_Element) {
+ m_ws2 = m_pParser->GetAttributeName();
+ if (m_pChild->GetType() == FDE_XMLNODE_Element)
static_cast<CFDE_XMLElement*>(m_pChild)->SetString(m_ws1, m_ws2);
- }
}
m_ws1.clear();
break;
case FDE_XmlSyntaxResult::Text:
- m_pParser->GetTextData(m_ws1);
+ m_ws1 = m_pParser->GetTextData();
m_pChild = new CFDE_XMLText(m_ws1);
m_pParent->InsertChildNode(m_pChild);
m_pChild = m_pParent;
break;
case FDE_XmlSyntaxResult::CData:
- m_pParser->GetTextData(m_ws1);
+ m_ws1 = m_pParser->GetTextData();
m_pChild = new CFDE_XMLCharData(m_ws1);
m_pParent->InsertChildNode(m_pChild);
m_pChild = m_pParent;
@@ -147,11 +146,10 @@ int32_t CFDE_XMLParser::DoParser(IFX_Pause* pPause) {
m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
break;
}
- if (!m_ws1.IsEmpty()) {
- static_cast<CFDE_XMLInstruction*>(m_pChild)->AppendData(m_ws1);
- }
- m_pParser->GetTargetData(m_ws1);
- static_cast<CFDE_XMLInstruction*>(m_pChild)->AppendData(m_ws1);
+ auto* instruction = static_cast<CFDE_XMLInstruction*>(m_pChild);
+ if (!m_ws1.IsEmpty())
+ instruction->AppendData(m_ws1);
+ instruction->AppendData(m_pParser->GetTargetData());
}
m_ws1.clear();
break;
diff --git a/xfa/fde/xml/cfde_xmlsyntaxparser.cpp b/xfa/fde/xml/cfde_xmlsyntaxparser.cpp
index b4f9a211a7..93f8f1d51f 100644
--- a/xfa/fde/xml/cfde_xmlsyntaxparser.cpp
+++ b/xfa/fde/xml/cfde_xmlsyntaxparser.cpp
@@ -104,8 +104,7 @@ CFDE_XMLSyntaxParser::CFDE_XMLSyntaxParser()
}
void CFDE_XMLSyntaxParser::Init(const CFX_RetainPtr<IFGAS_Stream>& pStream,
- int32_t iXMLPlaneSize,
- int32_t iTextDataSize) {
+ int32_t iXMLPlaneSize) {
ASSERT(!m_pStream && !m_pBuffer);
ASSERT(pStream && iXMLPlaneSize > 0);
int32_t iStreamLength = pStream->GetLength();
diff --git a/xfa/fde/xml/cfde_xmlsyntaxparser.h b/xfa/fde/xml/cfde_xmlsyntaxparser.h
index 4f707dc5de..9140a8345f 100644
--- a/xfa/fde/xml/cfde_xmlsyntaxparser.h
+++ b/xfa/fde/xml/cfde_xmlsyntaxparser.h
@@ -38,9 +38,7 @@ class CFDE_XMLSyntaxParser {
CFDE_XMLSyntaxParser();
~CFDE_XMLSyntaxParser();
- void Init(const CFX_RetainPtr<IFGAS_Stream>& pStream,
- int32_t iXMLPlaneSize,
- int32_t iTextDataSize = 256);
+ void Init(const CFX_RetainPtr<IFGAS_Stream>& pStream, int32_t iXMLPlaneSize);
FDE_XmlSyntaxResult DoSyntaxParse();
@@ -52,28 +50,28 @@ class CFDE_XMLSyntaxParser {
int32_t GetCurrentNodeNumber() const { return m_iCurrentNodeNum; }
int32_t GetLastNodeNumber() const { return m_iLastNodeNum; }
- void GetTargetName(CFX_WideString& wsTarget) const {
- wsTarget = m_BlockBuffer.GetTextData(0, m_iTextDataLength);
+ CFX_WideString GetTargetName() const {
+ return m_BlockBuffer.GetTextData(0, m_iTextDataLength);
}
- void GetTagName(CFX_WideString& wsTag) const {
- wsTag = m_BlockBuffer.GetTextData(0, m_iTextDataLength);
+ CFX_WideString GetTagName() const {
+ return m_BlockBuffer.GetTextData(0, m_iTextDataLength);
}
- void GetAttributeName(CFX_WideString& wsAttriName) const {
- wsAttriName = m_BlockBuffer.GetTextData(0, m_iTextDataLength);
+ CFX_WideString GetAttributeName() const {
+ return m_BlockBuffer.GetTextData(0, m_iTextDataLength);
}
- void GetAttributeValue(CFX_WideString& wsAttriValue) const {
- wsAttriValue = m_BlockBuffer.GetTextData(0, m_iTextDataLength);
+ CFX_WideString GetAttributeValue() const {
+ return m_BlockBuffer.GetTextData(0, m_iTextDataLength);
}
- void GetTextData(CFX_WideString& wsText) const {
- wsText = m_BlockBuffer.GetTextData(0, m_iTextDataLength);
+ CFX_WideString GetTextData() const {
+ return m_BlockBuffer.GetTextData(0, m_iTextDataLength);
}
- void GetTargetData(CFX_WideString& wsData) const {
- wsData = m_BlockBuffer.GetTextData(0, m_iTextDataLength);
+ CFX_WideString GetTargetData() const {
+ return m_BlockBuffer.GetTextData(0, m_iTextDataLength);
}
protected:
diff --git a/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp b/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp
index 9b04028123..e7e6894820 100644
--- a/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp
+++ b/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp
@@ -32,34 +32,25 @@ TEST(CFDE_XMLSyntaxParser, CData) {
parser.Init(stream, 256);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
+ EXPECT_EQ(L"contentType", parser.GetAttributeName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
+ EXPECT_EQ(L"application/x-javascript", parser.GetAttributeValue());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n ", data);
+ EXPECT_EQ(L"\n ", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::CData, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(cdata, data);
+ EXPECT_EQ(cdata, parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n", data);
+ EXPECT_EQ(L"\n", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
@@ -89,34 +80,25 @@ TEST(CFDE_XMLSyntaxParser, CDataWithInnerScript) {
parser.Init(stream, 256);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
+ EXPECT_EQ(L"contentType", parser.GetAttributeName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
+ EXPECT_EQ(L"application/x-javascript", parser.GetAttributeValue());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n ", data);
+ EXPECT_EQ(L"\n ", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::CData, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(cdata, data);
+ EXPECT_EQ(cdata, parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n", data);
+ EXPECT_EQ(L"\n", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
@@ -136,29 +118,22 @@ TEST(CFDE_XMLSyntaxParser, ArrowBangArrow) {
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
+ EXPECT_EQ(L"contentType", parser.GetAttributeName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
+ EXPECT_EQ(L"application/x-javascript", parser.GetAttributeValue());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n ", data);
+ EXPECT_EQ(L"\n ", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n", data);
+ EXPECT_EQ(L"\n", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
@@ -177,22 +152,16 @@ TEST(CFDE_XMLSyntaxParser, ArrowBangBracketArrow) {
parser.Init(stream, 256);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
+ EXPECT_EQ(L"contentType", parser.GetAttributeName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
+ EXPECT_EQ(L"application/x-javascript", parser.GetAttributeValue());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n ", data);
+ EXPECT_EQ(L"\n ", parser.GetTextData());
// Parser walks to end of input.
@@ -213,22 +182,16 @@ TEST(CFDE_XMLSyntaxParser, IncompleteCData) {
parser.Init(stream, 256);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
+ EXPECT_EQ(L"contentType", parser.GetAttributeName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
+ EXPECT_EQ(L"application/x-javascript", parser.GetAttributeValue());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n ", data);
+ EXPECT_EQ(L"\n ", parser.GetTextData());
// Parser walks to end of input.
@@ -249,22 +212,16 @@ TEST(CFDE_XMLSyntaxParser, UnClosedCData) {
parser.Init(stream, 256);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
+ EXPECT_EQ(L"contentType", parser.GetAttributeName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
+ EXPECT_EQ(L"application/x-javascript", parser.GetAttributeValue());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n ", data);
+ EXPECT_EQ(L"\n ", parser.GetTextData());
// Parser walks to end of input.
@@ -285,34 +242,25 @@ TEST(CFDE_XMLSyntaxParser, EmptyCData) {
parser.Init(stream, 256);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
+ EXPECT_EQ(L"contentType", parser.GetAttributeName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
+ EXPECT_EQ(L"application/x-javascript", parser.GetAttributeValue());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n ", data);
+ EXPECT_EQ(L"\n ", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::CData, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"", data);
+ EXPECT_EQ(L"", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n", data);
+ EXPECT_EQ(L"\n", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
@@ -331,30 +279,22 @@ TEST(CFDE_XMLSyntaxParser, Comment) {
parser.Init(stream, 256);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
+ EXPECT_EQ(L"contentType", parser.GetAttributeName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
+ EXPECT_EQ(L"application/x-javascript", parser.GetAttributeValue());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n ", data);
+ EXPECT_EQ(L"\n ", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n", data);
+ EXPECT_EQ(L"\n", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
@@ -373,30 +313,22 @@ TEST(CFDE_XMLSyntaxParser, IncorrectCommentStart) {
parser.Init(stream, 256);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
+ EXPECT_EQ(L"contentType", parser.GetAttributeName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
+ EXPECT_EQ(L"application/x-javascript", parser.GetAttributeValue());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n ", data);
+ EXPECT_EQ(L"\n ", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n", data);
+ EXPECT_EQ(L"\n", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
@@ -415,30 +347,22 @@ TEST(CFDE_XMLSyntaxParser, CommentEmpty) {
parser.Init(stream, 256);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
+ EXPECT_EQ(L"contentType", parser.GetAttributeName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
+ EXPECT_EQ(L"application/x-javascript", parser.GetAttributeValue());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n ", data);
+ EXPECT_EQ(L"\n ", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n", data);
+ EXPECT_EQ(L"\n", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
@@ -457,22 +381,16 @@ TEST(CFDE_XMLSyntaxParser, CommentThreeDash) {
parser.Init(stream, 256);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
+ EXPECT_EQ(L"contentType", parser.GetAttributeName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
+ EXPECT_EQ(L"application/x-javascript", parser.GetAttributeValue());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n ", data);
+ EXPECT_EQ(L"\n ", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
@@ -491,22 +409,16 @@ TEST(CFDE_XMLSyntaxParser, CommentTwoDash) {
parser.Init(stream, 256);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
+ EXPECT_EQ(L"contentType", parser.GetAttributeName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
+ EXPECT_EQ(L"application/x-javascript", parser.GetAttributeValue());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"\n ", data);
+ EXPECT_EQ(L"\n ", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
@@ -529,26 +441,19 @@ TEST(CFDE_XMLSyntaxParser, Entities) {
parser.Init(stream, 256);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
+ EXPECT_EQ(L"contentType", parser.GetAttributeName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
+ EXPECT_EQ(L"application/x-javascript", parser.GetAttributeValue());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L"BTH\xab48", data);
+ EXPECT_EQ(L"BTH\xab48", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
@@ -568,26 +473,19 @@ TEST(CFDE_XMLSyntaxParser, EntityOverflowHex) {
parser.Init(stream, 256);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
+ EXPECT_EQ(L"contentType", parser.GetAttributeName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
+ EXPECT_EQ(L"application/x-javascript", parser.GetAttributeValue());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L" ", data);
+ EXPECT_EQ(L" ", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
@@ -607,26 +505,19 @@ TEST(CFDE_XMLSyntaxParser, EntityOverflowDecimal) {
parser.Init(stream, 256);
EXPECT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
-
- CFX_WideString data;
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
- parser.GetAttributeName(data);
- EXPECT_EQ(L"contentType", data);
+ EXPECT_EQ(L"contentType", parser.GetAttributeName());
EXPECT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
- parser.GetAttributeValue(data);
- EXPECT_EQ(L"application/x-javascript", data);
+ EXPECT_EQ(L"application/x-javascript", parser.GetAttributeValue());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
EXPECT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
- parser.GetTextData(data);
- EXPECT_EQ(L" ", data);
+ EXPECT_EQ(L" ", parser.GetTextData());
EXPECT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
- parser.GetTagName(data);
- EXPECT_EQ(L"script", data);
+ EXPECT_EQ(L"script", parser.GetTagName());
EXPECT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}