summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2017-06-16 14:40:04 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-06-19 14:24:49 +0000
commitcff4624521c5e0bfc0f4ee667ff90f37785db107 (patch)
tree19f4d798bc6aac014c7185072ea61b764b1770ec /core
parentad0982add85998db0ef42a5c01ae2031ae7874d2 (diff)
downloadpdfium-cff4624521c5e0bfc0f4ee667ff90f37785db107.tar.xz
Converting CFX_ByteTextBuf to ostringstream in cxml_parser.cpp.
Bug: pdfium:731 Change-Id: Id4cb57aaf1d045d5052869477a8c5082cab8961c Reviewed-on: https://pdfium-review.googlesource.com/6675 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core')
-rw-r--r--core/fxcrt/xml/cxml_parser.cpp21
1 files changed, 11 insertions, 10 deletions
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 <algorithm>
#include <memory>
+#include <sstream>
+#include <string>
#include <utility>
#include <vector>
@@ -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<char>(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<char>(ch);
break;
case 2:
if (ch == 'x') {