From f19ae5dcd0b618cdeb80d6a1df5b13610d0ff7da Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Sat, 28 Jul 2018 00:00:24 +0000 Subject: 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 Reviewed-by: Lei Zhang --- core/fxcrt/xml/cfx_xmlchardata.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'core/fxcrt/xml/cfx_xmlchardata.h') diff --git a/core/fxcrt/xml/cfx_xmlchardata.h b/core/fxcrt/xml/cfx_xmlchardata.h index 013414bc82..9e5669a464 100644 --- a/core/fxcrt/xml/cfx_xmlchardata.h +++ b/core/fxcrt/xml/cfx_xmlchardata.h @@ -25,4 +25,10 @@ class CFX_XMLCharData : public CFX_XMLText { void Save(const RetainPtr& pXMLStream) override; }; +inline CFX_XMLCharData* ToXMLCharData(CFX_XMLNode* pNode) { + return pNode && pNode->GetType() == FX_XMLNODE_CharData + ? static_cast(pNode) + : nullptr; +} + #endif // CORE_FXCRT_XML_CFX_XMLCHARDATA_H_ -- cgit v1.2.3