summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-04-28 15:27:54 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-04-28 23:05:15 +0000
commit4536a47bc4581a5344fba9c5491464bf9b7261c9 (patch)
tree76e61968811282198e5f075ca595b47127b47e59 /xfa/fxfa/parser
parent84faa032e327ad61e38197114a164e969051b5af (diff)
downloadpdfium-4536a47bc4581a5344fba9c5491464bf9b7261c9.tar.xz
Remove some more |new|s, part 4.
FindMatchingDataNode(): The callers that passed null iterators, triggering the new, are perfectly capable of making their own iterators. Change-Id: I712fa36667d6070b43f237916e448d518e8855c2 Reviewed-on: https://pdfium-review.googlesource.com/4616 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r--xfa/fxfa/parser/xfa_document_datamerger_imp.cpp24
1 files changed, 10 insertions, 14 deletions
diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
index 46a2af4a76..ab6f155ae5 100644
--- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
@@ -551,16 +551,9 @@ CXFA_Node* FindMatchingDataNode(
bool& bSelfMatch,
XFA_ATTRIBUTEENUM& eBindMatch,
bool bUpLevel) {
- bool bOwnIterator = false;
- if (!pIterator) {
- bOwnIterator = true;
- pIterator = new CXFA_NodeIteratorTemplate<
- CXFA_Node, CXFA_TraverseStrategy_XFAContainerNode>(pTemplateNode);
- }
-
CXFA_Node* pResult = nullptr;
- for (CXFA_Node* pCurTemplateNode = pIterator->GetCurrent();
- pCurTemplateNode;) {
+ CXFA_Node* pCurTemplateNode = pIterator->GetCurrent();
+ while (pCurTemplateNode) {
XFA_Element eMatchNodeType;
switch (pCurTemplateNode->GetElementType()) {
case XFA_Element::Subform:
@@ -650,8 +643,6 @@ CXFA_Node* FindMatchingDataNode(
bSelfMatch = true;
break;
}
- if (bOwnIterator)
- delete pIterator;
return pResult;
}
@@ -823,9 +814,12 @@ CXFA_Node* CopyContainer_SubformSet(CXFA_Document* pDocument,
bSelfMatch = false;
eBindMatch = XFA_ATTRIBUTEENUM_None;
if (eRelation != XFA_ATTRIBUTEENUM_Ordered) {
+ CXFA_NodeIteratorTemplate<CXFA_Node,
+ CXFA_TraverseStrategy_XFAContainerNode>
+ sChildIter(pTemplateChild);
CXFA_Node* pDataMatch = FindMatchingDataNode(
pDocument, pTemplateChild, pDataScope, bAccessedDataDOM,
- false, nullptr, bSelfMatch, eBindMatch, true);
+ false, &sChildIter, bSelfMatch, eBindMatch, true);
if (pDataMatch) {
RecurseRecord sNewRecord = {pTemplateChild, pDataMatch};
if (bSelfMatch)
@@ -989,9 +983,11 @@ CXFA_Node* CopyContainer_Field(CXFA_Document* pDocument,
bool bAccessedDataDOM = false;
bool bSelfMatch = false;
XFA_ATTRIBUTEENUM eBindMatch;
+ CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFAContainerNode>
+ sNodeIter(pTemplateNode);
CXFA_Node* pDataNode = FindMatchingDataNode(
- pDocument, pTemplateNode, pDataScope, bAccessedDataDOM, true, nullptr,
- bSelfMatch, eBindMatch, bUpLevel);
+ pDocument, pTemplateNode, pDataScope, bAccessedDataDOM, true,
+ &sNodeIter, bSelfMatch, eBindMatch, bUpLevel);
if (pDataNode)
CreateDataBinding(pFieldNode, pDataNode, true);
} else {