diff --git a/dlls/jscript/array.c b/dlls/jscript/array.c index eda49cbf6a1..d17b6051f70 100644 --- a/dlls/jscript/array.c +++ b/dlls/jscript/array.c @@ -103,7 +103,7 @@ static HRESULT get_length(script_ctx_t *ctx, vdisp_t *vdisp, jsdisp_t **jsthis, static HRESULT set_length(jsdisp_t *obj, DWORD length) { if(is_class(obj, JSCLASS_ARRAY)) { - ((ArrayInstance*)obj)->length = length; + array_from_jsdisp(obj)->length = length; return S_OK; } @@ -191,7 +191,7 @@ static HRESULT concat_obj(jsdisp_t *array, IDispatch *obj, DWORD *len) jsobj = iface_to_jsdisp(obj); if(jsobj) { if(is_class(jsobj, JSCLASS_ARRAY)) { - hres = concat_array(array, (ArrayInstance*)jsobj, len); + hres = concat_array(array, array_from_jsdisp(jsobj), len); jsdisp_release(jsobj); return hres; } @@ -1022,7 +1022,7 @@ static void Array_destructor(jsdisp_t *dispex) static void Array_on_put(jsdisp_t *dispex, const WCHAR *name) { - ArrayInstance *array = (ArrayInstance*)dispex; + ArrayInstance *array = array_from_jsdisp(dispex); const WCHAR *ptr = name; DWORD id = 0; diff --git a/dlls/jscript/date.c b/dlls/jscript/date.c index a66a2864c8f..21a359a10f1 100644 --- a/dlls/jscript/date.c +++ b/dlls/jscript/date.c @@ -2424,7 +2424,7 @@ static HRESULT DateConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, if(FAILED(hres)) return hres; - di = (DateInstance*)date; + di = date_from_jsdisp(date); di->time = utc(di->time, di); } } diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c index 04dcb18d923..8480a3bf1a0 100644 --- a/dlls/jscript/function.c +++ b/dlls/jscript/function.c @@ -81,7 +81,7 @@ static HRESULT Arguments_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u static void Arguments_destructor(jsdisp_t *jsdisp) { - ArgumentsInstance *arguments = (ArgumentsInstance*)jsdisp; + ArgumentsInstance *arguments = arguments_from_jsdisp(jsdisp); TRACE("(%p)\n", arguments); @@ -98,7 +98,7 @@ static void Arguments_destructor(jsdisp_t *jsdisp) static unsigned Arguments_idx_length(jsdisp_t *jsdisp) { - ArgumentsInstance *arguments = (ArgumentsInstance*)jsdisp; + ArgumentsInstance *arguments = arguments_from_jsdisp(jsdisp); return arguments->argc; } @@ -113,7 +113,7 @@ static jsval_t *get_argument_ref(ArgumentsInstance *arguments, unsigned idx) static HRESULT Arguments_idx_get(jsdisp_t *jsdisp, unsigned idx, jsval_t *r) { - ArgumentsInstance *arguments = (ArgumentsInstance*)jsdisp; + ArgumentsInstance *arguments = arguments_from_jsdisp(jsdisp); jsval_t *ref; TRACE("%p[%u]\n", arguments, idx); @@ -127,7 +127,7 @@ static HRESULT Arguments_idx_get(jsdisp_t *jsdisp, unsigned idx, jsval_t *r) static HRESULT Arguments_idx_put(jsdisp_t *jsdisp, unsigned idx, jsval_t val) { - ArgumentsInstance *arguments = (ArgumentsInstance*)jsdisp; + ArgumentsInstance *arguments = arguments_from_jsdisp(jsdisp); jsval_t *ref; HRESULT hres; @@ -327,7 +327,7 @@ HRESULT Function_invoke(jsdisp_t *func_this, IDispatch *jsthis, WORD flags, unsi TRACE("func %p this %p\n", func_this, jsthis); assert(is_class(func_this, JSCLASS_FUNCTION)); - function = (FunctionInstance*)func_this; + function = function_from_jsdisp(func_this); flags &= ~DISPATCH_JSCRIPT_INTERNAL_MASK; if(function->value_proc) @@ -530,7 +530,7 @@ HRESULT Function_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned return E_FAIL; } - function = (FunctionInstance*)jsthis->u.jsdisp; + function = function_from_jsdisp(jsthis->u.jsdisp); assert(function->value_proc != NULL); return invoke_value_proc(ctx, function, NULL, flags, argc, argv, r); @@ -577,7 +577,7 @@ static HRESULT Function_get_arguments(script_ctx_t *ctx, jsdisp_t *jsthis, jsval static void Function_destructor(jsdisp_t *dispex) { - FunctionInstance *This = (FunctionInstance*)dispex; + FunctionInstance *This = function_from_jsdisp(dispex); if(This->code) release_bytecode(This->code); diff --git a/dlls/jscript/jsregexp.c b/dlls/jscript/jsregexp.c index a9924eecf9f..5798635cb87 100644 --- a/dlls/jscript/jsregexp.c +++ b/dlls/jscript/jsregexp.c @@ -125,7 +125,7 @@ static HRESULT do_regexp_match_next(script_ctx_t *ctx, RegExpInstance *regexp, HRESULT regexp_match_next(script_ctx_t *ctx, jsdisp_t *dispex, DWORD rem_flags, jsstr_t *jsstr, match_state_t **ret) { - RegExpInstance *regexp = (RegExpInstance*)dispex; + RegExpInstance *regexp = regexp_from_jsdisp(dispex); match_state_t *match; heap_pool_t *mark; const WCHAR *str; @@ -182,7 +182,7 @@ HRESULT regexp_match_next(script_ctx_t *ctx, jsdisp_t *dispex, static HRESULT regexp_match(script_ctx_t *ctx, jsdisp_t *dispex, jsstr_t *jsstr, BOOL gflag, match_result_t **match_result, DWORD *result_cnt) { - RegExpInstance *This = (RegExpInstance*)dispex; + RegExpInstance *This = regexp_from_jsdisp(dispex); match_result_t *ret = NULL; match_state_t *result; DWORD i=0, ret_size = 0; @@ -596,7 +596,7 @@ static HRESULT RegExp_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi static void RegExp_destructor(jsdisp_t *dispex) { - RegExpInstance *This = (RegExpInstance*)dispex; + RegExpInstance *This = regexp_from_jsdisp(dispex); if(This->jsregexp) regexp_destroy(This->jsregexp); @@ -708,7 +708,7 @@ HRESULT create_regexp_var(script_ctx_t *ctx, jsval_t src_arg, jsval_t *flags_arg obj = iface_to_jsdisp(get_object(src_arg)); if(obj) { if(is_class(obj, JSCLASS_REGEXP)) { - RegExpInstance *regexp = (RegExpInstance*)obj; + RegExpInstance *regexp = regexp_from_jsdisp(obj); hres = create_regexp(ctx, regexp->str, regexp->jsregexp->flags, ret); jsdisp_release(obj); @@ -754,7 +754,7 @@ HRESULT regexp_string_match(script_ctx_t *ctx, jsdisp_t *re, jsstr_t *jsstr, jsv static const WCHAR inputW[] = {'i','n','p','u','t',0}; static const WCHAR lastIndexW[] = {'l','a','s','t','I','n','d','e','x',0}; - RegExpInstance *regexp = (RegExpInstance*)re; + RegExpInstance *regexp = regexp_from_jsdisp(re); match_result_t *match_result; unsigned match_cnt, i; const WCHAR *str; diff --git a/dlls/jscript/string.c b/dlls/jscript/string.c index b5c0197e1df..ad978f245cb 100644 --- a/dlls/jscript/string.c +++ b/dlls/jscript/string.c @@ -111,7 +111,7 @@ static HRESULT get_string_flat_val(script_ctx_t *ctx, vdisp_t *jsthis, jsstr_t * static HRESULT String_get_length(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r) { - StringInstance *string = (StringInstance*)jsthis; + StringInstance *string = string_from_jsdisp(jsthis); TRACE("%p\n", jsthis); @@ -1480,7 +1480,7 @@ static HRESULT String_localeCompare(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla static HRESULT String_get_value(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r) { - StringInstance *This = (StringInstance*)jsthis; + StringInstance *This = string_from_jsdisp(jsthis); TRACE("\n"); @@ -1490,7 +1490,7 @@ static HRESULT String_get_value(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r) static void String_destructor(jsdisp_t *dispex) { - StringInstance *This = (StringInstance*)dispex; + StringInstance *This = string_from_jsdisp(dispex); jsstr_release(This->str); heap_free(This); @@ -1498,7 +1498,7 @@ static void String_destructor(jsdisp_t *dispex) static unsigned String_idx_length(jsdisp_t *jsdisp) { - StringInstance *string = (StringInstance*)jsdisp; + StringInstance *string = string_from_jsdisp(jsdisp); /* * NOTE: For invoke version < 2, indexed array is not implemented at all. @@ -1512,7 +1512,7 @@ static unsigned String_idx_length(jsdisp_t *jsdisp) static HRESULT String_idx_get(jsdisp_t *jsdisp, unsigned idx, jsval_t *r) { - StringInstance *string = (StringInstance*)jsdisp; + StringInstance *string = string_from_jsdisp(jsdisp); jsstr_t *ret; ret = jsstr_substr(string->str, idx, 1);