summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fxcrt/xml/cfx_xmlparser.cpp11
-rw-r--r--core/fxcrt/xml/cfx_xmlparser.h5
2 files changed, 3 insertions, 13 deletions
diff --git a/core/fxcrt/xml/cfx_xmlparser.cpp b/core/fxcrt/xml/cfx_xmlparser.cpp
index 651ebb41eb..685655e815 100644
--- a/core/fxcrt/xml/cfx_xmlparser.cpp
+++ b/core/fxcrt/xml/cfx_xmlparser.cpp
@@ -72,8 +72,6 @@ CFX_XMLParser::CFX_XMLParser(CFX_XMLNode* pParent,
}
m_pStream = proxy;
- m_NodeStack.push(m_pParent);
-
m_iXMLPlaneSize =
std::min(m_iXMLPlaneSize,
pdfium::base::checked_cast<size_t>(m_pStream->GetSize()));
@@ -117,12 +115,10 @@ bool CFX_XMLParser::Parse() {
return false;
}
- if (!m_NodeStack.empty())
- m_NodeStack.pop();
- if (m_NodeStack.empty())
+ if (!m_pChild || !m_pChild->GetParent())
return false;
- m_pParent = m_NodeStack.top();
+ m_pParent = m_pChild->GetParent();
m_pChild = m_pParent;
iCount++;
break;
@@ -142,7 +138,6 @@ bool CFX_XMLParser::Parse() {
auto child = pdfium::MakeUnique<CFX_XMLElement>(GetTextData());
m_pChild = child.get();
m_pParent->AppendChild(std::move(child));
- m_NodeStack.push(m_pChild);
m_pParent = m_pChild;
break;
}
@@ -192,7 +187,7 @@ bool CFX_XMLParser::Parse() {
break;
}
}
- return m_NodeStack.size() != 1 ? false : GetStatus();
+ return !m_pParent || m_pParent->GetParent() ? false : GetStatus();
}
FX_XmlSyntaxResult CFX_XMLParser::DoSyntaxParse() {
diff --git a/core/fxcrt/xml/cfx_xmlparser.h b/core/fxcrt/xml/cfx_xmlparser.h
index 6db24e5040..e2a2d5b30f 100644
--- a/core/fxcrt/xml/cfx_xmlparser.h
+++ b/core/fxcrt/xml/cfx_xmlparser.h
@@ -61,14 +61,10 @@ class CFX_XMLParser {
AttriEqualSign,
AttriQuotation,
AttriValue,
- Entity,
- EntityDecimal,
- EntityHex,
CloseInstruction,
BreakElement,
CloseElement,
SkipDeclNode,
- DeclCharData,
SkipComment,
SkipCommentOrDecl,
SkipCData,
@@ -86,7 +82,6 @@ class CFX_XMLParser {
FX_FILESIZE m_End = 0; // End position in m_Buffer
FX_XmlSyntaxResult m_syntaxParserResult = FX_XmlSyntaxResult::None;
FDE_XmlSyntaxState m_syntaxParserState = FDE_XmlSyntaxState::Text;
- std::stack<CFX_XMLNode*> m_NodeStack;
std::stack<FX_XMLNODETYPE> m_XMLNodeTypeStack;
std::stack<wchar_t> m_SkipStack;
std::vector<wchar_t> m_Buffer;