jscript: Use correct integral type.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Eric Pouech 2022-02-01 14:05:03 +01:00 committed by Alexandre Julliard
parent 04bb4424ef
commit 679bbdf89d
8 changed files with 35 additions and 28 deletions

View file

@ -53,7 +53,7 @@ unsigned array_get_length(jsdisp_t *array)
return array_from_jsdisp(array)->length;
}
static HRESULT get_length(script_ctx_t *ctx, vdisp_t *vdisp, jsdisp_t **jsthis, DWORD *ret)
static HRESULT get_length(script_ctx_t *ctx, vdisp_t *vdisp, jsdisp_t **jsthis, UINT32 *ret)
{
ArrayInstance *array;
jsval_t val;
@ -314,7 +314,7 @@ static HRESULT Array_join(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigne
jsval_t *r)
{
jsdisp_t *jsthis;
DWORD length;
UINT32 length;
HRESULT hres;
TRACE("\n");
@ -346,7 +346,7 @@ static HRESULT Array_pop(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned
{
jsdisp_t *jsthis;
jsval_t val;
DWORD length;
UINT32 length;
HRESULT hres;
TRACE("\n");
@ -395,7 +395,7 @@ static HRESULT Array_push(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigne
jsval_t *r)
{
jsdisp_t *jsthis;
DWORD length = 0;
UINT32 length = 0;
unsigned i;
HRESULT hres;
@ -424,7 +424,7 @@ static HRESULT Array_reverse(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsi
jsval_t *r)
{
jsdisp_t *jsthis;
DWORD length, k, l;
UINT32 length, k, l;
jsval_t v1, v2;
HRESULT hres1, hres2;
@ -479,7 +479,7 @@ static HRESULT Array_shift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsign
jsval_t *r)
{
jsdisp_t *jsthis;
DWORD length = 0, i;
UINT32 length = 0, i;
jsval_t v, ret;
HRESULT hres;
@ -534,7 +534,7 @@ static HRESULT Array_slice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsign
{
jsdisp_t *arr, *jsthis;
DOUBLE range;
DWORD length, start, end, idx;
UINT32 length, start, end, idx;
HRESULT hres;
TRACE("\n");
@ -656,7 +656,7 @@ static HRESULT Array_sort(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigne
{
jsdisp_t *jsthis, *cmp_func = NULL;
jsval_t *vtab, **sorttab = NULL;
DWORD length;
UINT32 length;
DWORD i;
HRESULT hres = S_OK;
@ -800,7 +800,7 @@ static HRESULT Array_sort(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigne
static HRESULT Array_splice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
DWORD length, start=0, delete_cnt=0, i, add_args = 0;
UINT32 length, start=0, delete_cnt=0, i, add_args = 0;
jsdisp_t *ret_array = NULL, *jsthis;
jsval_t val;
double d;
@ -1037,7 +1037,7 @@ static HRESULT Array_map(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned
IDispatch *context_this = NULL, *callback;
jsval_t callback_args[3], mapped_value;
jsdisp_t *jsthis, *array;
DWORD length, k;
UINT32 length, k;
HRESULT hres;
TRACE("\n");
@ -1100,7 +1100,7 @@ static HRESULT Array_reduce(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsig
jsval_t callback_args[4], acc, new_acc;
BOOL have_value = FALSE;
jsdisp_t *jsthis;
DWORD length, k;
UINT32 length, k;
HRESULT hres;
TRACE("\n");
@ -1168,7 +1168,7 @@ static HRESULT Array_unshift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsi
{
jsdisp_t *jsthis;
WCHAR buf[14], *buf_end, *str;
DWORD i, length;
UINT32 i, length;
jsval_t val;
DISPID id;
HRESULT hres;

View file

@ -147,7 +147,7 @@ static inline HRESULT stack_pop_int(script_ctx_t *ctx, INT *r)
return to_int32(ctx, stack_pop(ctx), r);
}
static inline HRESULT stack_pop_uint(script_ctx_t *ctx, DWORD *r)
static inline HRESULT stack_pop_uint(script_ctx_t *ctx, UINT32 *r)
{
return to_uint32(ctx, stack_pop(ctx), r);
}
@ -2643,7 +2643,7 @@ static HRESULT interp_neg(script_ctx_t *ctx)
/* ECMA-262 3rd Edition 11.7.1 */
static HRESULT interp_lshift(script_ctx_t *ctx)
{
DWORD r;
UINT32 r;
INT l;
HRESULT hres;
@ -2661,7 +2661,7 @@ static HRESULT interp_lshift(script_ctx_t *ctx)
/* ECMA-262 3rd Edition 11.7.2 */
static HRESULT interp_rshift(script_ctx_t *ctx)
{
DWORD r;
UINT32 r;
INT l;
HRESULT hres;
@ -2679,7 +2679,7 @@ static HRESULT interp_rshift(script_ctx_t *ctx)
/* ECMA-262 3rd Edition 11.7.3 */
static HRESULT interp_rshift2(script_ctx_t *ctx)
{
DWORD r, l;
UINT32 r, l;
HRESULT hres;
hres = stack_pop_uint(ctx, &r);

View file

@ -297,7 +297,7 @@ static HRESULT Function_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
static HRESULT array_to_args(script_ctx_t *ctx, jsdisp_t *arg_array, unsigned *argc, jsval_t **ret)
{
jsval_t *argv, val;
DWORD length, i;
UINT32 length, i;
HRESULT hres;
hres = jsdisp_propget_name(arg_array, L"length", &val);

View file

@ -366,6 +366,7 @@ HRESULT to_boolean(jsval_t,BOOL*) DECLSPEC_HIDDEN;
HRESULT to_number(script_ctx_t*,jsval_t,double*) DECLSPEC_HIDDEN;
HRESULT to_integer(script_ctx_t*,jsval_t,double*) DECLSPEC_HIDDEN;
HRESULT to_int32(script_ctx_t*,jsval_t,INT*) DECLSPEC_HIDDEN;
HRESULT to_long(script_ctx_t*,jsval_t,LONG*) DECLSPEC_HIDDEN;
HRESULT to_uint32(script_ctx_t*,jsval_t,UINT32*) DECLSPEC_HIDDEN;
HRESULT to_string(script_ctx_t*,jsval_t,jsstr_t**) DECLSPEC_HIDDEN;
HRESULT to_flat_string(script_ctx_t*,jsval_t,jsstr_t**,const WCHAR**) DECLSPEC_HIDDEN;

View file

@ -642,7 +642,7 @@ HRESULT create_regexp(script_ctx_t *ctx, jsstr_t *src, DWORD flags, jsdisp_t **r
HRESULT create_regexp_var(script_ctx_t *ctx, jsval_t src_arg, jsval_t *flags_arg, jsdisp_t **ret)
{
unsigned flags = 0;
DWORD flags = 0;
const WCHAR *opt = NULL;
jsstr_t *src;
HRESULT hres = S_OK;
@ -695,7 +695,7 @@ HRESULT regexp_string_match(script_ctx_t *ctx, jsdisp_t *re, jsstr_t *jsstr, jsv
{
RegExpInstance *regexp = regexp_from_jsdisp(re);
match_result_t *match_result;
unsigned match_cnt, i;
DWORD match_cnt, i;
const WCHAR *str;
jsdisp_t *array;
HRESULT hres;

View file

@ -706,6 +706,11 @@ HRESULT to_int32(script_ctx_t *ctx, jsval_t v, INT *ret)
return S_OK;
}
HRESULT to_long(script_ctx_t *ctx, jsval_t v, LONG *ret)
{
return to_int32(ctx, v, (INT*)ret);
}
/* ECMA-262 3rd Edition 9.6 */
HRESULT to_uint32(script_ctx_t *ctx, jsval_t val, UINT32 *ret)
{

View file

@ -1596,7 +1596,7 @@ static HRESULT StringConstr_fromCharCode(script_ctx_t *ctx, vdisp_t *jsthis, WOR
unsigned argc, jsval_t *argv, jsval_t *r)
{
WCHAR *ret_str;
DWORD i, code;
UINT32 i, code;
jsstr_t *ret;
HRESULT hres;

View file

@ -63,7 +63,8 @@ static HRESULT VBArray_getItem(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, un
jsval_t *r)
{
VBArrayInstance *vbarray;
int i, *indexes;
unsigned i;
LONG *indexes;
VARIANT out;
HRESULT hres;
@ -76,12 +77,12 @@ static HRESULT VBArray_getItem(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, un
if(argc < SafeArrayGetDim(vbarray->safearray))
return JS_E_SUBSCRIPT_OUT_OF_RANGE;
indexes = heap_alloc(sizeof(int)*argc);
indexes = heap_alloc(sizeof(indexes[0])*argc);
if(!indexes)
return E_OUTOFMEMORY;
for(i=0; i<argc; i++) {
hres = to_int32(ctx, argv[i], indexes+i);
hres = to_long(ctx, argv[i], indexes + i);
if(FAILED(hres)) {
heap_free(indexes);
return hres;
@ -106,7 +107,7 @@ static HRESULT VBArray_lbound(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, uns
jsval_t *r)
{
VBArrayInstance *vbarray;
int dim;
LONG dim;
HRESULT hres;
TRACE("\n");
@ -116,7 +117,7 @@ static HRESULT VBArray_lbound(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, uns
return JS_E_VBARRAY_EXPECTED;
if(argc) {
hres = to_int32(ctx, argv[0], &dim);
hres = to_long(ctx, argv[0], &dim);
if(FAILED(hres))
return hres;
} else
@ -140,7 +141,7 @@ static HRESULT VBArray_toArray(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, un
jsdisp_t *array;
jsval_t val;
VARIANT *v;
int i, size = 1, ubound, lbound;
LONG i, size = 1, ubound, lbound;
HRESULT hres;
TRACE("\n");
@ -192,7 +193,7 @@ static HRESULT VBArray_ubound(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, uns
jsval_t *r)
{
VBArrayInstance *vbarray;
int dim;
LONG dim;
HRESULT hres;
TRACE("\n");
@ -202,7 +203,7 @@ static HRESULT VBArray_ubound(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, uns
return JS_E_VBARRAY_EXPECTED;
if(argc) {
hres = to_int32(ctx, argv[0], &dim);
hres = to_long(ctx, argv[0], &dim);
if(FAILED(hres))
return hres;
} else