From 2dca1cbf595618e06547a2c464d82c47b6acace6 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 23 Apr 2018 21:14:39 +0000 Subject: Cleanup CFX_XMLParser initialization This CL moves most initialization of CFX_XMLParser into the header file and re-organizes the members to group members together better. Change-Id: I49031ea65dc0d68c9b47cffe942c65f488bbaf20 Reviewed-on: https://pdfium-review.googlesource.com/31250 Reviewed-by: Ryan Harrison Commit-Queue: dsinclair --- core/fxcrt/xml/cfx_xmlparser.cpp | 14 +------------- core/fxcrt/xml/cfx_xmlparser.h | 33 ++++++++++++++++----------------- 2 files changed, 17 insertions(+), 30 deletions(-) diff --git a/core/fxcrt/xml/cfx_xmlparser.cpp b/core/fxcrt/xml/cfx_xmlparser.cpp index bf578291e6..357deb069d 100644 --- a/core/fxcrt/xml/cfx_xmlparser.cpp +++ b/core/fxcrt/xml/cfx_xmlparser.cpp @@ -59,19 +59,7 @@ bool CFX_XMLParser::IsXMLNameChar(wchar_t ch, bool bFirstChar) { CFX_XMLParser::CFX_XMLParser(CFX_XMLNode* pParent, const RetainPtr& pStream) - : m_pParent(pParent), - m_pChild(nullptr), - m_iXMLPlaneSize(1024), - m_Start(0), - m_End(0), - m_CurNodeType(FX_XMLNODE_Unknown), - m_pCurrentBlock(nullptr), - m_iIndexInBlock(0), - m_iTextDataLength(0), - m_syntaxParserResult(FX_XmlSyntaxResult::None), - m_syntaxParserState(FDE_XmlSyntaxState::Text), - m_wQuotationMark(0), - m_iEntityStart(-1) { + : m_pParent(pParent) { ASSERT(m_pParent); ASSERT(pStream); diff --git a/core/fxcrt/xml/cfx_xmlparser.h b/core/fxcrt/xml/cfx_xmlparser.h index 6405b61a64..03f649c933 100644 --- a/core/fxcrt/xml/cfx_xmlparser.h +++ b/core/fxcrt/xml/cfx_xmlparser.h @@ -95,27 +95,26 @@ class CFX_XMLParser { bool GetStatus() const; CFX_XMLNode* m_pParent; - CFX_XMLNode* m_pChild; - std::stack m_NodeStack; + CFX_XMLNode* m_pChild = nullptr; WideString m_ws1; - RetainPtr m_pStream; - size_t m_iXMLPlaneSize; - std::vector m_Buffer; - FX_FILESIZE m_Start; // Start position in m_Buffer - FX_FILESIZE m_End; // End position in m_Buffer - FX_XMLNODETYPE m_CurNodeType; + FX_FILESIZE m_Start = 0; // Start position in m_Buffer + FX_FILESIZE m_End = 0; // End position in m_Buffer + FX_XMLNODETYPE m_CurNodeType = FX_XMLNODE_Unknown; + FX_XmlSyntaxResult m_syntaxParserResult = FX_XmlSyntaxResult::None; + FDE_XmlSyntaxState m_syntaxParserState = FDE_XmlSyntaxState::Text; + std::stack m_NodeStack; std::stack m_XMLNodeTypeStack; - CFX_BlockBuffer m_BlockBuffer; - wchar_t* m_pCurrentBlock; // Pointer into CFX_BlockBuffer - size_t m_iIndexInBlock; - int32_t m_iTextDataLength; - FX_XmlSyntaxResult m_syntaxParserResult; - FDE_XmlSyntaxState m_syntaxParserState; - wchar_t m_wQuotationMark; - int32_t m_iEntityStart; std::stack m_SkipStack; - wchar_t m_SkipChar; + std::vector m_Buffer; + CFX_BlockBuffer m_BlockBuffer; + wchar_t* m_pCurrentBlock = nullptr; // Pointer into CFX_BlockBuffer + size_t m_iIndexInBlock = 0; + size_t m_iXMLPlaneSize = 1024; + int32_t m_iTextDataLength = 0; + int32_t m_iEntityStart = -1; + wchar_t m_wQuotationMark = 0; + wchar_t m_SkipChar = 0; }; #endif // CORE_FXCRT_XML_CFX_XMLPARSER_H_ -- cgit v1.2.3