jscript: Use IDispatch* as iface_to_jsdisp argument type.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
e9907520b8
commit
be37b894a4
|
@ -188,7 +188,7 @@ static HRESULT concat_obj(jsdisp_t *array, IDispatch *obj, DWORD *len)
|
||||||
jsdisp_t *jsobj;
|
jsdisp_t *jsobj;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
jsobj = iface_to_jsdisp((IUnknown*)obj);
|
jsobj = iface_to_jsdisp(obj);
|
||||||
if(jsobj) {
|
if(jsobj) {
|
||||||
if(is_class(jsobj, JSCLASS_ARRAY)) {
|
if(is_class(jsobj, JSCLASS_ARRAY)) {
|
||||||
hres = concat_array(array, (ArrayInstance*)jsobj, len);
|
hres = concat_array(array, (ArrayInstance*)jsobj, len);
|
||||||
|
@ -695,7 +695,7 @@ static HRESULT Array_sort(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigne
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmp_func = iface_to_jsdisp((IUnknown*)get_object(argv[0]));
|
cmp_func = iface_to_jsdisp(get_object(argv[0]));
|
||||||
if(!cmp_func || !is_class(cmp_func, JSCLASS_FUNCTION)) {
|
if(!cmp_func || !is_class(cmp_func, JSCLASS_FUNCTION)) {
|
||||||
WARN("cmp_func is not a function\n");
|
WARN("cmp_func is not a function\n");
|
||||||
if(cmp_func)
|
if(cmp_func)
|
||||||
|
|
|
@ -1014,7 +1014,7 @@ HRESULT init_dispex_from_constr(jsdisp_t *dispex, script_ctx_t *ctx, const built
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_object_instance(val))
|
if(is_object_instance(val))
|
||||||
prot = iface_to_jsdisp((IUnknown*)get_object(val));
|
prot = iface_to_jsdisp(get_object(val));
|
||||||
jsval_release(val);
|
jsval_release(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1025,12 +1025,12 @@ HRESULT init_dispex_from_constr(jsdisp_t *dispex, script_ctx_t *ctx, const built
|
||||||
return hres;
|
return hres;
|
||||||
}
|
}
|
||||||
|
|
||||||
jsdisp_t *iface_to_jsdisp(IUnknown *iface)
|
jsdisp_t *iface_to_jsdisp(IDispatch *iface)
|
||||||
{
|
{
|
||||||
jsdisp_t *ret;
|
jsdisp_t *ret;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
hres = IUnknown_QueryInterface(iface, &IID_IDispatchJS, (void**)&ret);
|
hres = IDispatch_QueryInterface(iface, &IID_IDispatchJS, (void**)&ret);
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -1114,7 +1114,7 @@ HRESULT disp_call(script_ctx_t *ctx, IDispatch *disp, DISPID id, WORD flags, uns
|
||||||
unsigned i;
|
unsigned i;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
jsdisp = iface_to_jsdisp((IUnknown*)disp);
|
jsdisp = iface_to_jsdisp(disp);
|
||||||
if(jsdisp) {
|
if(jsdisp) {
|
||||||
if(flags & DISPATCH_PROPERTYPUT) {
|
if(flags & DISPATCH_PROPERTYPUT) {
|
||||||
FIXME("disp_call(propput) on builtin object\n");
|
FIXME("disp_call(propput) on builtin object\n");
|
||||||
|
@ -1207,7 +1207,7 @@ HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, IDispatch *jsthis, W
|
||||||
|
|
||||||
assert(!(flags & ~(DISPATCH_METHOD|DISPATCH_CONSTRUCT|DISPATCH_JSCRIPT_INTERNAL_MASK)));
|
assert(!(flags & ~(DISPATCH_METHOD|DISPATCH_CONSTRUCT|DISPATCH_JSCRIPT_INTERNAL_MASK)));
|
||||||
|
|
||||||
jsdisp = iface_to_jsdisp((IUnknown*)disp);
|
jsdisp = iface_to_jsdisp(disp);
|
||||||
if(jsdisp) {
|
if(jsdisp) {
|
||||||
hres = jsdisp_call_value(jsdisp, jsthis, flags, argc, argv, r);
|
hres = jsdisp_call_value(jsdisp, jsthis, flags, argc, argv, r);
|
||||||
jsdisp_release(jsdisp);
|
jsdisp_release(jsdisp);
|
||||||
|
@ -1346,7 +1346,7 @@ HRESULT disp_propput(script_ctx_t *ctx, IDispatch *disp, DISPID id, jsval_t val)
|
||||||
jsdisp_t *jsdisp;
|
jsdisp_t *jsdisp;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
jsdisp = iface_to_jsdisp((IUnknown*)disp);
|
jsdisp = iface_to_jsdisp(disp);
|
||||||
if(jsdisp) {
|
if(jsdisp) {
|
||||||
dispex_prop_t *prop;
|
dispex_prop_t *prop;
|
||||||
|
|
||||||
|
@ -1451,7 +1451,7 @@ HRESULT disp_propget(script_ctx_t *ctx, IDispatch *disp, DISPID id, jsval_t *val
|
||||||
VARIANT var;
|
VARIANT var;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
jsdisp = iface_to_jsdisp((IUnknown*)disp);
|
jsdisp = iface_to_jsdisp(disp);
|
||||||
if(jsdisp) {
|
if(jsdisp) {
|
||||||
hres = jsdisp_propget(jsdisp, id, val);
|
hres = jsdisp_propget(jsdisp, id, val);
|
||||||
jsdisp_release(jsdisp);
|
jsdisp_release(jsdisp);
|
||||||
|
@ -1502,7 +1502,7 @@ HRESULT disp_delete(IDispatch *disp, DISPID id, BOOL *ret)
|
||||||
jsdisp_t *jsdisp;
|
jsdisp_t *jsdisp;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
jsdisp = iface_to_jsdisp((IUnknown*)disp);
|
jsdisp = iface_to_jsdisp(disp);
|
||||||
if(jsdisp) {
|
if(jsdisp) {
|
||||||
dispex_prop_t *prop;
|
dispex_prop_t *prop;
|
||||||
|
|
||||||
|
@ -1538,7 +1538,7 @@ HRESULT disp_delete_name(script_ctx_t *ctx, IDispatch *disp, jsstr_t *name, BOOL
|
||||||
BSTR bstr;
|
BSTR bstr;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
jsdisp = iface_to_jsdisp((IUnknown*)disp);
|
jsdisp = iface_to_jsdisp(disp);
|
||||||
if(jsdisp) {
|
if(jsdisp) {
|
||||||
dispex_prop_t *prop;
|
dispex_prop_t *prop;
|
||||||
const WCHAR *ptr;
|
const WCHAR *ptr;
|
||||||
|
|
|
@ -314,7 +314,7 @@ static HRESULT disp_get_id(script_ctx_t *ctx, IDispatch *disp, const WCHAR *name
|
||||||
BSTR bstr;
|
BSTR bstr;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
jsdisp = iface_to_jsdisp((IUnknown*)disp);
|
jsdisp = iface_to_jsdisp(disp);
|
||||||
if(jsdisp) {
|
if(jsdisp) {
|
||||||
hres = jsdisp_get_id(jsdisp, name, flags, id);
|
hres = jsdisp_get_id(jsdisp, name, flags, id);
|
||||||
jsdisp_release(jsdisp);
|
jsdisp_release(jsdisp);
|
||||||
|
@ -1321,7 +1321,7 @@ static HRESULT interp_instanceof(script_ctx_t *ctx)
|
||||||
return throw_type_error(ctx, JS_E_FUNCTION_EXPECTED, NULL);
|
return throw_type_error(ctx, JS_E_FUNCTION_EXPECTED, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
obj = iface_to_jsdisp((IUnknown*)get_object(v));
|
obj = iface_to_jsdisp(get_object(v));
|
||||||
IDispatch_Release(get_object(v));
|
IDispatch_Release(get_object(v));
|
||||||
if(!obj) {
|
if(!obj) {
|
||||||
FIXME("non-jsdisp objects not supported\n");
|
FIXME("non-jsdisp objects not supported\n");
|
||||||
|
@ -1341,7 +1341,7 @@ static HRESULT interp_instanceof(script_ctx_t *ctx)
|
||||||
|
|
||||||
if(is_object_instance(prot)) {
|
if(is_object_instance(prot)) {
|
||||||
if(is_object_instance(v))
|
if(is_object_instance(v))
|
||||||
tmp = iface_to_jsdisp((IUnknown*)get_object(v));
|
tmp = iface_to_jsdisp(get_object(v));
|
||||||
for(iter = tmp; !ret && iter; iter = iter->prototype) {
|
for(iter = tmp; !ret && iter; iter = iter->prototype) {
|
||||||
hres = disp_cmp(get_object(prot), to_disp(iter), &ret);
|
hres = disp_cmp(get_object(prot), to_disp(iter), &ret);
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
|
@ -1643,7 +1643,7 @@ static HRESULT typeof_string(jsval_t v, const WCHAR **ret)
|
||||||
case JSV_OBJECT: {
|
case JSV_OBJECT: {
|
||||||
jsdisp_t *dispex;
|
jsdisp_t *dispex;
|
||||||
|
|
||||||
if(get_object(v) && (dispex = iface_to_jsdisp((IUnknown*)get_object(v)))) {
|
if(get_object(v) && (dispex = iface_to_jsdisp(get_object(v)))) {
|
||||||
*ret = is_class(dispex, JSCLASS_FUNCTION) ? functionW : objectW;
|
*ret = is_class(dispex, JSCLASS_FUNCTION) ? functionW : objectW;
|
||||||
jsdisp_release(dispex);
|
jsdisp_release(dispex);
|
||||||
}else {
|
}else {
|
||||||
|
@ -2587,7 +2587,7 @@ HRESULT exec_source(script_ctx_t *ctx, DWORD flags, bytecode_t *bytecode, functi
|
||||||
if(this_obj) {
|
if(this_obj) {
|
||||||
jsdisp_t *jsthis;
|
jsdisp_t *jsthis;
|
||||||
|
|
||||||
jsthis = iface_to_jsdisp((IUnknown*)this_obj);
|
jsthis = iface_to_jsdisp(this_obj);
|
||||||
if(jsthis) {
|
if(jsthis) {
|
||||||
if(jsthis->builtin_info->class == JSCLASS_GLOBAL || jsthis->builtin_info->class == JSCLASS_NONE)
|
if(jsthis->builtin_info->class == JSCLASS_GLOBAL || jsthis->builtin_info->class == JSCLASS_NONE)
|
||||||
this_obj = NULL;
|
this_obj = NULL;
|
||||||
|
|
|
@ -441,7 +441,7 @@ static HRESULT Function_apply(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
|
||||||
jsdisp_t *arg_array = NULL;
|
jsdisp_t *arg_array = NULL;
|
||||||
|
|
||||||
if(is_object_instance(argv[1])) {
|
if(is_object_instance(argv[1])) {
|
||||||
arg_array = iface_to_jsdisp((IUnknown*)get_object(argv[1]));
|
arg_array = iface_to_jsdisp(get_object(argv[1]));
|
||||||
if(arg_array &&
|
if(arg_array &&
|
||||||
(!is_class(arg_array, JSCLASS_ARRAY) && !is_class(arg_array, JSCLASS_ARGUMENTS) )) {
|
(!is_class(arg_array, JSCLASS_ARRAY) && !is_class(arg_array, JSCLASS_ARGUMENTS) )) {
|
||||||
jsdisp_release(arg_array);
|
jsdisp_release(arg_array);
|
||||||
|
|
|
@ -128,7 +128,7 @@ typedef enum {
|
||||||
JSCLASS_JSON
|
JSCLASS_JSON
|
||||||
} jsclass_t;
|
} jsclass_t;
|
||||||
|
|
||||||
jsdisp_t *iface_to_jsdisp(IUnknown*) DECLSPEC_HIDDEN;
|
jsdisp_t *iface_to_jsdisp(IDispatch*) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
union {
|
union {
|
||||||
|
@ -170,7 +170,7 @@ static inline void set_disp(vdisp_t *vdisp, IDispatch *disp)
|
||||||
jsdisp_t *jsdisp;
|
jsdisp_t *jsdisp;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
jsdisp = iface_to_jsdisp((IUnknown*)disp);
|
jsdisp = iface_to_jsdisp(disp);
|
||||||
if(jsdisp) {
|
if(jsdisp) {
|
||||||
vdisp->u.jsdisp = jsdisp;
|
vdisp->u.jsdisp = jsdisp;
|
||||||
vdisp->flags = VDISP_JSDISP | VDISP_DISPEX;
|
vdisp->flags = VDISP_JSDISP | VDISP_DISPEX;
|
||||||
|
|
|
@ -421,7 +421,7 @@ static HRESULT maybe_to_primitive(script_ctx_t *ctx, jsval_t val, jsval_t *r)
|
||||||
jsdisp_t *obj;
|
jsdisp_t *obj;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
if(!is_object_instance(val) || !get_object(val) || !(obj = iface_to_jsdisp((IUnknown*)get_object(val))))
|
if(!is_object_instance(val) || !get_object(val) || !(obj = iface_to_jsdisp(get_object(val))))
|
||||||
return jsval_copy(val, r);
|
return jsval_copy(val, r);
|
||||||
|
|
||||||
if(is_class(obj, JSCLASS_NUMBER)) {
|
if(is_class(obj, JSCLASS_NUMBER)) {
|
||||||
|
@ -672,7 +672,7 @@ static HRESULT stringify(stringify_ctx_t *ctx, jsval_t val)
|
||||||
jsdisp_t *obj;
|
jsdisp_t *obj;
|
||||||
DISPID id;
|
DISPID id;
|
||||||
|
|
||||||
obj = iface_to_jsdisp((IUnknown*)get_object(val));
|
obj = iface_to_jsdisp(get_object(val));
|
||||||
if(!obj)
|
if(!obj)
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
|
|
||||||
|
@ -730,7 +730,7 @@ static HRESULT stringify(stringify_ctx_t *ctx, jsval_t val)
|
||||||
case JSV_OBJECT: {
|
case JSV_OBJECT: {
|
||||||
jsdisp_t *obj;
|
jsdisp_t *obj;
|
||||||
|
|
||||||
obj = iface_to_jsdisp((IUnknown*)get_object(value));
|
obj = iface_to_jsdisp(get_object(value));
|
||||||
if(!obj) {
|
if(!obj) {
|
||||||
hres = S_FALSE;
|
hres = S_FALSE;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -704,7 +704,7 @@ HRESULT create_regexp_var(script_ctx_t *ctx, jsval_t src_arg, jsval_t *flags_arg
|
||||||
if(is_object_instance(src_arg)) {
|
if(is_object_instance(src_arg)) {
|
||||||
jsdisp_t *obj;
|
jsdisp_t *obj;
|
||||||
|
|
||||||
obj = iface_to_jsdisp((IUnknown*)get_object(src_arg));
|
obj = iface_to_jsdisp(get_object(src_arg));
|
||||||
if(obj) {
|
if(obj) {
|
||||||
if(is_class(obj, JSCLASS_REGEXP)) {
|
if(is_class(obj, JSCLASS_REGEXP)) {
|
||||||
RegExpInstance *regexp = (RegExpInstance*)obj;
|
RegExpInstance *regexp = (RegExpInstance*)obj;
|
||||||
|
@ -955,7 +955,7 @@ static HRESULT RegExpConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
|
||||||
case DISPATCH_METHOD:
|
case DISPATCH_METHOD:
|
||||||
if(argc) {
|
if(argc) {
|
||||||
if(is_object_instance(argv[0])) {
|
if(is_object_instance(argv[0])) {
|
||||||
jsdisp_t *jsdisp = iface_to_jsdisp((IUnknown*)get_object(argv[0]));
|
jsdisp_t *jsdisp = iface_to_jsdisp(get_object(argv[0]));
|
||||||
if(jsdisp) {
|
if(jsdisp) {
|
||||||
if(is_class(jsdisp, JSCLASS_REGEXP)) {
|
if(is_class(jsdisp, JSCLASS_REGEXP)) {
|
||||||
if(argc > 1 && !is_undefined(argv[1])) {
|
if(argc > 1 && !is_undefined(argv[1])) {
|
||||||
|
|
|
@ -392,7 +392,7 @@ HRESULT to_primitive(script_ctx_t *ctx, jsval_t val, jsval_t *ret, hint_t hint)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
jsdisp = iface_to_jsdisp((IUnknown*)get_object(val));
|
jsdisp = iface_to_jsdisp(get_object(val));
|
||||||
if(!jsdisp)
|
if(!jsdisp)
|
||||||
return disp_propget(ctx, get_object(val), DISPID_VALUE, ret);
|
return disp_propget(ctx, get_object(val), DISPID_VALUE, ret);
|
||||||
|
|
||||||
|
|
|
@ -636,7 +636,7 @@ static HRESULT String_match(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_object_instance(argv[0])) {
|
if(is_object_instance(argv[0])) {
|
||||||
regexp = iface_to_jsdisp((IUnknown*)get_object(argv[0]));
|
regexp = iface_to_jsdisp(get_object(argv[0]));
|
||||||
if(regexp && !is_class(regexp, JSCLASS_REGEXP)) {
|
if(regexp && !is_class(regexp, JSCLASS_REGEXP)) {
|
||||||
jsdisp_release(regexp);
|
jsdisp_release(regexp);
|
||||||
regexp = NULL;
|
regexp = NULL;
|
||||||
|
@ -799,7 +799,7 @@ static HRESULT String_replace(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_object_instance(argv[0])) {
|
if(is_object_instance(argv[0])) {
|
||||||
regexp = iface_to_jsdisp((IUnknown*)get_object(argv[0]));
|
regexp = iface_to_jsdisp(get_object(argv[0]));
|
||||||
if(regexp && !is_class(regexp, JSCLASS_REGEXP)) {
|
if(regexp && !is_class(regexp, JSCLASS_REGEXP)) {
|
||||||
jsdisp_release(regexp);
|
jsdisp_release(regexp);
|
||||||
regexp = NULL;
|
regexp = NULL;
|
||||||
|
@ -816,7 +816,7 @@ static HRESULT String_replace(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
|
||||||
|
|
||||||
if(argc >= 2) {
|
if(argc >= 2) {
|
||||||
if(is_object_instance(argv[1])) {
|
if(is_object_instance(argv[1])) {
|
||||||
rep_func = iface_to_jsdisp((IUnknown*)get_object(argv[1]));
|
rep_func = iface_to_jsdisp(get_object(argv[1]));
|
||||||
if(rep_func && !is_class(rep_func, JSCLASS_FUNCTION)) {
|
if(rep_func && !is_class(rep_func, JSCLASS_FUNCTION)) {
|
||||||
jsdisp_release(rep_func);
|
jsdisp_release(rep_func);
|
||||||
rep_func = NULL;
|
rep_func = NULL;
|
||||||
|
@ -1017,7 +1017,7 @@ static HRESULT String_search(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_object_instance(argv[0])) {
|
if(is_object_instance(argv[0])) {
|
||||||
regexp = iface_to_jsdisp((IUnknown*)get_object(argv[0]));
|
regexp = iface_to_jsdisp(get_object(argv[0]));
|
||||||
if(regexp && !is_class(regexp, JSCLASS_REGEXP)) {
|
if(regexp && !is_class(regexp, JSCLASS_REGEXP)) {
|
||||||
jsdisp_release(regexp);
|
jsdisp_release(regexp);
|
||||||
regexp = NULL;
|
regexp = NULL;
|
||||||
|
@ -1161,7 +1161,7 @@ static HRESULT String_split(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_object_instance(argv[0])) {
|
if(is_object_instance(argv[0])) {
|
||||||
regexp = iface_to_jsdisp((IUnknown*)get_object(argv[0]));
|
regexp = iface_to_jsdisp(get_object(argv[0]));
|
||||||
if(regexp) {
|
if(regexp) {
|
||||||
if(!is_class(regexp, JSCLASS_REGEXP)) {
|
if(!is_class(regexp, JSCLASS_REGEXP)) {
|
||||||
jsdisp_release(regexp);
|
jsdisp_release(regexp);
|
||||||
|
|
Loading…
Reference in New Issue