From c9171e16d9d4477501d326d8d456fdc03e0f832e Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 26 Jul 2018 19:34:26 +0000 Subject: Use moar ToXMLElement() in place of static_cast<>. Introduces checks in a few new places, but mainly just consolidates checking/casting logic. Change-Id: I634a03060d254db099972c6978249992367e146c Reviewed-on: https://pdfium-review.googlesource.com/38900 Commit-Queue: Tom Sepez Reviewed-by: Lei Zhang --- core/fpdfdoc/cpdf_metadata.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'core/fpdfdoc/cpdf_metadata.cpp') diff --git a/core/fpdfdoc/cpdf_metadata.cpp b/core/fpdfdoc/cpdf_metadata.cpp index 323de4ffcf..5ef7312752 100644 --- a/core/fpdfdoc/cpdf_metadata.cpp +++ b/core/fpdfdoc/cpdf_metadata.cpp @@ -49,11 +49,9 @@ void CheckForSharedFormInternal(CFX_XMLElement* element, for (auto* child = element->GetFirstChild(); child; child = child->GetNextSibling()) { - if (child->GetType() != FX_XMLNODE_Element) - continue; - - CheckForSharedFormInternal(static_cast(child), - unsupported); + CFX_XMLElement* pElement = ToXMLElement(child); + if (pElement) + CheckForSharedFormInternal(pElement, unsupported); } } -- cgit v1.2.3