From a99de0ec3cda8ff5b0d6383a059dd39c8626e504 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 27 Feb 2017 14:45:56 -0800 Subject: Clean up CXML_Element. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Set more members in the ctor - Remove dead code - Use more unique_ptrs Change-Id: Idfe85d07c784a57862f9314bc85f407f817b8f2f Reviewed-on: https://pdfium-review.googlesource.com/2844 Commit-Queue: Lei Zhang Reviewed-by: Nicolás Peña Reviewed-by: dsinclair --- core/fxcrt/xml_int.h | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'core/fxcrt/xml_int.h') diff --git a/core/fxcrt/xml_int.h b/core/fxcrt/xml_int.h index e617a777f3..96a7da9c51 100644 --- a/core/fxcrt/xml_int.h +++ b/core/fxcrt/xml_int.h @@ -8,6 +8,7 @@ #define CORE_FXCRT_XML_INT_H_ #include +#include #include "core/fxcrt/fx_stream.h" @@ -19,23 +20,21 @@ class CXML_Parser { CXML_Parser(); ~CXML_Parser(); - bool Init(uint8_t* pBuffer, size_t size); - bool Init(const CFX_RetainPtr& pFileRead); - bool Init(const CFX_RetainPtr& pBuffer); - bool Init(); + bool Init(const uint8_t* pBuffer, size_t size); bool ReadNextBlock(); bool IsEOF(); bool HaveAvailData(); void SkipWhiteSpaces(); - void GetName(CFX_ByteString& space, CFX_ByteString& name); + void GetName(CFX_ByteString* space, CFX_ByteString* name); void GetAttrValue(CFX_WideString& value); uint32_t GetCharRef(); - void GetTagName(CFX_ByteString& space, - CFX_ByteString& name, - bool& bEndTag, - bool bStartTag = false); + void GetTagName(bool bStartTag, + bool* bEndTag, + CFX_ByteString* space, + CFX_ByteString* name); void SkipLiterals(const CFX_ByteStringC& str); - CXML_Element* ParseElement(CXML_Element* pParent, bool bStartTag = false); + std::unique_ptr ParseElement(CXML_Element* pParent, + bool bStartTag); void InsertContentSegment(bool bCDATA, const CFX_WideStringC& content, CXML_Element* pElement); @@ -43,7 +42,6 @@ class CXML_Parser { CFX_RetainPtr m_pDataAcc; FX_FILESIZE m_nOffset; - bool m_bSaveSpaceChars; const uint8_t* m_pBuffer; size_t m_dwBufferSize; FX_FILESIZE m_nBufferOffset; -- cgit v1.2.3