diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-12-04 18:20:07 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-12-04 18:20:07 +0000 |
commit | 9256ad5784fc437f60fbeb836fe2ecd18e028a5d (patch) | |
tree | 484d9e9c4697d50800c574b58d5db4cfa349b27c | |
parent | 76e336d26e78f6c6b5cdede6bb4b94ebddf3a2b1 (diff) | |
download | pdfium-9256ad5784fc437f60fbeb836fe2ecd18e028a5d.tar.xz |
Cleanup ResolveObjects params and return
The return value of ResolveObjects is always used as a boolean, so
change from int32_t. The XFA_RESOLVENODE_RS object was made a pointer
from a ref.
Change-Id: I030036c01101680e36f4ddf524b468354a2e6850
Reviewed-on: https://pdfium-review.googlesource.com/20331
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
-rw-r--r-- | fxjs/cfxjse_engine.cpp | 29 | ||||
-rw-r--r-- | fxjs/cfxjse_engine.h | 10 | ||||
-rw-r--r-- | fxjs/cfxjse_formcalc_context.cpp | 45 | ||||
-rw-r--r-- | fxjs/cfxjse_formcalc_context.h | 12 | ||||
-rw-r--r-- | fxjs/cfxjse_resolveprocessor.cpp | 12 | ||||
-rw-r--r-- | fxjs/cfxjse_resolveprocessor.h | 2 | ||||
-rw-r--r-- | fxjs/cjx_hostpseudomodel.cpp | 22 | ||||
-rw-r--r-- | fxjs/cjx_node.cpp | 19 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffdocview.cpp | 10 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_document.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_layoutpagemgr.cpp | 9 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 4 |
12 files changed, 89 insertions, 89 deletions
diff --git a/fxjs/cfxjse_engine.cpp b/fxjs/cfxjse_engine.cpp index 3bebec7e5b..a2bebdb7f9 100644 --- a/fxjs/cfxjse_engine.cpp +++ b/fxjs/cfxjse_engine.cpp @@ -173,7 +173,7 @@ bool CFXJSE_Engine::QueryNodeByFlag(CXFA_Node* refNode, return false; XFA_RESOLVENODE_RS resolveRs; - if (ResolveObjects(refNode, propname, resolveRs, dwFlag) <= 0) + if (!ResolveObjects(refNode, propname, &resolveRs, dwFlag, nullptr)) return false; if (resolveRs.dwFlags == XFA_RESOLVENODE_RSTYPE_Nodes) { pValue->Assign(GetJSValueFromMap(resolveRs.objects.front())); @@ -553,13 +553,13 @@ CFXJSE_Class* CFXJSE_Engine::GetJseNormalClass() { return m_pJsClass; } -int32_t CFXJSE_Engine::ResolveObjects(CXFA_Object* refObject, - const WideStringView& wsExpression, - XFA_RESOLVENODE_RS& resolveNodeRS, - uint32_t dwStyles, - CXFA_Node* bindNode) { +bool CFXJSE_Engine::ResolveObjects(CXFA_Object* refObject, + const WideStringView& wsExpression, + XFA_RESOLVENODE_RS* resolveNodeRS, + uint32_t dwStyles, + CXFA_Node* bindNode) { if (wsExpression.IsEmpty()) - return 0; + return false; if (m_eScriptType != CXFA_ScriptData::Type::Formcalc || (dwStyles & (XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings))) { @@ -624,6 +624,7 @@ int32_t CFXJSE_Engine::ResolveObjects(CXFA_Object* refObject, this); if (bCreate) continue; + break; } @@ -695,13 +696,13 @@ int32_t CFXJSE_Engine::ResolveObjects(CXFA_Object* refObject, } if (!bNextCreate) { - resolveNodeRS.dwFlags = rndFind.m_dwFlag; + resolveNodeRS->dwFlags = rndFind.m_dwFlag; if (nNodes > 0) { - resolveNodeRS.objects.insert(resolveNodeRS.objects.end(), - findObjects.begin(), findObjects.end()); + resolveNodeRS->objects.insert(resolveNodeRS->objects.end(), + findObjects.begin(), findObjects.end()); } if (rndFind.m_dwFlag == XFA_RESOLVENODE_RSTYPE_Attribute) { - resolveNodeRS.pScriptAttribute = rndFind.m_pScriptAttribute; + resolveNodeRS->pScriptAttribute = rndFind.m_pScriptAttribute; return 1; } } @@ -710,11 +711,11 @@ int32_t CFXJSE_Engine::ResolveObjects(CXFA_Object* refObject, m_ResolveProcessor->SetResultCreateNode(resolveNodeRS, rndFind.m_wsCondition); if (!bNextCreate && (dwStyles & XFA_RESOLVENODE_CreateNode)) - resolveNodeRS.dwFlags = XFA_RESOLVENODE_RSTYPE_ExistNodes; + resolveNodeRS->dwFlags = XFA_RESOLVENODE_RSTYPE_ExistNodes; - return pdfium::CollectionSize<int32_t>(resolveNodeRS.objects); + return !resolveNodeRS->objects.empty(); } - return nNodes; + return nNodes > 0; } void CFXJSE_Engine::AddToCacheList(std::unique_ptr<CXFA_NodeList> pList) { diff --git a/fxjs/cfxjse_engine.h b/fxjs/cfxjse_engine.h index 66fe7a53e8..a675a390da 100644 --- a/fxjs/cfxjse_engine.h +++ b/fxjs/cfxjse_engine.h @@ -56,11 +56,11 @@ class CFXJSE_Engine { CFXJSE_Value* pRetValue, CXFA_Object* pThisObject); - int32_t ResolveObjects(CXFA_Object* refObject, - const WideStringView& wsExpression, - XFA_RESOLVENODE_RS& resolveNodeRS, - uint32_t dwStyles = XFA_RESOLVENODE_Children, - CXFA_Node* bindNode = nullptr); + bool ResolveObjects(CXFA_Object* refObject, + const WideStringView& wsExpression, + XFA_RESOLVENODE_RS* resolveNodeRS, + uint32_t dwStyles, + CXFA_Node* bindNode); CFXJSE_Value* GetJSValueFromMap(CXFA_Object* pObject); void AddToCacheList(std::unique_ptr<CXFA_NodeList> pList); CXFA_Object* GetThisObject() const { return m_pThisObject; } diff --git a/fxjs/cfxjse_formcalc_context.cpp b/fxjs/cfxjse_formcalc_context.cpp index b396db39b1..4bfe7d8b8b 100644 --- a/fxjs/cfxjse_formcalc_context.cpp +++ b/fxjs/cfxjse_formcalc_context.cpp @@ -5263,7 +5263,7 @@ void CFXJSE_FormCalcContext::dot_accessor(CFXJSE_Value* pThis, XFA_RESOLVENODE_RS resolveNodeRS; if (ResolveObjects(pThis, hJSObjValue.get(), szSomExp.AsStringView(), - resolveNodeRS, true, szName.IsEmpty()) > 0) { + &resolveNodeRS, true, szName.IsEmpty())) { ParseResolveResult(pThis, resolveNodeRS, hJSObjValue.get(), &resolveValues[i - 2], &bAttribute); iCounter += resolveValues[i - 2].size(); @@ -5298,19 +5298,19 @@ void CFXJSE_FormCalcContext::dot_accessor(CFXJSE_Value* pThis, } XFA_RESOLVENODE_RS resolveNodeRS; - int32_t iRet = 0; + bool iRet = false; ByteString bsAccessorName = args.GetUTF8String(1); if (argAccessor->IsObject() || (argAccessor->IsNull() && bsAccessorName.IsEmpty())) { iRet = ResolveObjects(pThis, argAccessor.get(), szSomExp.AsStringView(), - resolveNodeRS, true, szName.IsEmpty()); + &resolveNodeRS, true, szName.IsEmpty()); } else if (!argAccessor->IsObject() && !bsAccessorName.IsEmpty() && GetObjectForName(pThis, argAccessor.get(), bsAccessorName.AsStringView())) { iRet = ResolveObjects(pThis, argAccessor.get(), szSomExp.AsStringView(), - resolveNodeRS, true, szName.IsEmpty()); + &resolveNodeRS, true, szName.IsEmpty()); } - if (iRet < 1) { + if (!iRet) { pContext->ThrowPropertyNotInObjectException( WideString::FromUTF8(szName.AsStringView()), WideString::FromUTF8(szSomExp.AsStringView())); @@ -5381,7 +5381,7 @@ void CFXJSE_FormCalcContext::dotdot_accessor(CFXJSE_Value* pThis, argAccessor->GetObjectPropertyByIdx(i, hJSObjValue.get()); XFA_RESOLVENODE_RS resolveNodeRS; if (ResolveObjects(pThis, hJSObjValue.get(), szSomExp.AsStringView(), - resolveNodeRS, false) > 0) { + &resolveNodeRS, false, false)) { ParseResolveResult(pThis, resolveNodeRS, hJSObjValue.get(), &resolveValues[i - 2], &bAttribute); iCounter += resolveValues[i - 2].size(); @@ -5416,19 +5416,19 @@ void CFXJSE_FormCalcContext::dotdot_accessor(CFXJSE_Value* pThis, } XFA_RESOLVENODE_RS resolveNodeRS; - int32_t iRet = 0; + bool iRet = false; ByteString bsAccessorName = args.GetUTF8String(1); if (argAccessor->IsObject() || (argAccessor->IsNull() && bsAccessorName.IsEmpty())) { iRet = ResolveObjects(pThis, argAccessor.get(), szSomExp.AsStringView(), - resolveNodeRS, false); + &resolveNodeRS, false, false); } else if (!argAccessor->IsObject() && !bsAccessorName.IsEmpty() && GetObjectForName(pThis, argAccessor.get(), bsAccessorName.AsStringView())) { iRet = ResolveObjects(pThis, argAccessor.get(), szSomExp.AsStringView(), - resolveNodeRS, false); + &resolveNodeRS, false, false); } - if (iRet < 1) { + if (!iRet) { pContext->ThrowPropertyNotInObjectException( WideString::FromUTF8(szName.AsStringView()), WideString::FromUTF8(szSomExp.AsStringView())); @@ -5913,11 +5913,11 @@ bool CFXJSE_FormCalcContext::GetObjectForName( XFA_RESOLVENODE_RS resolveNodeRS; uint32_t dwFlags = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; - int32_t iRet = pScriptContext->ResolveObjects( + bool iRet = pScriptContext->ResolveObjects( pScriptContext->GetThisObject(), - WideString::FromUTF8(szAccessorName).AsStringView(), resolveNodeRS, - dwFlags); - if (iRet >= 1 && resolveNodeRS.dwFlags == XFA_RESOLVENODE_RSTYPE_Nodes) { + WideString::FromUTF8(szAccessorName).AsStringView(), &resolveNodeRS, + dwFlags, nullptr); + if (iRet && resolveNodeRS.dwFlags == XFA_RESOLVENODE_RSTYPE_Nodes) { accessorValue->Assign( pScriptContext->GetJSValueFromMap(resolveNodeRS.objects.front())); return true; @@ -5926,16 +5926,15 @@ bool CFXJSE_FormCalcContext::GetObjectForName( } // static -int32_t CFXJSE_FormCalcContext::ResolveObjects( - CFXJSE_Value* pThis, - CFXJSE_Value* pRefValue, - const ByteStringView& bsSomExp, - XFA_RESOLVENODE_RS& resolveNodeRS, - bool bdotAccessor, - bool bHasNoResolveName) { +bool CFXJSE_FormCalcContext::ResolveObjects(CFXJSE_Value* pThis, + CFXJSE_Value* pRefValue, + const ByteStringView& bsSomExp, + XFA_RESOLVENODE_RS* resolveNodeRS, + bool bdotAccessor, + bool bHasNoResolveName) { CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument(); if (!pDoc) - return -1; + return false; WideString wsSomExpression = WideString::FromUTF8(bsSomExp); CFXJSE_Engine* pScriptContext = pDoc->GetScriptContext(); @@ -5973,7 +5972,7 @@ int32_t CFXJSE_FormCalcContext::ResolveObjects( dFlags = XFA_RESOLVENODE_AnyChild; } return pScriptContext->ResolveObjects(pNode, wsSomExpression.AsStringView(), - resolveNodeRS, dFlags); + resolveNodeRS, dFlags, nullptr); } // static diff --git a/fxjs/cfxjse_formcalc_context.h b/fxjs/cfxjse_formcalc_context.h index ba331426df..51e3178c13 100644 --- a/fxjs/cfxjse_formcalc_context.h +++ b/fxjs/cfxjse_formcalc_context.h @@ -392,12 +392,12 @@ class CFXJSE_FormCalcContext : public CFXJSE_HostObject { static bool GetObjectForName(CFXJSE_Value* pThis, CFXJSE_Value* accessorValue, const ByteStringView& szAccessorName); - static int32_t ResolveObjects(CFXJSE_Value* pThis, - CFXJSE_Value* pParentValue, - const ByteStringView& bsSomExp, - XFA_RESOLVENODE_RS& resolveNodeRS, - bool bdotAccessor = true, - bool bHasNoResolveName = false); + static bool ResolveObjects(CFXJSE_Value* pThis, + CFXJSE_Value* pParentValue, + const ByteStringView& bsSomExp, + XFA_RESOLVENODE_RS* resolveNodeRS, + bool bdotAccessor, + bool bHasNoResolveName); static void ParseResolveResult( CFXJSE_Value* pThis, const XFA_RESOLVENODE_RS& resolveNodeRS, diff --git a/fxjs/cfxjse_resolveprocessor.cpp b/fxjs/cfxjse_resolveprocessor.cpp index fb7bc555c6..eeeeefcf08 100644 --- a/fxjs/cfxjse_resolveprocessor.cpp +++ b/fxjs/cfxjse_resolveprocessor.cpp @@ -714,19 +714,19 @@ void CFXJSE_ResolveProcessor::SetStylesForChild(uint32_t dwParentStyles, } int32_t CFXJSE_ResolveProcessor::SetResultCreateNode( - XFA_RESOLVENODE_RS& resolveNodeRS, + XFA_RESOLVENODE_RS* resolveNodeRS, WideString& wsLastCondition) { if (m_pNodeHelper->m_pCreateParent) - resolveNodeRS.objects.push_back(m_pNodeHelper->m_pCreateParent); + resolveNodeRS->objects.push_back(m_pNodeHelper->m_pCreateParent); else m_pNodeHelper->CreateNode_ForCondition(wsLastCondition); - resolveNodeRS.dwFlags = m_pNodeHelper->m_iCreateFlag; - if (resolveNodeRS.dwFlags == XFA_RESOLVENODE_RSTYPE_CreateNodeOne) { + resolveNodeRS->dwFlags = m_pNodeHelper->m_iCreateFlag; + if (resolveNodeRS->dwFlags == XFA_RESOLVENODE_RSTYPE_CreateNodeOne) { if (m_pNodeHelper->m_iCurAllStart != -1) - resolveNodeRS.dwFlags = XFA_RESOLVENODE_RSTYPE_CreateNodeMidAll; + resolveNodeRS->dwFlags = XFA_RESOLVENODE_RSTYPE_CreateNodeMidAll; } - return pdfium::CollectionSize<int32_t>(resolveNodeRS.objects); + return pdfium::CollectionSize<int32_t>(resolveNodeRS->objects); } void CFXJSE_ResolveProcessor::SetIndexDataBind(WideString& wsNextCondition, diff --git a/fxjs/cfxjse_resolveprocessor.h b/fxjs/cfxjse_resolveprocessor.h index dc6b9cc6b9..23ecd52d1a 100644 --- a/fxjs/cfxjse_resolveprocessor.h +++ b/fxjs/cfxjse_resolveprocessor.h @@ -41,7 +41,7 @@ class CFXJSE_ResolveProcessor { int32_t GetFilter(const WideStringView& wsExpression, int32_t nStart, CFXJSE_ResolveNodeData& rnd); - int32_t SetResultCreateNode(XFA_RESOLVENODE_RS& resolveNodeRS, + int32_t SetResultCreateNode(XFA_RESOLVENODE_RS* resolveNodeRS, WideString& wsLastCondition); void SetIndexDataBind(WideString& wsNextCondition, int32_t& iIndex, diff --git a/fxjs/cjx_hostpseudomodel.cpp b/fxjs/cjx_hostpseudomodel.cpp index 0e26a19048..8838c891d9 100644 --- a/fxjs/cjx_hostpseudomodel.cpp +++ b/fxjs/cjx_hostpseudomodel.cpp @@ -283,10 +283,10 @@ void CJX_HostPseudoModel::OpenList(CFXJSE_Arguments* pArguments) { uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; XFA_RESOLVENODE_RS resolveNodeRS; - int32_t iRet = pScriptContext->ResolveObjects( - pObject, pValue->ToWideString().AsStringView(), resolveNodeRS, - dwFlag); - if (iRet < 1 || !resolveNodeRS.objects.front()->IsNode()) + bool iRet = pScriptContext->ResolveObjects( + pObject, pValue->ToWideString().AsStringView(), &resolveNodeRS, + dwFlag, nullptr); + if (!iRet || !resolveNodeRS.objects.front()->IsNode()) return; pNode = resolveNodeRS.objects.front()->AsNode(); @@ -387,9 +387,9 @@ void CJX_HostPseudoModel::ResetData(CFXJSE_Arguments* pArguments) { uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; XFA_RESOLVENODE_RS resolveNodeRS; - int32_t iRet = pScriptContext->ResolveObjects( - pObject, wsName.AsStringView(), resolveNodeRS, dwFlag); - if (iRet < 1 || !resolveNodeRS.objects.front()->IsNode()) + bool iRet = pScriptContext->ResolveObjects(pObject, wsName.AsStringView(), + &resolveNodeRS, dwFlag, nullptr); + if (!iRet || !resolveNodeRS.objects.front()->IsNode()) continue; pNode = resolveNodeRS.objects.front()->AsNode(); @@ -451,10 +451,10 @@ void CJX_HostPseudoModel::SetFocus(CFXJSE_Arguments* pArguments) { uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; XFA_RESOLVENODE_RS resolveNodeRS; - int32_t iRet = pScriptContext->ResolveObjects( - pObject, pValue->ToWideString().AsStringView(), resolveNodeRS, - dwFlag); - if (iRet < 1 || !resolveNodeRS.objects.front()->IsNode()) + bool iRet = pScriptContext->ResolveObjects( + pObject, pValue->ToWideString().AsStringView(), &resolveNodeRS, + dwFlag, nullptr); + if (!iRet || !resolveNodeRS.objects.front()->IsNode()) return; pNode = resolveNodeRS.objects.front()->AsNode(); diff --git a/fxjs/cjx_node.cpp b/fxjs/cjx_node.cpp index 2865ba4fbf..8bf00f585f 100644 --- a/fxjs/cjx_node.cpp +++ b/fxjs/cjx_node.cpp @@ -411,9 +411,8 @@ void CJX_Node::Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments) { XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; XFA_RESOLVENODE_RS resolveNodeRS; - int32_t iRet = pScriptContext->ResolveObjects( - refNode, wsExpression.AsStringView(), resolveNodeRS, dwFlag); - if (iRet < 1) { + if (!pScriptContext->ResolveObjects(refNode, wsExpression.AsStringView(), + &resolveNodeRS, dwFlag, nullptr)) { pArguments->GetReturnValue()->SetNull(); return; } @@ -469,13 +468,12 @@ void CJX_Node::ResolveNodeList(CFXJSE_Value* pValue, CFXJSE_Engine* pScriptContext = GetDocument()->GetScriptContext(); if (!pScriptContext) return; - - XFA_RESOLVENODE_RS resolveNodeRS; if (!refNode) refNode = GetXFANode(); + XFA_RESOLVENODE_RS resolveNodeRS; pScriptContext->ResolveObjects(refNode, wsExpression.AsStringView(), - resolveNodeRS, dwFlag); + &resolveNodeRS, dwFlag, nullptr); CXFA_ArrayNodeList* pNodeList = new CXFA_ArrayNodeList(GetDocument()); if (resolveNodeRS.dwFlags == XFA_RESOLVENODE_RSTYPE_Nodes) { for (CXFA_Object* pObject : resolveNodeRS.objects) { @@ -1236,12 +1234,13 @@ void CJX_Node::Script_Attribute_String(CFXJSE_Value* pValue, CXFA_Node* pProtoNode = nullptr; if (!wsSOM.IsEmpty()) { XFA_RESOLVENODE_RS resolveNodeRS; - int32_t iRet = GetDocument()->GetScriptContext()->ResolveObjects( - pProtoRoot, wsSOM.AsStringView(), resolveNodeRS, + bool iRet = GetDocument()->GetScriptContext()->ResolveObjects( + pProtoRoot, wsSOM.AsStringView(), &resolveNodeRS, XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | - XFA_RESOLVENODE_Siblings); - if (iRet > 0 && resolveNodeRS.objects.front()->IsNode()) + XFA_RESOLVENODE_Siblings, + nullptr); + if (iRet && resolveNodeRS.objects.front()->IsNode()) pProtoNode = resolveNodeRS.objects.front()->AsNode(); } else if (!wsID.IsEmpty()) { diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp index b3f5dab25c..f7704509f6 100644 --- a/xfa/fxfa/cxfa_ffdocview.cpp +++ b/xfa/fxfa/cxfa_ffdocview.cpp @@ -501,10 +501,10 @@ CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName( } XFA_RESOLVENODE_RS resolveNodeRS; - int32_t iRet = pScriptContext->ResolveObjects( - refNode, wsExpression.AsStringView(), resolveNodeRS, dwStyle); - if (iRet < 1) + if (!pScriptContext->ResolveObjects(refNode, wsExpression.AsStringView(), + &resolveNodeRS, dwStyle, nullptr)) { return nullptr; + } if (resolveNodeRS.dwFlags == XFA_RESOLVENODE_RSTYPE_Nodes) { CXFA_Node* pNode = resolveNodeRS.objects.front()->AsNode(); @@ -716,8 +716,8 @@ void CXFA_FFDocView::RunBindItems() { XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_ALL; XFA_RESOLVENODE_RS rs; - pScriptContext->ResolveObjects(pWidgetNode, wsRef.AsStringView(), rs, - dwStyle); + pScriptContext->ResolveObjects(pWidgetNode, wsRef.AsStringView(), &rs, + dwStyle, nullptr); pAcc->DeleteItem(-1, false, false); if (rs.dwFlags != XFA_RESOLVENODE_RSTYPE_Nodes || rs.objects.empty()) continue; diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp index a737baaafb..8e0d25d3a4 100644 --- a/xfa/fxfa/parser/cxfa_document.cpp +++ b/xfa/fxfa/parser/cxfa_document.cpp @@ -406,8 +406,8 @@ void CXFA_Document::DoProtoMerge() { XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; XFA_RESOLVENODE_RS resolveNodeRS; - int32_t iRet = m_pScriptContext->ResolveObjects(pUseHrefNode, wsSOM, - resolveNodeRS, dwFlag); + int32_t iRet = m_pScriptContext->ResolveObjects( + pUseHrefNode, wsSOM, &resolveNodeRS, dwFlag, nullptr); if (iRet > 0 && resolveNodeRS.objects.front()->IsNode()) pProtoNode = resolveNodeRS.objects.front()->AsNode(); } else if (!wsID.IsEmpty()) { diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp index 1e8a77307f..452a573409 100644 --- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp +++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp @@ -174,12 +174,13 @@ CXFA_Node* ResolveBreakTarget(CXFA_Node* pPageSetRoot, wsProcessedTarget = wsExpr.Mid(4, wsExpr.GetLength() - 5); } XFA_RESOLVENODE_RS rs; - int32_t iCount = pDocument->GetScriptContext()->ResolveObjects( - pPageSetRoot, wsProcessedTarget.AsStringView(), rs, + bool iRet = pDocument->GetScriptContext()->ResolveObjects( + pPageSetRoot, wsProcessedTarget.AsStringView(), &rs, XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Attributes | XFA_RESOLVENODE_Siblings | - XFA_RESOLVENODE_Parent); - if (iCount > 0 && rs.objects.front()->IsNode()) + XFA_RESOLVENODE_Parent, + nullptr); + if (iRet && rs.objects.front()->IsNode()) return rs.objects.front()->AsNode(); } iSplitIndex = iSplitNextIndex.value(); diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index 21812347ff..4f2b2fb41d 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -468,7 +468,7 @@ CXFA_Node* FindDataRefDataNode(CXFA_Document* pDocument, XFA_RESOLVENODE_RS rs; pDocument->GetScriptContext()->ResolveObjects( - pDataScope, wsRef.AsStringView(), rs, dFlags, pTemplateNode); + pDataScope, wsRef.AsStringView(), &rs, dFlags, pTemplateNode); if (rs.dwFlags == XFA_RESOLVENODE_RSTYPE_CreateNodeAll || rs.dwFlags == XFA_RESOLVENODE_RSTYPE_CreateNodeMidAll || rs.objects.size() > 1) { @@ -1163,7 +1163,7 @@ void UpdateBindingRelations(CXFA_Document* pDocument, XFA_RESOLVENODE_Children | XFA_RESOLVENODE_CreateNode; XFA_RESOLVENODE_RS rs; pDocument->GetScriptContext()->ResolveObjects( - pDataScope, wsRef.AsStringView(), rs, dFlags, pTemplateNode); + pDataScope, wsRef.AsStringView(), &rs, dFlags, pTemplateNode); CXFA_Object* pObject = !rs.objects.empty() ? rs.objects.front() : nullptr; pDataNode = ToNode(pObject); |