summaryrefslogtreecommitdiff
path: root/fxjs/xfa/cjx_object.cpp
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 /fxjs/xfa/cjx_object.cpp
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 'fxjs/xfa/cjx_object.cpp')
-rw-r--r--fxjs/xfa/cjx_object.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/fxjs/xfa/cjx_object.cpp b/fxjs/xfa/cjx_object.cpp
index 1c0454d425..6984c3a998 100644
--- a/fxjs/xfa/cjx_object.cpp
+++ b/fxjs/xfa/cjx_object.cpp
@@ -806,30 +806,31 @@ Optional<WideString> CJX_Object::TryNamespace() {
if (ToNode(GetXFAObject())->IsModelNode() ||
ToNode(GetXFAObject())->GetElementType() == XFA_Element::Packet) {
CFX_XMLNode* pXMLNode = ToNode(GetXFAObject())->GetXMLMappingNode();
- if (!pXMLNode || pXMLNode->GetType() != FX_XMLNODE_Element)
+ CFX_XMLElement* element = ToXMLElement(pXMLNode);
+ if (!element)
return {};
- return {static_cast<CFX_XMLElement*>(pXMLNode)->GetNamespaceURI()};
+ return {element->GetNamespaceURI()};
}
if (ToNode(GetXFAObject())->GetPacketType() != XFA_PacketType::Datasets)
return ToNode(GetXFAObject())->GetModelNode()->JSObject()->TryNamespace();
CFX_XMLNode* pXMLNode = ToNode(GetXFAObject())->GetXMLMappingNode();
- if (!pXMLNode || pXMLNode->GetType() != FX_XMLNODE_Element)
+ CFX_XMLElement* element = ToXMLElement(pXMLNode);
+ if (!element)
return {};
if (ToNode(GetXFAObject())->GetElementType() == XFA_Element::DataValue &&
GetEnum(XFA_Attribute::Contains) == XFA_AttributeEnum::MetaData) {
WideString wsNamespace;
- bool ret = XFA_FDEExtension_ResolveNamespaceQualifier(
- static_cast<CFX_XMLElement*>(pXMLNode),
- GetCData(XFA_Attribute::QualifiedName), &wsNamespace);
- if (!ret)
+ if (!XFA_FDEExtension_ResolveNamespaceQualifier(
+ element, GetCData(XFA_Attribute::QualifiedName), &wsNamespace)) {
return {};
+ }
return {wsNamespace};
}
- return {static_cast<CFX_XMLElement*>(pXMLNode)->GetNamespaceURI()};
+ return {element->GetNamespaceURI()};
}
std::pair<CXFA_Node*, int32_t> CJX_Object::GetPropertyInternal(