Eric Pouech : jscript: Use correct integral type.
Alexandre Julliard
julliard at winehq.org
Tue Feb 1 15:21:34 CST 2022
Module: wine
Branch: master
Commit: 679bbdf89d138dc4d70b605b97f7a2b5a2fef07f
URL: https://source.winehq.org/git/wine.git/?a=commit;h=679bbdf89d138dc4d70b605b97f7a2b5a2fef07f
Author: Eric Pouech <eric.pouech at gmail.com>
Date: Tue Feb 1 14:05:03 2022 +0100
jscript: Use correct integral type.
Signed-off-by: Eric Pouech <eric.pouech at gmail.com>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/jscript/array.c | 24 ++++++++++++------------
dlls/jscript/engine.c | 8 ++++----
dlls/jscript/function.c | 2 +-
dlls/jscript/jscript.h | 1 +
dlls/jscript/jsregexp.c | 4 ++--
dlls/jscript/jsutils.c | 5 +++++
dlls/jscript/string.c | 2 +-
dlls/jscript/vbarray.c | 17 +++++++++--------
8 files changed, 35 insertions(+), 28 deletions(-)
diff --git a/dlls/jscript/array.c b/dlls/jscript/array.c
index 5f61f997a9b..56727f905f3 100644
--- a/dlls/jscript/array.c
+++ b/dlls/jscript/array.c
@@ -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;
diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c
index 47b4e56e8e4..ae002fc56e8 100644
--- a/dlls/jscript/engine.c
+++ b/dlls/jscript/engine.c
@@ -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);
diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c
index 3eef1aa2dd6..f24d53977bd 100644
--- a/dlls/jscript/function.c
+++ b/dlls/jscript/function.c
@@ -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);
diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h
index c192ec7c216..8ca2ea938af 100644
--- a/dlls/jscript/jscript.h
+++ b/dlls/jscript/jscript.h
@@ -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;
diff --git a/dlls/jscript/jsregexp.c b/dlls/jscript/jsregexp.c
index cb6c051176f..0dc4aa1806c 100644
--- a/dlls/jscript/jsregexp.c
+++ b/dlls/jscript/jsregexp.c
@@ -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;
diff --git a/dlls/jscript/jsutils.c b/dlls/jscript/jsutils.c
index 3c3cd012490..d3a41facc6c 100644
--- a/dlls/jscript/jsutils.c
+++ b/dlls/jscript/jsutils.c
@@ -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)
{
diff --git a/dlls/jscript/string.c b/dlls/jscript/string.c
index 5958216b861..cca14cbbb95 100644
--- a/dlls/jscript/string.c
+++ b/dlls/jscript/string.c
@@ -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;
diff --git a/dlls/jscript/vbarray.c b/dlls/jscript/vbarray.c
index 41faa20ed79..74b9a29fc9c 100644
--- a/dlls/jscript/vbarray.c
+++ b/dlls/jscript/vbarray.c
@@ -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
More information about the wine-cvs
mailing list