summaryrefslogtreecommitdiff
path: root/core/fxcrt/xml/cfx_xmlelement.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-07-28 00:00:24 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-07-28 00:00:24 +0000
commitf19ae5dcd0b618cdeb80d6a1df5b13610d0ff7da (patch)
tree6e834ca7ebaff809e6e8d352c41bb1f8d4ec4203 /core/fxcrt/xml/cfx_xmlelement.cpp
parent0415e02db77da26495dc0fbd80de76ce1d777585 (diff)
downloadpdfium-f19ae5dcd0b618cdeb80d6a1df5b13610d0ff7da.tar.xz
Add ToXML{Instruction,Text,CharData}() checked conversion functions
All usages were previously checked correctly, but this consolidates some code as well. Change-Id: I63711748b31b698a3f21f98fdb536db1e9e0b1cf Reviewed-on: https://pdfium-review.googlesource.com/39010 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fxcrt/xml/cfx_xmlelement.cpp')
-rw-r--r--core/fxcrt/xml/cfx_xmlelement.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/core/fxcrt/xml/cfx_xmlelement.cpp b/core/fxcrt/xml/cfx_xmlelement.cpp
index 4bb4eae1bd..bd24091205 100644
--- a/core/fxcrt/xml/cfx_xmlelement.cpp
+++ b/core/fxcrt/xml/cfx_xmlelement.cpp
@@ -76,13 +76,11 @@ WideString CFX_XMLElement::GetNamespaceURI() const {
WideString CFX_XMLElement::GetTextData() const {
CFX_WideTextBuf buffer;
-
for (CFX_XMLNode* pChild = GetFirstChild(); pChild;
pChild = pChild->GetNextSibling()) {
- if (pChild->GetType() == FX_XMLNODE_Text ||
- pChild->GetType() == FX_XMLNODE_CharData) {
- buffer << static_cast<CFX_XMLText*>(pChild)->GetText();
- }
+ CFX_XMLText* pText = ToXMLText(pChild);
+ if (pText)
+ buffer << pText->GetText();
}
return buffer.MakeString();
}