jscript: Added support for VT_I2 in invoke_prop_func.
This commit is contained in:
parent
da125450da
commit
c9c8c6165e
|
@ -333,6 +333,49 @@ static HRESULT set_this(DISPPARAMS *dp, DISPPARAMS *olddp, IDispatch *jsthis)
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT convert_params(const DISPPARAMS *dp, VARIANT *buf, DISPPARAMS *ret)
|
||||
{
|
||||
BOOL need_conversion = FALSE;
|
||||
const VARIANT *s;
|
||||
VARIANT *d;
|
||||
unsigned i;
|
||||
|
||||
*ret = *dp;
|
||||
|
||||
for(i = 0; i < ret->cArgs; i++) {
|
||||
if(V_VT(get_arg(dp, i)) == VT_I2) {
|
||||
need_conversion = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!need_conversion)
|
||||
return S_OK;
|
||||
|
||||
if(ret->cArgs > 6) {
|
||||
ret->rgvarg = heap_alloc(ret->cArgs * sizeof(VARIANT));
|
||||
if(!ret->rgvarg)
|
||||
return E_OUTOFMEMORY;
|
||||
}else {
|
||||
ret->rgvarg = buf;
|
||||
}
|
||||
|
||||
for(i = 0; i < ret->cArgs; i++) {
|
||||
s = get_arg(dp, i);
|
||||
d = get_arg(ret, i);
|
||||
switch(V_VT(s)) {
|
||||
case VT_I2:
|
||||
V_VT(d) = VT_I4;
|
||||
V_I4(d) = V_I2(s);
|
||||
break;
|
||||
default:
|
||||
*d = *s;
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT invoke_prop_func(jsdisp_t *This, jsdisp_t *jsthis, dispex_prop_t *prop, WORD flags,
|
||||
DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
|
@ -340,6 +383,8 @@ static HRESULT invoke_prop_func(jsdisp_t *This, jsdisp_t *jsthis, dispex_prop_t
|
|||
|
||||
switch(prop->type) {
|
||||
case PROP_BUILTIN: {
|
||||
DISPPARAMS params;
|
||||
VARIANT buf[6];
|
||||
vdisp_t vthis;
|
||||
|
||||
if(flags == DISPATCH_CONSTRUCT && (prop->flags & PROPF_METHOD)) {
|
||||
|
@ -347,9 +392,15 @@ static HRESULT invoke_prop_func(jsdisp_t *This, jsdisp_t *jsthis, dispex_prop_t
|
|||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
hres = convert_params(dp, buf, ¶ms);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
set_jsdisp(&vthis, jsthis);
|
||||
hres = prop->u.p->invoke(This->ctx, &vthis, flags, dp, retv, ei);
|
||||
hres = prop->u.p->invoke(This->ctx, &vthis, flags, ¶ms, retv, ei);
|
||||
vdisp_release(&vthis);
|
||||
if(params.rgvarg != buf && params.rgvarg != dp->rgvarg)
|
||||
heap_free(params.rgvarg);
|
||||
return hres;
|
||||
}
|
||||
case PROP_PROTREF:
|
||||
|
|
|
@ -375,7 +375,7 @@ HRESULT regexp_match(script_ctx_t*,jsdisp_t*,const WCHAR*,DWORD,BOOL,match_resul
|
|||
HRESULT parse_regexp_flags(const WCHAR*,DWORD,DWORD*) DECLSPEC_HIDDEN;
|
||||
HRESULT regexp_string_match(script_ctx_t*,jsdisp_t*,BSTR,VARIANT*,jsexcept_t*) DECLSPEC_HIDDEN;
|
||||
|
||||
static inline VARIANT *get_arg(DISPPARAMS *dp, DWORD i)
|
||||
static inline VARIANT *get_arg(const DISPPARAMS *dp, DWORD i)
|
||||
{
|
||||
return dp->rgvarg + dp->cArgs-i-1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue