diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-04-24 19:28:50 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-04-24 19:28:50 +0000 |
commit | b242943f5e949ce3d92dcb62c7497815ccd231d1 (patch) | |
tree | 890290b4c6907018d9236bfb26c2b82e6d0fd4b9 /core/fxcrt/xml/cfx_xmlparser.cpp | |
parent | 9afcfa46ee07bc22c94d49942f5a61d6a374fd2d (diff) | |
download | pdfium-b242943f5e949ce3d92dcb62c7497815ccd231d1.tar.xz |
Remove m_CurNodeType from CFX_XMLParser
This CL removes the m_CurNodeType member from CFX_XMLParser. This was,
essentially, duplicating the m_XMLNodeTypeStack. We now use the top() of
the stack element to find the same information.
Change-Id: I26507d2eee954837210aa42919ff061cfc8e85d8
Reviewed-on: https://pdfium-review.googlesource.com/31277
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'core/fxcrt/xml/cfx_xmlparser.cpp')
-rw-r--r-- | core/fxcrt/xml/cfx_xmlparser.cpp | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/core/fxcrt/xml/cfx_xmlparser.cpp b/core/fxcrt/xml/cfx_xmlparser.cpp index 55778d3204..651ebb41eb 100644 --- a/core/fxcrt/xml/cfx_xmlparser.cpp +++ b/core/fxcrt/xml/cfx_xmlparser.cpp @@ -242,14 +242,12 @@ FX_XmlSyntaxResult CFX_XMLParser::DoSyntaxParse() { m_Start++; m_syntaxParserState = FDE_XmlSyntaxState::CloseElement; } else if (ch == L'?') { - m_CurNodeType = FX_XMLNODE_Instruction; - m_XMLNodeTypeStack.push(m_CurNodeType); + m_XMLNodeTypeStack.push(FX_XMLNODE_Instruction); m_Start++; m_syntaxParserState = FDE_XmlSyntaxState::Target; syntaxParserResult = FX_XmlSyntaxResult::InstructionOpen; } else { - m_CurNodeType = FX_XMLNODE_Element; - m_XMLNodeTypeStack.push(m_CurNodeType); + m_XMLNodeTypeStack.push(FX_XMLNODE_Element); m_syntaxParserState = FDE_XmlSyntaxState::Tag; syntaxParserResult = FX_XmlSyntaxResult::ElementOpen; } @@ -280,12 +278,12 @@ FX_XmlSyntaxResult CFX_XMLParser::DoSyntaxParse() { } if (!IsXMLNameChar(ch, current_text_.empty())) { if (current_text_.empty()) { - if (m_CurNodeType == FX_XMLNODE_Element) { + if (m_XMLNodeTypeStack.top() == FX_XMLNODE_Element) { if (ch == L'>' || ch == L'/') { m_syntaxParserState = FDE_XmlSyntaxState::BreakElement; break; } - } else if (m_CurNodeType == FX_XMLNODE_Instruction) { + } else if (m_XMLNodeTypeStack.top() == FX_XMLNODE_Instruction) { if (ch == L'?') { m_syntaxParserState = FDE_XmlSyntaxState::CloseInstruction; m_Start++; @@ -297,7 +295,7 @@ FX_XmlSyntaxResult CFX_XMLParser::DoSyntaxParse() { m_syntaxParserResult = FX_XmlSyntaxResult::Error; return m_syntaxParserResult; } else { - if (m_CurNodeType == FX_XMLNODE_Instruction) { + if (m_XMLNodeTypeStack.top() == FX_XMLNODE_Instruction) { if (ch != '=' && !IsXMLWhiteSpace(ch)) { m_syntaxParserState = FDE_XmlSyntaxState::TargetData; break; @@ -317,7 +315,7 @@ FX_XmlSyntaxResult CFX_XMLParser::DoSyntaxParse() { break; } if (ch != L'=') { - if (m_CurNodeType == FX_XMLNODE_Instruction) { + if (m_XMLNodeTypeStack.top() == FX_XMLNODE_Instruction) { m_syntaxParserState = FDE_XmlSyntaxState::TargetData; break; } @@ -370,11 +368,6 @@ FX_XmlSyntaxResult CFX_XMLParser::DoSyntaxParse() { } m_XMLNodeTypeStack.pop(); - if (!m_XMLNodeTypeStack.empty()) - m_CurNodeType = m_XMLNodeTypeStack.top(); - else - m_CurNodeType = FX_XMLNODE_Unknown; - m_syntaxParserState = FDE_XmlSyntaxState::Text; syntaxParserResult = FX_XmlSyntaxResult::InstructionClose; } @@ -400,11 +393,6 @@ FX_XmlSyntaxResult CFX_XMLParser::DoSyntaxParse() { } m_XMLNodeTypeStack.pop(); - if (!m_XMLNodeTypeStack.empty()) - m_CurNodeType = m_XMLNodeTypeStack.top(); - else - m_CurNodeType = FX_XMLNODE_Unknown; - m_syntaxParserState = FDE_XmlSyntaxState::Text; syntaxParserResult = FX_XmlSyntaxResult::ElementClose; } else if (!IsXMLWhiteSpace(ch)) { |