summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2017-01-05 12:18:41 -0800
committerCommit bot <commit-bot@chromium.org>2017-01-05 12:18:41 -0800
commit6bb3b894488fd6f38c096b708980a9f08286ac5c (patch)
tree2360efbf1aa5f2c452ca350382483d1c6b693f23 /xfa/fxfa/parser
parent48f776f7e801d719683b251dc21ee8c0e3250d90 (diff)
downloadpdfium-6bb3b894488fd6f38c096b708980a9f08286ac5c.tar.xz
Remove CFX_MapPtrToPtr from xfa/fxfa.
Review-Url: https://codereview.chromium.org/2612923002
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r--xfa/fxfa/parser/cxfa_document.cpp10
-rw-r--r--xfa/fxfa/parser/cxfa_document.h4
-rw-r--r--xfa/fxfa/parser/cxfa_layoutpagemgr.cpp19
-rw-r--r--xfa/fxfa/parser/cxfa_layoutpagemgr.h6
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp178
-rw-r--r--xfa/fxfa/parser/cxfa_scriptcontext.cpp21
-rw-r--r--xfa/fxfa/parser/cxfa_scriptcontext.h2
-rw-r--r--xfa/fxfa/parser/xfa_document_datamerger_imp.cpp23
-rw-r--r--xfa/fxfa/parser/xfa_object.h7
9 files changed, 135 insertions, 135 deletions
diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp
index b5c7ea1f62..374fb98c52 100644
--- a/xfa/fxfa/parser/cxfa_document.cpp
+++ b/xfa/fxfa/parser/cxfa_document.cpp
@@ -351,7 +351,7 @@ void CXFA_Document::DoProtoMerge() {
if (!pTemplateRoot)
return;
- CFX_MapPtrTemplate<uint32_t, CXFA_Node*> mIDMap;
+ std::map<uint32_t, CXFA_Node*> mIDMap;
CXFA_NodeSet sUseNodes;
CXFA_NodeIterator sIterator(pTemplateRoot);
for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode;
@@ -410,13 +410,13 @@ void CXFA_Document::DoProtoMerge() {
XFA_RESOLVENODE_RS resoveNodeRS;
int32_t iRet = m_pScriptContext->ResolveObjects(pUseHrefNode, wsSOM,
resoveNodeRS, dwFlag);
- if (iRet > 0 && resoveNodeRS.nodes[0]->IsNode()) {
+ if (iRet > 0 && resoveNodeRS.nodes[0]->IsNode())
pProtoNode = resoveNodeRS.nodes[0]->AsNode();
- }
} else if (!wsID.IsEmpty()) {
- if (!mIDMap.Lookup(FX_HashCode_GetW(wsID, false), pProtoNode)) {
+ auto it = mIDMap.find(FX_HashCode_GetW(wsID, false));
+ if (it == mIDMap.end())
continue;
- }
+ pProtoNode = it->second;
}
if (!pProtoNode)
continue;
diff --git a/xfa/fxfa/parser/cxfa_document.h b/xfa/fxfa/parser/cxfa_document.h
index 4fd2d79504..fdd230dca7 100644
--- a/xfa/fxfa/parser/cxfa_document.h
+++ b/xfa/fxfa/parser/cxfa_document.h
@@ -7,6 +7,8 @@
#ifndef XFA_FXFA_PARSER_CXFA_DOCUMENT_H_
#define XFA_FXFA_PARSER_CXFA_DOCUMENT_H_
+#include <map>
+
#include "xfa/fxfa/fxfa.h"
#include "xfa/fxfa/parser/xfa_localemgr.h"
#include "xfa/fxfa/parser/xfa_object.h"
@@ -101,7 +103,7 @@ class CXFA_Document {
void ClearLayoutData();
- CFX_MapPtrTemplate<uint32_t, CXFA_Node*> m_rgGlobalBinding;
+ std::map<uint32_t, CXFA_Node*> m_rgGlobalBinding;
CXFA_NodeArray m_pPendingPageSet;
protected:
diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
index 1a3da9ecb3..0a057f543f 100644
--- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
+++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
@@ -1120,7 +1120,9 @@ bool CXFA_LayoutPageMgr::FindPageAreaFromPageSet_Ordered(
bool bQuery) {
int32_t iPageSetCount = 0;
if (!pStartChild && !bQuery) {
- m_pPageSetMap.Lookup(pPageSet, iPageSetCount);
+ auto it = m_pPageSetMap.find(pPageSet);
+ if (it != m_pPageSetMap.end())
+ iPageSetCount = it->second;
int32_t iMax = -1;
CXFA_Node* pOccurNode = pPageSet->GetFirstChildByClass(XFA_Element::Occur);
if (pOccurNode)
@@ -1128,7 +1130,6 @@ bool CXFA_LayoutPageMgr::FindPageAreaFromPageSet_Ordered(
if (iMax >= 0 && iMax <= iPageSetCount)
return false;
}
-
bool bRes = false;
CXFA_Node* pCurrentNode =
pStartChild ? pStartChild->GetNodeItem(XFA_NODEITEM_NextSibling)
@@ -1173,7 +1174,7 @@ bool CXFA_LayoutPageMgr::FindPageAreaFromPageSet_Ordered(
}
}
if (!pStartChild && bRes && !bQuery)
- m_pPageSetMap.SetAt(pPageSet, ++iPageSetCount);
+ m_pPageSetMap[pPageSet] = ++iPageSetCount;
return bRes;
}
@@ -1414,7 +1415,7 @@ void CXFA_LayoutPageMgr::InitPageSetMap() {
XFA_ATTRIBUTEENUM eRelation =
pPageSetNode->GetEnum(XFA_ATTRIBUTE_Relation);
if (eRelation == XFA_ATTRIBUTEENUM_OrderedOccurrence)
- m_pPageSetMap.SetAt(pPageSetNode, 0);
+ m_pPageSetMap[pPageSetNode] = 0;
}
}
}
@@ -1452,9 +1453,11 @@ void CXFA_LayoutPageMgr::CreateMinPageSetRecord(CXFA_Node* pPageSet,
if (!pPageSet)
return;
- int32_t iCurSetCount = 0;
- if (!m_pPageSetMap.Lookup(pPageSet, iCurSetCount))
+ auto it = m_pPageSetMap.find(pPageSet);
+ if (it == m_pPageSetMap.end())
return;
+
+ int32_t iCurSetCount = it->second;
if (bCreateAll)
iCurSetCount = 0;
@@ -1475,7 +1478,7 @@ void CXFA_LayoutPageMgr::CreateMinPageSetRecord(CXFA_Node* pPageSet,
}
}
}
- m_pPageSetMap.SetAt(pPageSet, iMin);
+ m_pPageSetMap[pPageSet] = iMin;
}
}
}
@@ -1582,7 +1585,7 @@ void CXFA_LayoutPageMgr::ClearData() {
m_pCurPageArea = nullptr;
m_nCurPageCount = 0;
m_bCreateOverFlowPage = false;
- m_pPageSetMap.RemoveAll();
+ m_pPageSetMap.clear();
}
CXFA_LayoutItem* CXFA_LayoutPageMgr::FindOrCreateLayoutItem(
diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.h b/xfa/fxfa/parser/cxfa_layoutpagemgr.h
index b466f3ad1f..1133e1778a 100644
--- a/xfa/fxfa/parser/cxfa_layoutpagemgr.h
+++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.h
@@ -9,6 +9,7 @@
#include <iterator>
#include <list>
+#include <map>
#include "xfa/fxfa/parser/xfa_layout_itemlayout.h"
@@ -119,7 +120,7 @@ class CXFA_LayoutPageMgr {
bool GetNextContentArea(CXFA_Node* pTargetContentArea);
void InitPageSetMap();
void ProcessLastPageSet();
- inline bool IsPageSetRootOrderedOccurrence() {
+ bool IsPageSetRootOrderedOccurrence() const {
return m_ePageSetMode == XFA_ATTRIBUTEENUM_OrderedOccurrence;
}
void ClearData();
@@ -127,6 +128,7 @@ class CXFA_LayoutPageMgr {
void LayoutPageSetContents();
void PrepareLayout();
void SaveLayoutItem(CXFA_LayoutItem* pParentLayoutItem);
+
CXFA_LayoutProcessor* m_pLayoutProcessor;
CXFA_Node* m_pTemplatePageSetRoot;
CXFA_ContainerLayoutItem* m_pPageSetLayoutItemRoot;
@@ -138,7 +140,7 @@ class CXFA_LayoutPageMgr {
int32_t m_nCurPageCount;
XFA_ATTRIBUTEENUM m_ePageSetMode;
bool m_bCreateOverFlowPage;
- CFX_MapPtrTemplate<CXFA_Node*, int32_t> m_pPageSetMap;
+ std::map<CXFA_Node*, int32_t> m_pPageSetMap;
CFX_ArrayTemplate<CXFA_ContainerLayoutItem*> m_PageArray;
};
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 1bde816d3d..bc2a10c08b 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -4901,19 +4901,21 @@ XFA_MAPMODULEDATA* CXFA_Node::GetMapModuleData() const {
void CXFA_Node::SetMapModuleValue(void* pKey, void* pValue) {
XFA_MAPMODULEDATA* pModule = CreateMapModuleData();
- pModule->m_ValueMap.SetAt(pKey, pValue);
+ pModule->m_ValueMap[pKey] = pValue;
}
bool CXFA_Node::GetMapModuleValue(void* pKey, void*& pValue) {
- CXFA_Node* pNode = this;
- while (pNode) {
+ for (CXFA_Node* pNode = this; pNode; pNode = pNode->GetTemplateNode()) {
XFA_MAPMODULEDATA* pModule = pNode->GetMapModuleData();
- if (pModule && pModule->m_ValueMap.Lookup(pKey, pValue)) {
- return true;
+ if (pModule) {
+ auto it = pModule->m_ValueMap.find(pKey);
+ if (it != pModule->m_ValueMap.end()) {
+ pValue = it->second;
+ return true;
+ }
}
- pNode = pNode->GetPacketID() != XFA_XDPPACKET_Datasets
- ? pNode->GetTemplateNode()
- : nullptr;
+ if (pNode->GetPacketID() == XFA_XDPPACKET_Datasets)
+ break;
}
return false;
}
@@ -4965,37 +4967,40 @@ bool CXFA_Node::GetMapModuleBuffer(void* pKey,
int32_t& iBytes,
bool bProtoAlso) const {
XFA_MAPDATABLOCK* pBuffer = nullptr;
- const CXFA_Node* pNode = this;
- while (pNode) {
+ for (const CXFA_Node* pNode = this; pNode; pNode = pNode->GetTemplateNode()) {
XFA_MAPMODULEDATA* pModule = pNode->GetMapModuleData();
- if (pModule && pModule->m_BufferMap.Lookup(pKey, pBuffer)) {
- break;
+ if (pModule) {
+ auto it = pModule->m_BufferMap.find(pKey);
+ if (it != pModule->m_BufferMap.end()) {
+ pBuffer = it->second;
+ break;
+ }
}
- pNode = (bProtoAlso && pNode->GetPacketID() != XFA_XDPPACKET_Datasets)
- ? pNode->GetTemplateNode()
- : nullptr;
+ if (!bProtoAlso || pNode->GetPacketID() == XFA_XDPPACKET_Datasets)
+ break;
}
- if (!pBuffer) {
+ if (!pBuffer)
return false;
- }
+
pValue = pBuffer->GetData();
iBytes = pBuffer->iBytes;
return true;
}
bool CXFA_Node::HasMapModuleKey(void* pKey, bool bProtoAlso) {
- CXFA_Node* pNode = this;
- while (pNode) {
- void* pVal;
+ for (CXFA_Node* pNode = this; pNode; pNode = pNode->GetTemplateNode()) {
XFA_MAPMODULEDATA* pModule = pNode->GetMapModuleData();
- if (pModule &&
- (pModule->m_ValueMap.Lookup(pKey, pVal) ||
- pModule->m_BufferMap.Lookup(pKey, (XFA_MAPDATABLOCK*&)pVal))) {
- return true;
+ if (pModule) {
+ auto it1 = pModule->m_ValueMap.find(pKey);
+ if (it1 != pModule->m_ValueMap.end())
+ return true;
+
+ auto it2 = pModule->m_BufferMap.find(pKey);
+ if (it2 != pModule->m_BufferMap.end())
+ return true;
}
- pNode = (bProtoAlso && pNode->GetPacketID() != XFA_XDPPACKET_Datasets)
- ? pNode->GetTemplateNode()
- : nullptr;
+ if (!bProtoAlso || pNode->GetPacketID() == XFA_XDPPACKET_Datasets)
+ break;
}
return false;
}
@@ -5006,87 +5011,75 @@ void CXFA_Node::RemoveMapModuleKey(void* pKey) {
return;
if (pKey) {
- XFA_MAPDATABLOCK* pBuffer = nullptr;
- pModule->m_BufferMap.Lookup(pKey, pBuffer);
- if (pBuffer) {
- if (pBuffer->pCallbackInfo && pBuffer->pCallbackInfo->pFree) {
- pBuffer->pCallbackInfo->pFree(*(void**)pBuffer->GetData());
- }
- FX_Free(pBuffer);
- }
- pModule->m_BufferMap.RemoveKey(pKey);
- pModule->m_ValueMap.RemoveKey(pKey);
- } else {
- XFA_MAPDATABLOCK* pBuffer;
- FX_POSITION posBuffer = pModule->m_BufferMap.GetStartPosition();
- while (posBuffer) {
- pModule->m_BufferMap.GetNextAssoc(posBuffer, pKey, pBuffer);
+ auto it = pModule->m_BufferMap.find(pKey);
+ if (it != pModule->m_BufferMap.end()) {
+ XFA_MAPDATABLOCK* pBuffer = it->second;
if (pBuffer) {
- if (pBuffer->pCallbackInfo && pBuffer->pCallbackInfo->pFree) {
+ if (pBuffer->pCallbackInfo && pBuffer->pCallbackInfo->pFree)
pBuffer->pCallbackInfo->pFree(*(void**)pBuffer->GetData());
- }
FX_Free(pBuffer);
}
+ pModule->m_BufferMap.erase(it);
}
- pModule->m_BufferMap.RemoveAll();
- pModule->m_ValueMap.RemoveAll();
- delete pModule;
+ pModule->m_ValueMap.erase(pKey);
+ return;
}
+
+ for (auto& pair : pModule->m_BufferMap) {
+ XFA_MAPDATABLOCK* pBuffer = pair.second;
+ if (pBuffer) {
+ if (pBuffer->pCallbackInfo && pBuffer->pCallbackInfo->pFree)
+ pBuffer->pCallbackInfo->pFree(*(void**)pBuffer->GetData());
+ FX_Free(pBuffer);
+ }
+ }
+ pModule->m_BufferMap.clear();
+ pModule->m_ValueMap.clear();
+ delete pModule;
}
-void CXFA_Node::MergeAllData(void* pDstModule, bool bUseSrcAttr) {
+void CXFA_Node::MergeAllData(void* pDstModule) {
XFA_MAPMODULEDATA* pDstModuleData =
static_cast<CXFA_Node*>(pDstModule)->CreateMapModuleData();
XFA_MAPMODULEDATA* pSrcModuleData = GetMapModuleData();
- if (!pSrcModuleData) {
+ if (!pSrcModuleData)
return;
- }
- FX_POSITION psValue = pSrcModuleData->m_ValueMap.GetStartPosition();
- while (psValue) {
- void* pKey;
- void* pValue;
- pSrcModuleData->m_ValueMap.GetNextAssoc(psValue, pKey, pValue);
- if (bUseSrcAttr || !pDstModuleData->m_ValueMap.GetValueAt(pKey)) {
- pDstModuleData->m_ValueMap.SetAt(pKey, pValue);
- }
- }
- FX_POSITION psBuffer = pSrcModuleData->m_BufferMap.GetStartPosition();
- while (psBuffer) {
- void* pKey;
- XFA_MAPDATABLOCK* pSrcBuffer;
- pSrcModuleData->m_BufferMap.GetNextAssoc(psBuffer, pKey, pSrcBuffer);
- XFA_MAPDATABLOCK*& pBuffer = pDstModuleData->m_BufferMap[pKey];
- if (pBuffer && !bUseSrcAttr) {
- continue;
- }
+
+ for (const auto& pair : pSrcModuleData->m_ValueMap)
+ pDstModuleData->m_ValueMap[pair.first] = pair.second;
+
+ for (const auto& pair : pSrcModuleData->m_BufferMap) {
+ XFA_MAPDATABLOCK* pSrcBuffer = pair.second;
+ XFA_MAPDATABLOCK*& pDstBuffer = pDstModuleData->m_BufferMap[pair.first];
if (pSrcBuffer->pCallbackInfo && pSrcBuffer->pCallbackInfo->pFree &&
!pSrcBuffer->pCallbackInfo->pCopy) {
- if (pBuffer) {
- pBuffer->pCallbackInfo->pFree(*(void**)pBuffer->GetData());
- pDstModuleData->m_BufferMap.RemoveKey(pKey);
+ if (pDstBuffer) {
+ pDstBuffer->pCallbackInfo->pFree(*(void**)pDstBuffer->GetData());
+ pDstModuleData->m_BufferMap.erase(pair.first);
}
continue;
}
- if (!pBuffer) {
- pBuffer = (XFA_MAPDATABLOCK*)FX_Alloc(
+ if (!pDstBuffer) {
+ pDstBuffer = (XFA_MAPDATABLOCK*)FX_Alloc(
uint8_t, sizeof(XFA_MAPDATABLOCK) + pSrcBuffer->iBytes);
- } else if (pBuffer->iBytes != pSrcBuffer->iBytes) {
- if (pBuffer->pCallbackInfo && pBuffer->pCallbackInfo->pFree) {
- pBuffer->pCallbackInfo->pFree(*(void**)pBuffer->GetData());
+ } else if (pDstBuffer->iBytes != pSrcBuffer->iBytes) {
+ if (pDstBuffer->pCallbackInfo && pDstBuffer->pCallbackInfo->pFree) {
+ pDstBuffer->pCallbackInfo->pFree(*(void**)pDstBuffer->GetData());
}
- pBuffer = (XFA_MAPDATABLOCK*)FX_Realloc(
- uint8_t, pBuffer, sizeof(XFA_MAPDATABLOCK) + pSrcBuffer->iBytes);
- } else if (pBuffer->pCallbackInfo && pBuffer->pCallbackInfo->pFree) {
- pBuffer->pCallbackInfo->pFree(*(void**)pBuffer->GetData());
+ pDstBuffer = (XFA_MAPDATABLOCK*)FX_Realloc(
+ uint8_t, pDstBuffer, sizeof(XFA_MAPDATABLOCK) + pSrcBuffer->iBytes);
+ } else if (pDstBuffer->pCallbackInfo && pDstBuffer->pCallbackInfo->pFree) {
+ pDstBuffer->pCallbackInfo->pFree(*(void**)pDstBuffer->GetData());
}
- if (!pBuffer) {
+ if (!pDstBuffer) {
continue;
}
- pBuffer->pCallbackInfo = pSrcBuffer->pCallbackInfo;
- pBuffer->iBytes = pSrcBuffer->iBytes;
- FXSYS_memcpy(pBuffer->GetData(), pSrcBuffer->GetData(), pSrcBuffer->iBytes);
- if (pBuffer->pCallbackInfo && pBuffer->pCallbackInfo->pCopy) {
- pBuffer->pCallbackInfo->pCopy(*(void**)pBuffer->GetData());
+ pDstBuffer->pCallbackInfo = pSrcBuffer->pCallbackInfo;
+ pDstBuffer->iBytes = pSrcBuffer->iBytes;
+ FXSYS_memcpy(pDstBuffer->GetData(), pSrcBuffer->GetData(),
+ pSrcBuffer->iBytes);
+ if (pDstBuffer->pCallbackInfo && pDstBuffer->pCallbackInfo->pCopy) {
+ pDstBuffer->pCallbackInfo->pCopy(*(void**)pDstBuffer->GetData());
}
}
}
@@ -5112,12 +5105,13 @@ void CXFA_Node::MoveBufferMapData(CXFA_Node* pDstModule, void* pKey) {
pDstModuleData = pDstModule->CreateMapModuleData();
}
if (bNeedMove) {
- void* pBufferBlockData = pSrcModuleData->m_BufferMap.GetValueAt(pKey);
- if (pBufferBlockData) {
- pSrcModuleData->m_BufferMap.RemoveKey(pKey);
- pDstModuleData->m_BufferMap.RemoveKey(pKey);
- pDstModuleData->m_BufferMap.SetAt(pKey,
- (XFA_MAPDATABLOCK*)pBufferBlockData);
+ auto it = pSrcModuleData->m_BufferMap.find(pKey);
+ if (it != pSrcModuleData->m_BufferMap.end()) {
+ XFA_MAPDATABLOCK* pBufferBlockData = it->second;
+ if (pBufferBlockData) {
+ pSrcModuleData->m_BufferMap.erase(pKey);
+ pDstModuleData->m_BufferMap[pKey] = pBufferBlockData;
+ }
}
}
if (pDstModule->IsNodeV()) {
diff --git a/xfa/fxfa/parser/cxfa_scriptcontext.cpp b/xfa/fxfa/parser/cxfa_scriptcontext.cpp
index 60ee722c91..b33d4efda4 100644
--- a/xfa/fxfa/parser/cxfa_scriptcontext.cpp
+++ b/xfa/fxfa/parser/cxfa_scriptcontext.cpp
@@ -125,17 +125,12 @@ CXFA_ScriptContext::CXFA_ScriptContext(CXFA_Document* pDocument)
m_eRunAtType(XFA_ATTRIBUTEENUM_Client) {}
CXFA_ScriptContext::~CXFA_ScriptContext() {
- FX_POSITION ps = m_mapVariableToContext.GetStartPosition();
- while (ps) {
- CXFA_Object* pScriptNode;
- CFXJSE_Context* pVariableContext = nullptr;
- m_mapVariableToContext.GetNextAssoc(ps, pScriptNode, pVariableContext);
-
+ for (const auto& pair : m_mapVariableToContext) {
+ CFXJSE_Context* pVariableContext = pair.second;
delete ToThisProxy(pVariableContext->GetGlobalObject().get(), nullptr);
delete pVariableContext;
}
- m_mapVariableToContext.RemoveAll();
-
+ m_mapVariableToContext.clear();
m_upObjectArray.RemoveAll();
}
@@ -461,7 +456,7 @@ CFXJSE_Context* CXFA_ScriptContext::CreateVariablesContext(
new CXFA_ThisProxy(pSubform, pScriptNode));
RemoveBuiltInObjs(pVariablesContext);
pVariablesContext->EnableCompatibleMode();
- m_mapVariableToContext.SetAt(pScriptNode, pVariablesContext);
+ m_mapVariableToContext[pScriptNode] = pVariablesContext;
return pVariablesContext;
}
CXFA_Object* CXFA_ScriptContext::GetVariablesThis(CXFA_Object* pObject,
@@ -484,7 +479,8 @@ bool CXFA_ScriptContext::RunVariablesScript(CXFA_Node* pScriptNode) {
if (!pParent || pParent->GetElementType() != XFA_Element::Variables)
return false;
- if (m_mapVariableToContext.GetValueAt(pScriptNode))
+ auto it = m_mapVariableToContext.find(pScriptNode);
+ if (it != m_mapVariableToContext.end() && it->second)
return true;
CXFA_Node* pTextNode = pScriptNode->GetNodeItem(XFA_NODEITEM_FirstChild);
@@ -521,10 +517,11 @@ bool CXFA_ScriptContext::QueryVariableValue(CXFA_Node* pScriptNode,
variablesNode->GetElementType() != XFA_Element::Variables)
return false;
- void* lpVariables = m_mapVariableToContext.GetValueAt(pScriptNode);
- if (!lpVariables)
+ auto it = m_mapVariableToContext.find(pScriptNode);
+ if (it == m_mapVariableToContext.end() || !it->second)
return false;
+ void* lpVariables = it->second;
bool bRes = false;
CFXJSE_Context* pVariableContext = static_cast<CFXJSE_Context*>(lpVariables);
std::unique_ptr<CFXJSE_Value> pObject = pVariableContext->GetGlobalObject();
diff --git a/xfa/fxfa/parser/cxfa_scriptcontext.h b/xfa/fxfa/parser/cxfa_scriptcontext.h
index 664e3315bf..6d4f73a632 100644
--- a/xfa/fxfa/parser/cxfa_scriptcontext.h
+++ b/xfa/fxfa/parser/cxfa_scriptcontext.h
@@ -109,7 +109,7 @@ class CXFA_ScriptContext {
CFXJSE_Class* m_pJsClass;
XFA_SCRIPTLANGTYPE m_eScriptType;
std::map<CXFA_Object*, std::unique_ptr<CFXJSE_Value>> m_mapObjectToValue;
- CFX_MapPtrTemplate<CXFA_Object*, CFXJSE_Context*> m_mapVariableToContext;
+ std::map<CXFA_Object*, CFXJSE_Context*> m_mapVariableToContext;
CXFA_EventParam m_eventParam;
CXFA_NodeArray m_upObjectArray;
// CacheList holds the NodeList items so we can clean them up when we're done.
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 <map>
#include <vector>
#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<CXFA_Node*, CXFA_Node*> subformMapArray;
+ std::map<CXFA_Node*, CXFA_Node*> 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<CXFA_Node*>(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();
diff --git a/xfa/fxfa/parser/xfa_object.h b/xfa/fxfa/parser/xfa_object.h
index 93f4e0145d..8be19ec2e1 100644
--- a/xfa/fxfa/parser/xfa_object.h
+++ b/xfa/fxfa/parser/xfa_object.h
@@ -7,6 +7,7 @@
#ifndef XFA_FXFA_PARSER_XFA_OBJECT_H_
#define XFA_FXFA_PARSER_XFA_OBJECT_H_
+#include <map>
#include <unordered_set>
#include "fxjs/cfxjse_arguments.h"
@@ -144,8 +145,8 @@ struct XFA_MAPMODULEDATA {
XFA_MAPMODULEDATA();
~XFA_MAPMODULEDATA();
- CFX_MapPtrToPtr m_ValueMap;
- CFX_MapPtrTemplate<void*, XFA_MAPDATABLOCK*> m_BufferMap;
+ std::map<void*, void*> m_ValueMap;
+ std::map<void*, XFA_MAPDATABLOCK*> m_BufferMap;
};
#define XFA_CalcRefCount (void*)(uintptr_t) FXBSTR_ID('X', 'F', 'A', 'R')
@@ -665,7 +666,7 @@ class CXFA_Node : public CXFA_Object {
bool bProtoAlso = true) const;
bool HasMapModuleKey(void* pKey, bool bProtoAlso = false);
void RemoveMapModuleKey(void* pKey = nullptr);
- void MergeAllData(void* pDstModule, bool bUseSrcAttr = true);
+ void MergeAllData(void* pDstModule);
void MoveBufferMapData(CXFA_Node* pDstModule, void* pKey);
void MoveBufferMapData(CXFA_Node* pSrcModule,
CXFA_Node* pDstModule,