From cff4624521c5e0bfc0f4ee667ff90f37785db107 Mon Sep 17 00:00:00 2001 From: Henrique Nakashima Date: Fri, 16 Jun 2017 14:40:04 -0400 Subject: Converting CFX_ByteTextBuf to ostringstream in cxml_parser.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: pdfium:731 Change-Id: Id4cb57aaf1d045d5052869477a8c5082cab8961c Reviewed-on: https://pdfium-review.googlesource.com/6675 Reviewed-by: dsinclair Reviewed-by: Nicolás Peña Commit-Queue: dsinclair --- core/fxcrt/xml/cxml_parser.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'core/fxcrt/xml/cxml_parser.cpp') diff --git a/core/fxcrt/xml/cxml_parser.cpp b/core/fxcrt/xml/cxml_parser.cpp index d43fbd6581..a741d8409e 100644 --- a/core/fxcrt/xml/cxml_parser.cpp +++ b/core/fxcrt/xml/cxml_parser.cpp @@ -6,6 +6,8 @@ #include #include +#include +#include #include #include @@ -140,16 +142,15 @@ void CXML_Parser::GetName(CFX_ByteString* space, CFX_ByteString* name) { if (IsEOF()) return; - CFX_ByteTextBuf buf; - uint8_t ch; + std::ostringstream buf; do { while (m_dwIndex < m_dwBufferSize) { - ch = m_pBuffer[m_dwIndex]; + uint8_t ch = m_pBuffer[m_dwIndex]; if (ch == ':') { - *space = buf.AsStringC(); - buf.Clear(); + *space = CFX_ByteString(buf); + buf.str(""); } else if (g_FXCRT_XML_IsNameChar(ch)) { - buf.AppendChar(ch); + buf << static_cast(ch); } else { break; } @@ -159,7 +160,7 @@ void CXML_Parser::GetName(CFX_ByteString* space, CFX_ByteString* name) { if (m_dwIndex < m_dwBufferSize || IsEOF()) break; } while (ReadNextBlock()); - *name = buf.AsStringC(); + *name = CFX_ByteString(buf); } void CXML_Parser::SkipLiterals(const CFX_ByteStringC& str) { @@ -199,7 +200,7 @@ uint32_t CXML_Parser::GetCharRef() { uint8_t ch; int32_t iState = 0; - CFX_ByteTextBuf buf; + std::ostringstream buf; uint32_t code = 0; do { while (m_dwIndex < m_dwBufferSize) { @@ -215,7 +216,7 @@ uint32_t CXML_Parser::GetCharRef() { case 1: m_dwIndex++; if (ch == ';') { - CFX_ByteStringC ref = buf.AsStringC(); + std::string ref = buf.str(); if (ref == "gt") code = '>'; else if (ref == "lt") @@ -229,7 +230,7 @@ uint32_t CXML_Parser::GetCharRef() { iState = 10; break; } - buf.AppendByte(ch); + buf << static_cast(ch); break; case 2: if (ch == 'x') { -- cgit v1.2.3