summaryrefslogtreecommitdiff
path: root/core/fxcrt/xml/cxml_parser.cpp
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2018-01-05 14:31:28 -0500
committerChromium commit bot <commit-bot@chromium.org>2018-01-05 19:45:59 +0000
commit2a12866a3605f7d5ed2a926ff638e6bb2b60b1d9 (patch)
tree35c08aca3837804834574456ebb96e09b9eba476 /core/fxcrt/xml/cxml_parser.cpp
parentaebeec913f5571992896424aefce62b56dbb7e6f (diff)
downloadpdfium-2a12866a3605f7d5ed2a926ff638e6bb2b60b1d9.tar.xz
Convert CXML_Parser::GetAttrValue out param to return
Change-Id: I92420cb9333ad79246a855b0af9a27348b27ceb0 Reviewed-on: https://pdfium-review.googlesource.com/22312 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'core/fxcrt/xml/cxml_parser.cpp')
-rw-r--r--core/fxcrt/xml/cxml_parser.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/core/fxcrt/xml/cxml_parser.cpp b/core/fxcrt/xml/cxml_parser.cpp
index 76463bba23..ae5fd6d0fc 100644
--- a/core/fxcrt/xml/cxml_parser.cpp
+++ b/core/fxcrt/xml/cxml_parser.cpp
@@ -266,19 +266,20 @@ uint32_t CXML_Parser::GetCharRef() {
return code;
}
-void CXML_Parser::GetAttrValue(WideString& value) {
+WideString CXML_Parser::GetAttrValue() {
m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);
if (IsEOF())
- return;
+ return WideString();
CFX_UTF8Decoder decoder;
- uint8_t mark = 0, ch = 0;
+ uint8_t mark = 0;
+ uint8_t ch = 0;
do {
while (m_dwIndex < m_dwBufferSize) {
ch = m_pBuffer[m_dwIndex];
if (mark == 0) {
if (ch != '\'' && ch != '"')
- return;
+ return WideString();
mark = ch;
m_dwIndex++;
@@ -291,10 +292,8 @@ void CXML_Parser::GetAttrValue(WideString& value) {
if (ch == '&') {
decoder.AppendCodePoint(GetCharRef());
- if (IsEOF()) {
- value = decoder.GetResult();
- return;
- }
+ if (IsEOF())
+ return WideString(decoder.GetResult());
} else {
decoder.Input(ch);
}
@@ -303,7 +302,7 @@ void CXML_Parser::GetAttrValue(WideString& value) {
if (ch == mark || m_dwIndex < m_dwBufferSize || IsEOF())
break;
} while (ReadNextBlock());
- value = decoder.GetResult();
+ return WideString(decoder.GetResult());
}
void CXML_Parser::GetTagName(bool bStartTag,
@@ -407,8 +406,7 @@ std::unique_ptr<CXML_Element> CXML_Parser::ParseElementInternal(
if (IsEOF())
break;
- WideString attr_value;
- GetAttrValue(attr_value);
+ WideString attr_value = GetAttrValue();
pElement->SetAttribute(attr_space, attr_name, attr_value);
}
m_nOffset = m_nBufferOffset + static_cast<FX_FILESIZE>(m_dwIndex);