Commit 679bbdf8 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

jscript: Use correct integral type.

parent 04bb4424
...@@ -53,7 +53,7 @@ unsigned array_get_length(jsdisp_t *array) ...@@ -53,7 +53,7 @@ unsigned array_get_length(jsdisp_t *array)
return array_from_jsdisp(array)->length; 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; ArrayInstance *array;
jsval_t val; jsval_t val;
...@@ -314,7 +314,7 @@ static HRESULT Array_join(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigne ...@@ -314,7 +314,7 @@ static HRESULT Array_join(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigne
jsval_t *r) jsval_t *r)
{ {
jsdisp_t *jsthis; jsdisp_t *jsthis;
DWORD length; UINT32 length;
HRESULT hres; HRESULT hres;
TRACE("\n"); TRACE("\n");
...@@ -346,7 +346,7 @@ static HRESULT Array_pop(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned ...@@ -346,7 +346,7 @@ static HRESULT Array_pop(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned
{ {
jsdisp_t *jsthis; jsdisp_t *jsthis;
jsval_t val; jsval_t val;
DWORD length; UINT32 length;
HRESULT hres; HRESULT hres;
TRACE("\n"); TRACE("\n");
...@@ -395,7 +395,7 @@ static HRESULT Array_push(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigne ...@@ -395,7 +395,7 @@ static HRESULT Array_push(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigne
jsval_t *r) jsval_t *r)
{ {
jsdisp_t *jsthis; jsdisp_t *jsthis;
DWORD length = 0; UINT32 length = 0;
unsigned i; unsigned i;
HRESULT hres; HRESULT hres;
...@@ -424,7 +424,7 @@ static HRESULT Array_reverse(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsi ...@@ -424,7 +424,7 @@ static HRESULT Array_reverse(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsi
jsval_t *r) jsval_t *r)
{ {
jsdisp_t *jsthis; jsdisp_t *jsthis;
DWORD length, k, l; UINT32 length, k, l;
jsval_t v1, v2; jsval_t v1, v2;
HRESULT hres1, hres2; HRESULT hres1, hres2;
...@@ -479,7 +479,7 @@ static HRESULT Array_shift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsign ...@@ -479,7 +479,7 @@ static HRESULT Array_shift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsign
jsval_t *r) jsval_t *r)
{ {
jsdisp_t *jsthis; jsdisp_t *jsthis;
DWORD length = 0, i; UINT32 length = 0, i;
jsval_t v, ret; jsval_t v, ret;
HRESULT hres; HRESULT hres;
...@@ -534,7 +534,7 @@ static HRESULT Array_slice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsign ...@@ -534,7 +534,7 @@ static HRESULT Array_slice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsign
{ {
jsdisp_t *arr, *jsthis; jsdisp_t *arr, *jsthis;
DOUBLE range; DOUBLE range;
DWORD length, start, end, idx; UINT32 length, start, end, idx;
HRESULT hres; HRESULT hres;
TRACE("\n"); TRACE("\n");
...@@ -656,7 +656,7 @@ static HRESULT Array_sort(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigne ...@@ -656,7 +656,7 @@ static HRESULT Array_sort(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigne
{ {
jsdisp_t *jsthis, *cmp_func = NULL; jsdisp_t *jsthis, *cmp_func = NULL;
jsval_t *vtab, **sorttab = NULL; jsval_t *vtab, **sorttab = NULL;
DWORD length; UINT32 length;
DWORD i; DWORD i;
HRESULT hres = S_OK; HRESULT hres = S_OK;
...@@ -800,7 +800,7 @@ static HRESULT Array_sort(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigne ...@@ -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, static HRESULT Array_splice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r) 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; jsdisp_t *ret_array = NULL, *jsthis;
jsval_t val; jsval_t val;
double d; double d;
...@@ -1037,7 +1037,7 @@ static HRESULT Array_map(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned ...@@ -1037,7 +1037,7 @@ static HRESULT Array_map(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsigned
IDispatch *context_this = NULL, *callback; IDispatch *context_this = NULL, *callback;
jsval_t callback_args[3], mapped_value; jsval_t callback_args[3], mapped_value;
jsdisp_t *jsthis, *array; jsdisp_t *jsthis, *array;
DWORD length, k; UINT32 length, k;
HRESULT hres; HRESULT hres;
TRACE("\n"); TRACE("\n");
...@@ -1100,7 +1100,7 @@ static HRESULT Array_reduce(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsig ...@@ -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; jsval_t callback_args[4], acc, new_acc;
BOOL have_value = FALSE; BOOL have_value = FALSE;
jsdisp_t *jsthis; jsdisp_t *jsthis;
DWORD length, k; UINT32 length, k;
HRESULT hres; HRESULT hres;
TRACE("\n"); TRACE("\n");
...@@ -1168,7 +1168,7 @@ static HRESULT Array_unshift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsi ...@@ -1168,7 +1168,7 @@ static HRESULT Array_unshift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsi
{ {
jsdisp_t *jsthis; jsdisp_t *jsthis;
WCHAR buf[14], *buf_end, *str; WCHAR buf[14], *buf_end, *str;
DWORD i, length; UINT32 i, length;
jsval_t val; jsval_t val;
DISPID id; DISPID id;
HRESULT hres; HRESULT hres;
......
...@@ -147,7 +147,7 @@ static inline HRESULT stack_pop_int(script_ctx_t *ctx, INT *r) ...@@ -147,7 +147,7 @@ static inline HRESULT stack_pop_int(script_ctx_t *ctx, INT *r)
return to_int32(ctx, stack_pop(ctx), 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); return to_uint32(ctx, stack_pop(ctx), r);
} }
...@@ -2643,7 +2643,7 @@ static HRESULT interp_neg(script_ctx_t *ctx) ...@@ -2643,7 +2643,7 @@ static HRESULT interp_neg(script_ctx_t *ctx)
/* ECMA-262 3rd Edition 11.7.1 */ /* ECMA-262 3rd Edition 11.7.1 */
static HRESULT interp_lshift(script_ctx_t *ctx) static HRESULT interp_lshift(script_ctx_t *ctx)
{ {
DWORD r; UINT32 r;
INT l; INT l;
HRESULT hres; HRESULT hres;
...@@ -2661,7 +2661,7 @@ static HRESULT interp_lshift(script_ctx_t *ctx) ...@@ -2661,7 +2661,7 @@ static HRESULT interp_lshift(script_ctx_t *ctx)
/* ECMA-262 3rd Edition 11.7.2 */ /* ECMA-262 3rd Edition 11.7.2 */
static HRESULT interp_rshift(script_ctx_t *ctx) static HRESULT interp_rshift(script_ctx_t *ctx)
{ {
DWORD r; UINT32 r;
INT l; INT l;
HRESULT hres; HRESULT hres;
...@@ -2679,7 +2679,7 @@ static HRESULT interp_rshift(script_ctx_t *ctx) ...@@ -2679,7 +2679,7 @@ static HRESULT interp_rshift(script_ctx_t *ctx)
/* ECMA-262 3rd Edition 11.7.3 */ /* ECMA-262 3rd Edition 11.7.3 */
static HRESULT interp_rshift2(script_ctx_t *ctx) static HRESULT interp_rshift2(script_ctx_t *ctx)
{ {
DWORD r, l; UINT32 r, l;
HRESULT hres; HRESULT hres;
hres = stack_pop_uint(ctx, &r); hres = stack_pop_uint(ctx, &r);
......
...@@ -297,7 +297,7 @@ static HRESULT Function_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, ...@@ -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) static HRESULT array_to_args(script_ctx_t *ctx, jsdisp_t *arg_array, unsigned *argc, jsval_t **ret)
{ {
jsval_t *argv, val; jsval_t *argv, val;
DWORD length, i; UINT32 length, i;
HRESULT hres; HRESULT hres;
hres = jsdisp_propget_name(arg_array, L"length", &val); hres = jsdisp_propget_name(arg_array, L"length", &val);
......
...@@ -366,6 +366,7 @@ HRESULT to_boolean(jsval_t,BOOL*) DECLSPEC_HIDDEN; ...@@ -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_number(script_ctx_t*,jsval_t,double*) DECLSPEC_HIDDEN;
HRESULT to_integer(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_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_uint32(script_ctx_t*,jsval_t,UINT32*) DECLSPEC_HIDDEN;
HRESULT to_string(script_ctx_t*,jsval_t,jsstr_t**) 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; HRESULT to_flat_string(script_ctx_t*,jsval_t,jsstr_t**,const WCHAR**) DECLSPEC_HIDDEN;
......
...@@ -642,7 +642,7 @@ HRESULT create_regexp(script_ctx_t *ctx, jsstr_t *src, DWORD flags, jsdisp_t **r ...@@ -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) 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; const WCHAR *opt = NULL;
jsstr_t *src; jsstr_t *src;
HRESULT hres = S_OK; HRESULT hres = S_OK;
...@@ -695,7 +695,7 @@ HRESULT regexp_string_match(script_ctx_t *ctx, jsdisp_t *re, jsstr_t *jsstr, jsv ...@@ -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); RegExpInstance *regexp = regexp_from_jsdisp(re);
match_result_t *match_result; match_result_t *match_result;
unsigned match_cnt, i; DWORD match_cnt, i;
const WCHAR *str; const WCHAR *str;
jsdisp_t *array; jsdisp_t *array;
HRESULT hres; HRESULT hres;
......
...@@ -706,6 +706,11 @@ HRESULT to_int32(script_ctx_t *ctx, jsval_t v, INT *ret) ...@@ -706,6 +706,11 @@ HRESULT to_int32(script_ctx_t *ctx, jsval_t v, INT *ret)
return S_OK; 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 */ /* ECMA-262 3rd Edition 9.6 */
HRESULT to_uint32(script_ctx_t *ctx, jsval_t val, UINT32 *ret) HRESULT to_uint32(script_ctx_t *ctx, jsval_t val, UINT32 *ret)
{ {
......
...@@ -1596,7 +1596,7 @@ static HRESULT StringConstr_fromCharCode(script_ctx_t *ctx, vdisp_t *jsthis, WOR ...@@ -1596,7 +1596,7 @@ static HRESULT StringConstr_fromCharCode(script_ctx_t *ctx, vdisp_t *jsthis, WOR
unsigned argc, jsval_t *argv, jsval_t *r) unsigned argc, jsval_t *argv, jsval_t *r)
{ {
WCHAR *ret_str; WCHAR *ret_str;
DWORD i, code; UINT32 i, code;
jsstr_t *ret; jsstr_t *ret;
HRESULT hres; HRESULT hres;
......
...@@ -63,7 +63,8 @@ static HRESULT VBArray_getItem(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, un ...@@ -63,7 +63,8 @@ static HRESULT VBArray_getItem(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, un
jsval_t *r) jsval_t *r)
{ {
VBArrayInstance *vbarray; VBArrayInstance *vbarray;
int i, *indexes; unsigned i;
LONG *indexes;
VARIANT out; VARIANT out;
HRESULT hres; HRESULT hres;
...@@ -76,12 +77,12 @@ static HRESULT VBArray_getItem(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, un ...@@ -76,12 +77,12 @@ static HRESULT VBArray_getItem(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, un
if(argc < SafeArrayGetDim(vbarray->safearray)) if(argc < SafeArrayGetDim(vbarray->safearray))
return JS_E_SUBSCRIPT_OUT_OF_RANGE; return JS_E_SUBSCRIPT_OUT_OF_RANGE;
indexes = heap_alloc(sizeof(int)*argc); indexes = heap_alloc(sizeof(indexes[0])*argc);
if(!indexes) if(!indexes)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
for(i=0; i<argc; i++) { 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)) { if(FAILED(hres)) {
heap_free(indexes); heap_free(indexes);
return hres; return hres;
...@@ -106,7 +107,7 @@ static HRESULT VBArray_lbound(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, uns ...@@ -106,7 +107,7 @@ static HRESULT VBArray_lbound(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, uns
jsval_t *r) jsval_t *r)
{ {
VBArrayInstance *vbarray; VBArrayInstance *vbarray;
int dim; LONG dim;
HRESULT hres; HRESULT hres;
TRACE("\n"); TRACE("\n");
...@@ -116,7 +117,7 @@ static HRESULT VBArray_lbound(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, uns ...@@ -116,7 +117,7 @@ static HRESULT VBArray_lbound(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, uns
return JS_E_VBARRAY_EXPECTED; return JS_E_VBARRAY_EXPECTED;
if(argc) { if(argc) {
hres = to_int32(ctx, argv[0], &dim); hres = to_long(ctx, argv[0], &dim);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
} else } else
...@@ -140,7 +141,7 @@ static HRESULT VBArray_toArray(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, un ...@@ -140,7 +141,7 @@ static HRESULT VBArray_toArray(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, un
jsdisp_t *array; jsdisp_t *array;
jsval_t val; jsval_t val;
VARIANT *v; VARIANT *v;
int i, size = 1, ubound, lbound; LONG i, size = 1, ubound, lbound;
HRESULT hres; HRESULT hres;
TRACE("\n"); TRACE("\n");
...@@ -192,7 +193,7 @@ static HRESULT VBArray_ubound(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, uns ...@@ -192,7 +193,7 @@ static HRESULT VBArray_ubound(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, uns
jsval_t *r) jsval_t *r)
{ {
VBArrayInstance *vbarray; VBArrayInstance *vbarray;
int dim; LONG dim;
HRESULT hres; HRESULT hres;
TRACE("\n"); TRACE("\n");
...@@ -202,7 +203,7 @@ static HRESULT VBArray_ubound(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, uns ...@@ -202,7 +203,7 @@ static HRESULT VBArray_ubound(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, uns
return JS_E_VBARRAY_EXPECTED; return JS_E_VBARRAY_EXPECTED;
if(argc) { if(argc) {
hres = to_int32(ctx, argv[0], &dim); hres = to_long(ctx, argv[0], &dim);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
} else } else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment