From 6bb3b894488fd6f38c096b708980a9f08286ac5c Mon Sep 17 00:00:00 2001 From: tsepez Date: Thu, 5 Jan 2017 12:18:41 -0800 Subject: Remove CFX_MapPtrToPtr from xfa/fxfa. Review-Url: https://codereview.chromium.org/2612923002 --- xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'xfa/fxfa/parser/xfa_document_datamerger_imp.cpp') diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index dab61e65d8..f1b60884ee 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -6,6 +6,7 @@ #include "xfa/fxfa/parser/xfa_document_datamerger_imp.h" +#include #include #include "core/fxcrt/fx_ext.h" @@ -356,15 +357,14 @@ void CreateDataBinding(CXFA_Node* pFormNode, } CXFA_Node* GetGlobalBinding(CXFA_Document* pDocument, uint32_t dwNameHash) { - CXFA_Node* pNode = nullptr; - pDocument->m_rgGlobalBinding.Lookup(dwNameHash, pNode); - return pNode; + auto it = pDocument->m_rgGlobalBinding.find(dwNameHash); + return it != pDocument->m_rgGlobalBinding.end() ? it->second : nullptr; } void RegisterGlobalBinding(CXFA_Document* pDocument, uint32_t dwNameHash, CXFA_Node* pDataNode) { - pDocument->m_rgGlobalBinding.SetAt(dwNameHash, pDataNode); + pDocument->m_rgGlobalBinding[dwNameHash] = pDataNode; } CXFA_Node* ScopeMatchGlobalBinding(CXFA_Node* pDataScope, @@ -753,7 +753,7 @@ CXFA_Node* CopyContainer_SubformSet(CXFA_Document* pDocument, if (eType == XFA_Element::SubformSet || eType == XFA_Element::Area) { sNodeIterator.MoveToNext(); } else { - CFX_MapPtrTemplate subformMapArray; + std::map subformMapArray; CXFA_NodeArray nodeArray; for (; iMax < 0 || iCurRepeatIndex < iMax; iCurRepeatIndex++) { bool bSelfMatch = false; @@ -772,15 +772,16 @@ CXFA_Node* CopyContainer_SubformSet(CXFA_Document* pDocument, CreateDataBinding(pSubformNode, pDataNode, true); ASSERT(pSubformNode); - subformMapArray.SetAt(pSubformNode, pDataNode); + subformMapArray[pSubformNode] = pDataNode; nodeArray.Add(pSubformNode); } - subformMapArray.GetStartPosition(); for (int32_t iIndex = 0; iIndex < nodeArray.GetSize(); iIndex++) { CXFA_Node* pSubform = nodeArray[iIndex]; - CXFA_Node* pDataNode = - reinterpret_cast(subformMapArray.GetValueAt(pSubform)); + CXFA_Node* pDataNode = nullptr; + auto it = subformMapArray.find(pSubform); + if (it != subformMapArray.end()) + pDataNode = it->second; for (CXFA_Node* pTemplateChild = pTemplateNode->GetNodeItem(XFA_NODEITEM_FirstChild); pTemplateChild; pTemplateChild = pTemplateChild->GetNodeItem( @@ -794,7 +795,7 @@ CXFA_Node* CopyContainer_SubformSet(CXFA_Document* pDocument, } } } - subformMapArray.RemoveAll(); + subformMapArray.clear(); } for (; iMax < 0 || iCurRepeatIndex < iMax; iCurRepeatIndex++) { @@ -1521,7 +1522,7 @@ void CXFA_Document::DoDataRemerge(bool bDoDataMerge) { pFormRoot->RemoveChild(pNode); pFormRoot->SetObject(XFA_ATTRIBUTE_BindingNode, nullptr); } - m_rgGlobalBinding.RemoveAll(); + m_rgGlobalBinding.clear(); if (bDoDataMerge) DoDataMerge(); -- cgit v1.2.3