jscript: Use the ARRAY_SIZE() macro.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2018-07-09 20:59:12 +02:00 committed by Alexandre Julliard
parent 8ce75cc5d4
commit ef64f27632
17 changed files with 55 additions and 55 deletions

View File

@ -1020,7 +1020,7 @@ static HRESULT Array_unshift(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsi
return hres; return hres;
if(argc) { if(argc) {
buf_end = buf + sizeof(buf)/sizeof(WCHAR)-1; buf_end = buf + ARRAY_SIZE(buf)-1;
*buf_end-- = 0; *buf_end-- = 0;
i = length; i = length;
@ -1118,7 +1118,7 @@ static const builtin_prop_t Array_props[] = {
static const builtin_info_t Array_info = { static const builtin_info_t Array_info = {
JSCLASS_ARRAY, JSCLASS_ARRAY,
{NULL, NULL,0, Array_get_value}, {NULL, NULL,0, Array_get_value},
sizeof(Array_props)/sizeof(*Array_props), ARRAY_SIZE(Array_props),
Array_props, Array_props,
Array_destructor, Array_destructor,
Array_on_put Array_on_put
@ -1131,7 +1131,7 @@ static const builtin_prop_t ArrayInst_props[] = {
static const builtin_info_t ArrayInst_info = { static const builtin_info_t ArrayInst_info = {
JSCLASS_ARRAY, JSCLASS_ARRAY,
{NULL, NULL,0, Array_get_value}, {NULL, NULL,0, Array_get_value},
sizeof(ArrayInst_props)/sizeof(*ArrayInst_props), ARRAY_SIZE(ArrayInst_props),
ArrayInst_props, ArrayInst_props,
Array_destructor, Array_destructor,
Array_on_put Array_on_put
@ -1238,7 +1238,7 @@ static const builtin_prop_t ArrayConstr_props[] = {
static const builtin_info_t ArrayConstr_info = { static const builtin_info_t ArrayConstr_info = {
JSCLASS_FUNCTION, JSCLASS_FUNCTION,
DEFAULT_FUNCTION_VALUE, DEFAULT_FUNCTION_VALUE,
sizeof(ArrayConstr_props)/sizeof(*ArrayConstr_props), ARRAY_SIZE(ArrayConstr_props),
ArrayConstr_props, ArrayConstr_props,
NULL, NULL,
NULL NULL

View File

@ -121,7 +121,7 @@ static const builtin_prop_t Bool_props[] = {
static const builtin_info_t Bool_info = { static const builtin_info_t Bool_info = {
JSCLASS_BOOLEAN, JSCLASS_BOOLEAN,
{NULL, Bool_value, 0}, {NULL, Bool_value, 0},
sizeof(Bool_props)/sizeof(*Bool_props), ARRAY_SIZE(Bool_props),
Bool_props, Bool_props,
NULL, NULL,
NULL NULL

View File

@ -523,10 +523,10 @@ static inline HRESULT date_to_string(DOUBLE time, BOOL show_offset, int offset,
lcid_en = MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT); lcid_en = MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT);
week[0] = 0; week[0] = 0;
GetLocaleInfoW(lcid_en, week_ids[(int)week_day(time)], week, sizeof(week)/sizeof(*week)); GetLocaleInfoW(lcid_en, week_ids[(int)week_day(time)], week, ARRAY_SIZE(week));
month[0] = 0; month[0] = 0;
GetLocaleInfoW(lcid_en, month_ids[(int)month_from_time(time)], month, sizeof(month)/sizeof(*month)); GetLocaleInfoW(lcid_en, month_ids[(int)month_from_time(time)], month, ARRAY_SIZE(month));
year = year_from_time(time); year = year_from_time(time);
if(year<0) { if(year<0) {
@ -732,10 +732,10 @@ static inline HRESULT create_utc_string(script_ctx_t *ctx, vdisp_t *jsthis, jsva
lcid_en = MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT); lcid_en = MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT);
week[0] = 0; week[0] = 0;
GetLocaleInfoW(lcid_en, week_ids[(int)week_day(date->time)], week, sizeof(week)/sizeof(*week)); GetLocaleInfoW(lcid_en, week_ids[(int)week_day(date->time)], week, ARRAY_SIZE(week));
month[0] = 0; month[0] = 0;
GetLocaleInfoW(lcid_en, month_ids[(int)month_from_time(date->time)], month, sizeof(month)/sizeof(*month)); GetLocaleInfoW(lcid_en, month_ids[(int)month_from_time(date->time)], month, ARRAY_SIZE(month));
year = year_from_time(date->time); year = year_from_time(date->time);
if(year<0) { if(year<0) {
@ -809,10 +809,10 @@ static HRESULT dateobj_to_date_string(DateInstance *date, jsval_t *r)
lcid_en = MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT); lcid_en = MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT);
week[0] = 0; week[0] = 0;
GetLocaleInfoW(lcid_en, week_ids[(int)week_day(time)], week, sizeof(week)/sizeof(*week)); GetLocaleInfoW(lcid_en, week_ids[(int)week_day(time)], week, ARRAY_SIZE(week));
month[0] = 0; month[0] = 0;
GetLocaleInfoW(lcid_en, month_ids[(int)month_from_time(time)], month, sizeof(month)/sizeof(*month)); GetLocaleInfoW(lcid_en, month_ids[(int)month_from_time(time)], month, ARRAY_SIZE(month));
year = year_from_time(time); year = year_from_time(time);
if(year<0) { if(year<0) {
@ -1983,7 +1983,7 @@ static const builtin_prop_t Date_props[] = {
static const builtin_info_t Date_info = { static const builtin_info_t Date_info = {
JSCLASS_DATE, JSCLASS_DATE,
{NULL, NULL,0, Date_get_value}, {NULL, NULL,0, Date_get_value},
sizeof(Date_props)/sizeof(*Date_props), ARRAY_SIZE(Date_props),
Date_props, Date_props,
NULL, NULL,
NULL NULL
@ -2037,7 +2037,7 @@ static inline HRESULT date_parse(jsstr_t *input_str, double *ret) {
LOCALE_SMONTHNAME1, LOCALE_SDAYNAME7, LOCALE_SDAYNAME1, LOCALE_SMONTHNAME1, LOCALE_SDAYNAME7, LOCALE_SDAYNAME1,
LOCALE_SDAYNAME2, LOCALE_SDAYNAME3, LOCALE_SDAYNAME4, LOCALE_SDAYNAME2, LOCALE_SDAYNAME3, LOCALE_SDAYNAME4,
LOCALE_SDAYNAME5, LOCALE_SDAYNAME6 }; LOCALE_SDAYNAME5, LOCALE_SDAYNAME6 };
WCHAR *strings[sizeof(string_ids)/sizeof(DWORD)]; WCHAR *strings[ARRAY_SIZE(string_ids)];
WCHAR *parse; WCHAR *parse;
int input_len, parse_len = 0, nest_level = 0, i, size; int input_len, parse_len = 0, nest_level = 0, i, size;
int year = 0, month = 0, day = 0, hour = 0, min = 0, sec = 0; int year = 0, month = 0, day = 0, hour = 0, min = 0, sec = 0;
@ -2088,7 +2088,7 @@ static inline HRESULT date_parse(jsstr_t *input_str, double *ret) {
/* FIXME: Cache strings */ /* FIXME: Cache strings */
lcid_en = MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT); lcid_en = MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT);
for(i=0; i<sizeof(string_ids)/sizeof(DWORD); i++) { for(i=0; i<ARRAY_SIZE(string_ids); i++) {
size = GetLocaleInfoW(lcid_en, string_ids[i], NULL, 0); size = GetLocaleInfoW(lcid_en, string_ids[i], NULL, 0);
strings[i] = heap_alloc((size+1)*sizeof(WCHAR)); strings[i] = heap_alloc((size+1)*sizeof(WCHAR));
if(!strings[i]) { if(!strings[i]) {
@ -2269,7 +2269,7 @@ static inline HRESULT date_parse(jsstr_t *input_str, double *ret) {
for(size=i; parse[size]>='A' && parse[size]<='Z'; size++); for(size=i; parse[size]>='A' && parse[size]<='Z'; size++);
size -= i; size -= i;
for(j=0; j<sizeof(string_ids)/sizeof(DWORD); j++) for(j=0; j<ARRAY_SIZE(string_ids); j++)
if(!strncmpiW(&parse[i], strings[j], size)) break; if(!strncmpiW(&parse[i], strings[j], size)) break;
if(j < 12) { if(j < 12) {
@ -2277,7 +2277,7 @@ static inline HRESULT date_parse(jsstr_t *input_str, double *ret) {
set_month = TRUE; set_month = TRUE;
month = 11-j; month = 11-j;
} }
else if(j == sizeof(string_ids)/sizeof(DWORD)) break; else if(j == ARRAY_SIZE(string_ids)) break;
i += size; i += size;
} }
@ -2302,7 +2302,7 @@ static inline HRESULT date_parse(jsstr_t *input_str, double *ret) {
*ret = NAN; *ret = NAN;
} }
for(i=0; i<sizeof(string_ids)/sizeof(DWORD); i++) for(i=0; i<ARRAY_SIZE(string_ids); i++)
heap_free(strings[i]); heap_free(strings[i]);
heap_free(parse); heap_free(parse);
@ -2522,7 +2522,7 @@ static const builtin_prop_t DateConstr_props[] = {
static const builtin_info_t DateConstr_info = { static const builtin_info_t DateConstr_info = {
JSCLASS_FUNCTION, JSCLASS_FUNCTION,
DEFAULT_FUNCTION_VALUE, DEFAULT_FUNCTION_VALUE,
sizeof(DateConstr_props)/sizeof(*DateConstr_props), ARRAY_SIZE(DateConstr_props),
DateConstr_props, DateConstr_props,
NULL, NULL,
NULL NULL

View File

@ -91,7 +91,7 @@ static BOOL decode_dword(const WCHAR *p, DWORD *ret)
DWORD i; DWORD i;
for(i=0; i<6; i++) { for(i=0; i<6; i++) {
if(p[i] >= sizeof(digits)/sizeof(*digits) || digits[p[i]] == 0xff) if(p[i] >= ARRAY_SIZE(digits) || digits[p[i]] == 0xff)
return FALSE; return FALSE;
} }
if(p[6] != '=' || p[7] != '=') if(p[6] != '=' || p[7] != '=')
@ -117,10 +117,10 @@ HRESULT decode_source(WCHAR *code)
static const WCHAR decode_endW[] = {'^','#','~','@'}; static const WCHAR decode_endW[] = {'^','#','~','@'};
while(*src) { while(*src) {
if(!strncmpW(src, decode_beginW, sizeof(decode_beginW)/sizeof(*decode_beginW))) { if(!strncmpW(src, decode_beginW, ARRAY_SIZE(decode_beginW))) {
DWORD len, i, j=0, csum, s=0; DWORD len, i, j=0, csum, s=0;
src += sizeof(decode_beginW)/sizeof(*decode_beginW); src += ARRAY_SIZE(decode_beginW);
if(!decode_dword(src, &len)) if(!decode_dword(src, &len))
return JS_E_INVALID_CHAR; return JS_E_INVALID_CHAR;
@ -165,9 +165,9 @@ HRESULT decode_source(WCHAR *code)
return JS_E_INVALID_CHAR; return JS_E_INVALID_CHAR;
src += 8; src += 8;
if(strncmpW(src, decode_endW, sizeof(decode_endW)/sizeof(*decode_endW))) if(strncmpW(src, decode_endW, ARRAY_SIZE(decode_endW)))
return JS_E_INVALID_CHAR; return JS_E_INVALID_CHAR;
src += sizeof(decode_endW)/sizeof(*decode_endW); src += ARRAY_SIZE(decode_endW);
}else { }else {
*dst++ = *src++; *dst++ = *src++;
} }

View File

@ -1290,7 +1290,7 @@ HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, IDispatch *jsthis, W
dp.rgdispidNamedArgs = NULL; dp.rgdispidNamedArgs = NULL;
} }
if(dp.cArgs > sizeof(buf)/sizeof(*buf)) { if(dp.cArgs > ARRAY_SIZE(buf)) {
dp.rgvarg = heap_alloc(dp.cArgs*sizeof(VARIANT)); dp.rgvarg = heap_alloc(dp.cArgs*sizeof(VARIANT));
if(!dp.rgvarg) { if(!dp.rgvarg) {
if(dispex) if(dispex)

View File

@ -144,7 +144,7 @@ static const builtin_prop_t Error_props[] = {
static const builtin_info_t Error_info = { static const builtin_info_t Error_info = {
JSCLASS_ERROR, JSCLASS_ERROR,
{NULL, Error_value, 0}, {NULL, Error_value, 0},
sizeof(Error_props)/sizeof(*Error_props), ARRAY_SIZE(Error_props),
Error_props, Error_props,
NULL, NULL,
NULL NULL
@ -348,7 +348,7 @@ HRESULT init_error_constr(script_ctx_t *ctx, jsdisp_t *object_prototype)
jsstr_t *str; jsstr_t *str;
HRESULT hres; HRESULT hres;
for(i=0; i < sizeof(names)/sizeof(names[0]); i++) { for(i=0; i < ARRAY_SIZE(names); i++) {
hres = alloc_error(ctx, i==0 ? object_prototype : NULL, NULL, &err); hres = alloc_error(ctx, i==0 ? object_prototype : NULL, NULL, &err);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
@ -385,7 +385,7 @@ static HRESULT throw_error(script_ctx_t *ctx, HRESULT error, const WCHAR *str, j
return error; return error;
buf[0] = '\0'; buf[0] = '\0';
LoadStringW(jscript_hinstance, HRESULT_CODE(error), buf, sizeof(buf)/sizeof(WCHAR)); LoadStringW(jscript_hinstance, HRESULT_CODE(error), buf, ARRAY_SIZE(buf));
if(str) pos = strchrW(buf, '|'); if(str) pos = strchrW(buf, '|');
if(pos) { if(pos) {

View File

@ -304,12 +304,12 @@ static HRESULT function_to_string(FunctionInstance *function, jsstr_t **ret)
WCHAR *ptr; WCHAR *ptr;
name_len = strlenW(function->name); name_len = strlenW(function->name);
str = jsstr_alloc_buf((sizeof(native_prefixW)+sizeof(native_suffixW))/sizeof(WCHAR) + name_len, &ptr); str = jsstr_alloc_buf(ARRAY_SIZE(native_prefixW) + ARRAY_SIZE(native_suffixW) + name_len, &ptr);
if(!str) if(!str)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
memcpy(ptr, native_prefixW, sizeof(native_prefixW)); memcpy(ptr, native_prefixW, sizeof(native_prefixW));
memcpy(ptr += sizeof(native_prefixW)/sizeof(WCHAR), function->name, name_len*sizeof(WCHAR)); memcpy(ptr += ARRAY_SIZE(native_prefixW), function->name, name_len*sizeof(WCHAR));
memcpy(ptr + name_len, native_suffixW, sizeof(native_suffixW)); memcpy(ptr + name_len, native_suffixW, sizeof(native_suffixW));
}else { }else {
str = jsstr_alloc_len(function->func_code->source, function->func_code->source_len); str = jsstr_alloc_len(function->func_code->source, function->func_code->source_len);
@ -593,7 +593,7 @@ static const builtin_prop_t Function_props[] = {
static const builtin_info_t Function_info = { static const builtin_info_t Function_info = {
JSCLASS_FUNCTION, JSCLASS_FUNCTION,
DEFAULT_FUNCTION_VALUE, DEFAULT_FUNCTION_VALUE,
sizeof(Function_props)/sizeof(*Function_props), ARRAY_SIZE(Function_props),
Function_props, Function_props,
Function_destructor, Function_destructor,
NULL NULL
@ -607,7 +607,7 @@ static const builtin_prop_t FunctionInst_props[] = {
static const builtin_info_t FunctionInst_info = { static const builtin_info_t FunctionInst_info = {
JSCLASS_FUNCTION, JSCLASS_FUNCTION,
DEFAULT_FUNCTION_VALUE, DEFAULT_FUNCTION_VALUE,
sizeof(FunctionInst_props)/sizeof(*FunctionInst_props), ARRAY_SIZE(FunctionInst_props),
FunctionInst_props, FunctionInst_props,
Function_destructor, Function_destructor,
NULL NULL
@ -764,11 +764,11 @@ static HRESULT construct_function(script_ctx_t *ctx, unsigned argc, jsval_t *arg
} }
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
len += (sizeof(function_anonymousW) + sizeof(function_beginW) + sizeof(function_endW)) / sizeof(WCHAR); len += ARRAY_SIZE(function_anonymousW) + ARRAY_SIZE(function_beginW) + ARRAY_SIZE(function_endW);
str = heap_alloc(len*sizeof(WCHAR)); str = heap_alloc(len*sizeof(WCHAR));
if(str) { if(str) {
memcpy(str, function_anonymousW, sizeof(function_anonymousW)); memcpy(str, function_anonymousW, sizeof(function_anonymousW));
ptr = str + sizeof(function_anonymousW)/sizeof(WCHAR); ptr = str + ARRAY_SIZE(function_anonymousW);
if(argc > 1) { if(argc > 1) {
while(1) { while(1) {
ptr += jsstr_flush(params[j], ptr); ptr += jsstr_flush(params[j], ptr);
@ -779,7 +779,7 @@ static HRESULT construct_function(script_ctx_t *ctx, unsigned argc, jsval_t *arg
} }
} }
memcpy(ptr, function_beginW, sizeof(function_beginW)); memcpy(ptr, function_beginW, sizeof(function_beginW));
ptr += sizeof(function_beginW)/sizeof(WCHAR); ptr += ARRAY_SIZE(function_beginW);
if(argc) if(argc)
ptr += jsstr_flush(params[argc-1], ptr); ptr += jsstr_flush(params[argc-1], ptr);
memcpy(ptr, function_endW, sizeof(function_endW)); memcpy(ptr, function_endW, sizeof(function_endW));

View File

@ -964,7 +964,7 @@ static const builtin_prop_t JSGlobal_props[] = {
static const builtin_info_t JSGlobal_info = { static const builtin_info_t JSGlobal_info = {
JSCLASS_GLOBAL, JSCLASS_GLOBAL,
{NULL, NULL, 0}, {NULL, NULL, 0},
sizeof(JSGlobal_props)/sizeof(*JSGlobal_props), ARRAY_SIZE(JSGlobal_props),
JSGlobal_props, JSGlobal_props,
NULL, NULL,
NULL NULL

View File

@ -836,7 +836,7 @@ static const builtin_prop_t JSON_props[] = {
static const builtin_info_t JSON_info = { static const builtin_info_t JSON_info = {
JSCLASS_JSON, JSCLASS_JSON,
{NULL, NULL, 0}, {NULL, NULL, 0},
sizeof(JSON_props)/sizeof(*JSON_props), ARRAY_SIZE(JSON_props),
JSON_props, JSON_props,
NULL, NULL,
NULL NULL

View File

@ -96,7 +96,7 @@ static HRESULT do_regexp_match_next(script_ctx_t *ctx, RegExpInstance *regexp,
} }
if(!(rem_flags & REM_NO_CTX_UPDATE)) { if(!(rem_flags & REM_NO_CTX_UPDATE)) {
DWORD i, n = min(sizeof(ctx->match_parens)/sizeof(ctx->match_parens[0]), ret->paren_count); DWORD i, n = min(ARRAY_SIZE(ctx->match_parens), ret->paren_count);
for(i=0; i < n; i++) { for(i=0; i < n; i++) {
if(ret->parens[i].index == -1) { if(ret->parens[i].index == -1) {
@ -108,7 +108,7 @@ static HRESULT do_regexp_match_next(script_ctx_t *ctx, RegExpInstance *regexp,
} }
} }
if(n < sizeof(ctx->match_parens)/sizeof(ctx->match_parens[0])) if(n < ARRAY_SIZE(ctx->match_parens))
memset(ctx->match_parens+n, 0, sizeof(ctx->match_parens) - n*sizeof(ctx->match_parens[0])); memset(ctx->match_parens+n, 0, sizeof(ctx->match_parens) - n*sizeof(ctx->match_parens[0]));
} }
@ -595,7 +595,7 @@ static const builtin_prop_t RegExp_props[] = {
static const builtin_info_t RegExp_info = { static const builtin_info_t RegExp_info = {
JSCLASS_REGEXP, JSCLASS_REGEXP,
{NULL, RegExp_value, 0}, {NULL, RegExp_value, 0},
sizeof(RegExp_props)/sizeof(*RegExp_props), ARRAY_SIZE(RegExp_props),
RegExp_props, RegExp_props,
RegExp_destructor, RegExp_destructor,
NULL NULL
@ -612,7 +612,7 @@ static const builtin_prop_t RegExpInst_props[] = {
static const builtin_info_t RegExpInst_info = { static const builtin_info_t RegExpInst_info = {
JSCLASS_REGEXP, JSCLASS_REGEXP,
{NULL, RegExp_value, 0}, {NULL, RegExp_value, 0},
sizeof(RegExpInst_props)/sizeof(*RegExpInst_props), ARRAY_SIZE(RegExpInst_props),
RegExpInst_props, RegExpInst_props,
RegExp_destructor, RegExp_destructor,
NULL NULL
@ -995,7 +995,7 @@ static const builtin_prop_t RegExpConstr_props[] = {
static const builtin_info_t RegExpConstr_info = { static const builtin_info_t RegExpConstr_info = {
JSCLASS_FUNCTION, JSCLASS_FUNCTION,
DEFAULT_FUNCTION_VALUE, DEFAULT_FUNCTION_VALUE,
sizeof(RegExpConstr_props)/sizeof(*RegExpConstr_props), ARRAY_SIZE(RegExpConstr_props),
RegExpConstr_props, RegExpConstr_props,
NULL, NULL,
NULL NULL

View File

@ -526,8 +526,8 @@ static HRESULT str_to_number(jsstr_t *str, double *ret)
ptr++; ptr++;
} }
if(!strncmpW(ptr, infinityW, sizeof(infinityW)/sizeof(WCHAR))) { if(!strncmpW(ptr, infinityW, ARRAY_SIZE(infinityW))) {
ptr += sizeof(infinityW)/sizeof(WCHAR); ptr += ARRAY_SIZE(infinityW);
while(*ptr && isspaceW(*ptr)) while(*ptr && isspaceW(*ptr))
ptr++; ptr++;
@ -701,7 +701,7 @@ static jsstr_t *int_to_string(int i)
i = -i; i = -i;
} }
p = buf + sizeof(buf)/sizeof(*buf)-1; p = buf + ARRAY_SIZE(buf)-1;
*p-- = 0; *p-- = 0;
while(i) { while(i) {
*p-- = i%10 + '0'; *p-- = i%10 + '0';

View File

@ -162,7 +162,7 @@ static int hex_to_int(WCHAR c)
static int check_keywords(parser_ctx_t *ctx, const WCHAR **lval) static int check_keywords(parser_ctx_t *ctx, const WCHAR **lval)
{ {
int min = 0, max = sizeof(keywords)/sizeof(keywords[0])-1, r, i; int min = 0, max = ARRAY_SIZE(keywords)-1, r, i;
while(min <= max) { while(min <= max) {
i = (min+max)/2; i = (min+max)/2;

View File

@ -522,7 +522,7 @@ static const builtin_prop_t Math_props[] = {
static const builtin_info_t Math_info = { static const builtin_info_t Math_info = {
JSCLASS_MATH, JSCLASS_MATH,
{NULL, NULL, 0}, {NULL, NULL, 0},
sizeof(Math_props)/sizeof(*Math_props), ARRAY_SIZE(Math_props),
Math_props, Math_props,
NULL, NULL,
NULL NULL
@ -558,7 +558,7 @@ HRESULT create_math(script_ctx_t *ctx, jsdisp_t **ret)
return hres; return hres;
} }
for(i=0; i < sizeof(constants)/sizeof(*constants); i++) { for(i=0; i < ARRAY_SIZE(constants); i++) {
hres = jsdisp_define_data_property(math, constants[i].name, 0, hres = jsdisp_define_data_property(math, constants[i].name, 0,
jsval_number(constants[i].val)); jsval_number(constants[i].val));
if(FAILED(hres)) { if(FAILED(hres)) {

View File

@ -524,7 +524,7 @@ static const builtin_prop_t Number_props[] = {
static const builtin_info_t Number_info = { static const builtin_info_t Number_info = {
JSCLASS_NUMBER, JSCLASS_NUMBER,
{NULL, NULL,0, Number_get_value}, {NULL, NULL,0, Number_get_value},
sizeof(Number_props)/sizeof(*Number_props), ARRAY_SIZE(Number_props),
Number_props, Number_props,
NULL, NULL,
NULL NULL

View File

@ -252,7 +252,7 @@ static const builtin_prop_t Object_props[] = {
static const builtin_info_t Object_info = { static const builtin_info_t Object_info = {
JSCLASS_OBJECT, JSCLASS_OBJECT,
{NULL, NULL,0, Object_get_value}, {NULL, NULL,0, Object_get_value},
sizeof(Object_props)/sizeof(*Object_props), ARRAY_SIZE(Object_props),
Object_props, Object_props,
Object_destructor, Object_destructor,
NULL NULL
@ -528,7 +528,7 @@ static const builtin_prop_t ObjectConstr_props[] = {
static const builtin_info_t ObjectConstr_info = { static const builtin_info_t ObjectConstr_info = {
JSCLASS_FUNCTION, JSCLASS_FUNCTION,
DEFAULT_FUNCTION_VALUE, DEFAULT_FUNCTION_VALUE,
sizeof(ObjectConstr_props)/sizeof(*ObjectConstr_props), ARRAY_SIZE(ObjectConstr_props),
ObjectConstr_props, ObjectConstr_props,
NULL, NULL,
NULL NULL

View File

@ -943,7 +943,7 @@ static HRESULT String_replace(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
}else { }else {
static const WCHAR undefinedW[] = {'u','n','d','e','f','i','n','e','d'}; static const WCHAR undefinedW[] = {'u','n','d','e','f','i','n','e','d'};
hres = strbuf_append(&ret, undefinedW, sizeof(undefinedW)/sizeof(WCHAR)); hres = strbuf_append(&ret, undefinedW, ARRAY_SIZE(undefinedW));
if(FAILED(hres)) if(FAILED(hres))
break; break;
} }
@ -1595,7 +1595,7 @@ static const builtin_prop_t String_props[] = {
static const builtin_info_t String_info = { static const builtin_info_t String_info = {
JSCLASS_STRING, JSCLASS_STRING,
{NULL, NULL,0, String_get_value}, {NULL, NULL,0, String_get_value},
sizeof(String_props)/sizeof(*String_props), ARRAY_SIZE(String_props),
String_props, String_props,
String_destructor, String_destructor,
NULL NULL
@ -1608,7 +1608,7 @@ static const builtin_prop_t StringInst_props[] = {
static const builtin_info_t StringInst_info = { static const builtin_info_t StringInst_info = {
JSCLASS_STRING, JSCLASS_STRING,
{NULL, NULL,0, String_get_value}, {NULL, NULL,0, String_get_value},
sizeof(StringInst_props)/sizeof(*StringInst_props), ARRAY_SIZE(StringInst_props),
StringInst_props, StringInst_props,
String_destructor, String_destructor,
NULL, NULL,
@ -1726,7 +1726,7 @@ static const builtin_prop_t StringConstr_props[] = {
static const builtin_info_t StringConstr_info = { static const builtin_info_t StringConstr_info = {
JSCLASS_FUNCTION, JSCLASS_FUNCTION,
DEFAULT_FUNCTION_VALUE, DEFAULT_FUNCTION_VALUE,
sizeof(StringConstr_props)/sizeof(*StringConstr_props), ARRAY_SIZE(StringConstr_props),
StringConstr_props, StringConstr_props,
NULL, NULL,
NULL NULL

View File

@ -258,7 +258,7 @@ static const builtin_prop_t VBArray_props[] = {
static const builtin_info_t VBArray_info = { static const builtin_info_t VBArray_info = {
JSCLASS_VBARRAY, JSCLASS_VBARRAY,
{NULL, VBArray_value, 0}, {NULL, VBArray_value, 0},
sizeof(VBArray_props)/sizeof(*VBArray_props), ARRAY_SIZE(VBArray_props),
VBArray_props, VBArray_props,
VBArray_destructor, VBArray_destructor,
NULL NULL