Module: wine Branch: master Commit: 52fc8b3d94853e66d7c854bc33095759008245d2 URL: http://source.winehq.org/git/wine.git/?a=commit;h=52fc8b3d94853e66d7c854bc33...
Author: Jacek Caban jacek@codeweavers.com Date: Mon Mar 11 16:05:27 2013 +0100
jscript: Use BSTR also for pure IDispatch call in Object.hasOwnProperty.
---
dlls/jscript/object.c | 26 +++++++++++++------------- 1 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/dlls/jscript/object.c b/dlls/jscript/object.c index 8047d3f..1139f3c 100644 --- a/dlls/jscript/object.c +++ b/dlls/jscript/object.c @@ -113,6 +113,7 @@ static HRESULT Object_hasOwnProperty(script_ctx_t *ctx, vdisp_t *jsthis, WORD fl { jsstr_t *name; DISPID id; + BSTR bstr; HRESULT hres;
TRACE("\n"); @@ -131,6 +132,7 @@ static HRESULT Object_hasOwnProperty(script_ctx_t *ctx, vdisp_t *jsthis, WORD fl BOOL result;
hres = jsdisp_is_own_prop(jsthis->u.jsdisp, name->str, &result); + jsstr_release(name); if(FAILED(hres)) return hres;
@@ -139,22 +141,20 @@ static HRESULT Object_hasOwnProperty(script_ctx_t *ctx, vdisp_t *jsthis, WORD fl return S_OK; }
- if(is_dispex(jsthis)) { - BSTR bstr;
- bstr = SysAllocStringLen(name->str, jsstr_length(name)); - if(!bstr) - return E_OUTOFMEMORY; + bstr = SysAllocStringLen(NULL, jsstr_length(name)); + if(bstr) + jsstr_flush(name, bstr); + jsstr_release(name); + if(!bstr) + return E_OUTOFMEMORY;
- hres = IDispatchEx_GetDispID(jsthis->u.dispex, bstr, - make_grfdex(ctx, fdexNameCaseSensitive), &id); - SysFreeString(bstr); - } else { - OLECHAR *names = name->str; - hres = IDispatch_GetIDsOfNames(jsthis->u.disp, &IID_NULL, - &names, 1, ctx->lcid, &id); - } + if(is_dispex(jsthis)) + hres = IDispatchEx_GetDispID(jsthis->u.dispex, bstr, make_grfdex(ctx, fdexNameCaseSensitive), &id); + else + hres = IDispatch_GetIDsOfNames(jsthis->u.disp, &IID_NULL, &bstr, 1, ctx->lcid, &id);
+ SysFreeString(bstr); if(r) *r = jsval_bool(SUCCEEDED(hres)); return S_OK;