From 86fad999ba59b1f8780582cc683b008880aab42e Mon Sep 17 00:00:00 2001 From: dsinclair Date: Tue, 31 May 2016 11:34:04 -0700 Subject: Replace CFXJSE_Value create/destroy with new and delete. In most cases, the destroy calls were removed and the object wrapped in a unique_ptr. Review-Url: https://codereview.chromium.org/2014323003 --- xfa/fxfa/parser/xfa_object_imp.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'xfa/fxfa/parser/xfa_object_imp.cpp') diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp index 53c8847be8..0b1209734f 100644 --- a/xfa/fxfa/parser/xfa_object_imp.cpp +++ b/xfa/fxfa/parser/xfa_object_imp.cpp @@ -654,20 +654,19 @@ void CXFA_Node::Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments) { if (iRet < 1) { return FXJSE_Value_SetNull(pArguments->GetReturnValue()); } - CFXJSE_Value* pValue = nullptr; if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { CXFA_Object* pNode = resoveNodeRS.nodes[0]; - pValue = pScriptContext->GetJSValueFromMap(pNode); - FXJSE_Value_Set(pArguments->GetReturnValue(), pValue); + FXJSE_Value_Set(pArguments->GetReturnValue(), + pScriptContext->GetJSValueFromMap(pNode)); } else { const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo = resoveNodeRS.pScriptAttribute; if (lpAttributeInfo && lpAttributeInfo->eValueType == XFA_SCRIPT_Object) { - pValue = FXJSE_Value_Create(pScriptContext->GetRuntime()); + std::unique_ptr pValue( + new CFXJSE_Value(pScriptContext->GetRuntime())); (resoveNodeRS.nodes[0]->*(lpAttributeInfo->lpfnCallback))( - pValue, FALSE, (XFA_ATTRIBUTE)lpAttributeInfo->eAttribute); - FXJSE_Value_Set(pArguments->GetReturnValue(), pValue); - FXJSE_Value_Release(pValue); + pValue.get(), FALSE, (XFA_ATTRIBUTE)lpAttributeInfo->eAttribute); + FXJSE_Value_Set(pArguments->GetReturnValue(), pValue.get()); } else { FXJSE_Value_SetNull(pArguments->GetReturnValue()); } -- cgit v1.2.3