diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-07-26 19:34:26 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-07-26 19:34:26 +0000 |
commit | c9171e16d9d4477501d326d8d456fdc03e0f832e (patch) | |
tree | 89a91af4803e820b2e7f8c6e9901915c3415d72c /xfa/fxfa/parser/cxfa_dataexporter.cpp | |
parent | ea360af9048e7083107f9e27f8967351df241f70 (diff) | |
download | pdfium-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 'xfa/fxfa/parser/cxfa_dataexporter.cpp')
-rw-r--r-- | xfa/fxfa/parser/cxfa_dataexporter.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/xfa/fxfa/parser/cxfa_dataexporter.cpp b/xfa/fxfa/parser/cxfa_dataexporter.cpp index eb3e04afd8..820d3546f7 100644 --- a/xfa/fxfa/parser/cxfa_dataexporter.cpp +++ b/xfa/fxfa/parser/cxfa_dataexporter.cpp @@ -38,9 +38,8 @@ bool CXFA_DataExporter::Export(const RetainPtr<IFX_SeekableStream>& pStream, break; } case XFA_PacketType::Datasets: { - CFX_XMLElement* pElement = - static_cast<CFX_XMLElement*>(pNode->GetXMLMappingNode()); - if (!pElement || pElement->GetType() != FX_XMLNODE_Element) + CFX_XMLElement* pElement = ToXMLElement(pNode->GetXMLMappingNode()); + if (!pElement) return false; CXFA_Node* pDataNode = pNode->GetFirstChild(); @@ -54,9 +53,8 @@ bool CXFA_DataExporter::Export(const RetainPtr<IFX_SeekableStream>& pStream, break; case XFA_PacketType::Template: default: { - CFX_XMLElement* pElement = - static_cast<CFX_XMLElement*>(pNode->GetXMLMappingNode()); - if (!pElement || pElement->GetType() != FX_XMLNODE_Element) + CFX_XMLElement* pElement = ToXMLElement(pNode->GetXMLMappingNode()); + if (!pElement) return false; pElement->Save(pStream); @@ -75,9 +73,8 @@ bool CXFA_DataExporter::Export(const RetainPtr<IFX_SeekableStream>& pStream, break; } } - CFX_XMLElement* pElement = - static_cast<CFX_XMLElement*>(pExportNode->GetXMLMappingNode()); - if (!pElement || pElement->GetType() != FX_XMLNODE_Element) + CFX_XMLElement* pElement = ToXMLElement(pExportNode->GetXMLMappingNode()); + if (!pElement) return false; XFA_DataExporter_DealWithDataGroupNode(pExportNode); @@ -85,6 +82,5 @@ bool CXFA_DataExporter::Export(const RetainPtr<IFX_SeekableStream>& pStream, L"http://www.xfa.org/schema/xfa-data/1.0/"); pElement->Save(pStream); pElement->RemoveAttribute(L"xmlns:xfa"); - return true; } |