summaryrefslogtreecommitdiff
path: root/core/fpdfdoc
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-07-26 19:34:26 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-07-26 19:34:26 +0000
commitc9171e16d9d4477501d326d8d456fdc03e0f832e (patch)
tree89a91af4803e820b2e7f8c6e9901915c3415d72c /core/fpdfdoc
parentea360af9048e7083107f9e27f8967351df241f70 (diff)
downloadpdfium-c9171e16d9d4477501d326d8d456fdc03e0f832e.tar.xz
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 <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfdoc')
-rw-r--r--core/fpdfdoc/cpdf_metadata.cpp8
1 files changed, 3 insertions, 5 deletions
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<CFX_XMLElement*>(child),
- unsupported);
+ CFX_XMLElement* pElement = ToXMLElement(child);
+ if (pElement)
+ CheckForSharedFormInternal(pElement, unsupported);
}
}