Commit 0bab034f authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Always use jsval-based to_number implementation.

parent 26576b83
...@@ -129,7 +129,7 @@ static HRESULT Array_length(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi ...@@ -129,7 +129,7 @@ static HRESULT Array_length(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
DWORD i; DWORD i;
HRESULT hres; HRESULT hres;
hres = to_number_jsval(ctx, argv[0], ei, &len); hres = to_number(ctx, argv[0], ei, &len);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -567,7 +567,7 @@ static HRESULT Array_slice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsign ...@@ -567,7 +567,7 @@ static HRESULT Array_slice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsign
return hres; return hres;
if(argc) { if(argc) {
hres = to_number_jsval(ctx, argv[0], ei, &range); hres = to_number(ctx, argv[0], ei, &range);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -580,7 +580,7 @@ static HRESULT Array_slice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsign ...@@ -580,7 +580,7 @@ static HRESULT Array_slice(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, unsign
else start = 0; else start = 0;
if(argc > 1) { if(argc > 1) {
hres = to_number_jsval(ctx, argv[1], ei, &range); hres = to_number(ctx, argv[1], ei, &range);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -635,7 +635,7 @@ static HRESULT sort_cmp(script_ctx_t *ctx, jsdisp_t *cmp_func, jsval_t v1, jsval ...@@ -635,7 +635,7 @@ static HRESULT sort_cmp(script_ctx_t *ctx, jsdisp_t *cmp_func, jsval_t v1, jsval
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
hres = to_number_jsval(ctx, res, ei, &n); hres = to_number(ctx, res, ei, &n);
jsval_release(res); jsval_release(res);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
......
...@@ -1348,7 +1348,7 @@ static HRESULT Date_setTime(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi ...@@ -1348,7 +1348,7 @@ static HRESULT Date_setTime(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
if(!argc) if(!argc)
return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL); return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL);
hres = to_number_jsval(ctx, argv[0], ei, &n); hres = to_number(ctx, argv[0], ei, &n);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -1375,7 +1375,7 @@ static HRESULT Date_setMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla ...@@ -1375,7 +1375,7 @@ static HRESULT Date_setMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla
if(!argc) if(!argc)
return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL); return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL);
hres = to_number_jsval(ctx, argv[0], ei, &n); hres = to_number(ctx, argv[0], ei, &n);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -1405,7 +1405,7 @@ static HRESULT Date_setUTCMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD ...@@ -1405,7 +1405,7 @@ static HRESULT Date_setUTCMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD
if(!argc) if(!argc)
return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL); return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL);
hres = to_number_jsval(ctx, argv[0], ei, &n); hres = to_number(ctx, argv[0], ei, &n);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -1437,12 +1437,12 @@ static HRESULT Date_setSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u ...@@ -1437,12 +1437,12 @@ static HRESULT Date_setSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
t = local_time(date->time, date); t = local_time(date->time, date);
hres = to_number_jsval(ctx, argv[0], ei, &sec); hres = to_number(ctx, argv[0], ei, &sec);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
if(argc > 1) { if(argc > 1) {
hres = to_number_jsval(ctx, argv[1], ei, &ms); hres = to_number(ctx, argv[1], ei, &ms);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
}else { }else {
...@@ -1476,12 +1476,12 @@ static HRESULT Date_setUTCSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags ...@@ -1476,12 +1476,12 @@ static HRESULT Date_setUTCSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
t = date->time; t = date->time;
hres = to_number_jsval(ctx, argv[0], ei, &sec); hres = to_number(ctx, argv[0], ei, &sec);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
if(argc > 1) { if(argc > 1) {
hres = to_number_jsval(ctx, argv[1], ei, &ms); hres = to_number(ctx, argv[1], ei, &ms);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
}else { }else {
...@@ -1515,12 +1515,12 @@ static HRESULT Date_setMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u ...@@ -1515,12 +1515,12 @@ static HRESULT Date_setMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
t = local_time(date->time, date); t = local_time(date->time, date);
hres = to_number_jsval(ctx, argv[0], ei, &min); hres = to_number(ctx, argv[0], ei, &min);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
if(argc > 1) { if(argc > 1) {
hres = to_number_jsval(ctx, argv[1], ei, &sec); hres = to_number(ctx, argv[1], ei, &sec);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
}else { }else {
...@@ -1528,7 +1528,7 @@ static HRESULT Date_setMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u ...@@ -1528,7 +1528,7 @@ static HRESULT Date_setMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
} }
if(argc > 2) { if(argc > 2) {
hres = to_number_jsval(ctx, argv[2], ei, &ms); hres = to_number(ctx, argv[2], ei, &ms);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
}else { }else {
...@@ -1562,12 +1562,12 @@ static HRESULT Date_setUTCMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags ...@@ -1562,12 +1562,12 @@ static HRESULT Date_setUTCMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
t = date->time; t = date->time;
hres = to_number_jsval(ctx, argv[0], ei, &min); hres = to_number(ctx, argv[0], ei, &min);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
if(argc > 1) { if(argc > 1) {
hres = to_number_jsval(ctx, argv[1], ei, &sec); hres = to_number(ctx, argv[1], ei, &sec);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
}else { }else {
...@@ -1575,7 +1575,7 @@ static HRESULT Date_setUTCMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags ...@@ -1575,7 +1575,7 @@ static HRESULT Date_setUTCMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
} }
if(argc > 2) { if(argc > 2) {
hres = to_number_jsval(ctx, argv[2], ei, &ms); hres = to_number(ctx, argv[2], ei, &ms);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
}else { }else {
...@@ -1609,12 +1609,12 @@ static HRESULT Date_setHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns ...@@ -1609,12 +1609,12 @@ static HRESULT Date_setHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
t = local_time(date->time, date); t = local_time(date->time, date);
hres = to_number_jsval(ctx, argv[0], ei, &hour); hres = to_number(ctx, argv[0], ei, &hour);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
if(argc > 1) { if(argc > 1) {
hres = to_number_jsval(ctx, argv[1], ei, &min); hres = to_number(ctx, argv[1], ei, &min);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
}else { }else {
...@@ -1622,7 +1622,7 @@ static HRESULT Date_setHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns ...@@ -1622,7 +1622,7 @@ static HRESULT Date_setHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
} }
if(argc > 2) { if(argc > 2) {
hres = to_number_jsval(ctx, argv[2], ei, &sec); hres = to_number(ctx, argv[2], ei, &sec);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
}else { }else {
...@@ -1630,7 +1630,7 @@ static HRESULT Date_setHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns ...@@ -1630,7 +1630,7 @@ static HRESULT Date_setHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
} }
if(argc > 3) { if(argc > 3) {
hres = to_number_jsval(ctx, argv[3], ei, &ms); hres = to_number(ctx, argv[3], ei, &ms);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
}else { }else {
...@@ -1663,12 +1663,12 @@ static HRESULT Date_setUTCHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, ...@@ -1663,12 +1663,12 @@ static HRESULT Date_setUTCHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
t = date->time; t = date->time;
hres = to_number_jsval(ctx, argv[0], ei, &hour); hres = to_number(ctx, argv[0], ei, &hour);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
if(argc > 1) { if(argc > 1) {
hres = to_number_jsval(ctx, argv[1], ei, &min); hres = to_number(ctx, argv[1], ei, &min);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
}else { }else {
...@@ -1676,7 +1676,7 @@ static HRESULT Date_setUTCHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, ...@@ -1676,7 +1676,7 @@ static HRESULT Date_setUTCHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
} }
if(argc > 2) { if(argc > 2) {
hres = to_number_jsval(ctx, argv[2], ei, &sec); hres = to_number(ctx, argv[2], ei, &sec);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
}else { }else {
...@@ -1684,7 +1684,7 @@ static HRESULT Date_setUTCHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, ...@@ -1684,7 +1684,7 @@ static HRESULT Date_setUTCHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
} }
if(argc > 3) { if(argc > 3) {
hres = to_number_jsval(ctx, argv[3], ei, &ms); hres = to_number(ctx, argv[3], ei, &ms);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
}else { }else {
...@@ -1715,7 +1715,7 @@ static HRESULT Date_setDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi ...@@ -1715,7 +1715,7 @@ static HRESULT Date_setDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
if(!argc) if(!argc)
return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL); return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL);
hres = to_number_jsval(ctx, argv[0], ei, &n); hres = to_number(ctx, argv[0], ei, &n);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -1744,7 +1744,7 @@ static HRESULT Date_setUTCDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u ...@@ -1744,7 +1744,7 @@ static HRESULT Date_setUTCDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, u
if(!argc) if(!argc)
return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL); return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL);
hres = to_number_jsval(ctx, argv[0], ei, &n); hres = to_number(ctx, argv[0], ei, &n);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -1775,12 +1775,12 @@ static HRESULT Date_setMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns ...@@ -1775,12 +1775,12 @@ static HRESULT Date_setMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
t = local_time(date->time, date); t = local_time(date->time, date);
hres = to_number_jsval(ctx, argv[0], ei, &month); hres = to_number(ctx, argv[0], ei, &month);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
if(argc > 1) { if(argc > 1) {
hres = to_number_jsval(ctx, argv[1], ei, &ddate); hres = to_number(ctx, argv[1], ei, &ddate);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
}else { }else {
...@@ -1814,12 +1814,12 @@ static HRESULT Date_setUTCMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, ...@@ -1814,12 +1814,12 @@ static HRESULT Date_setUTCMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
t = date->time; t = date->time;
hres = to_number_jsval(ctx, argv[0], ei, &month); hres = to_number(ctx, argv[0], ei, &month);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
if(argc > 1) { if(argc > 1) {
hres = to_number_jsval(ctx, argv[1], ei, &ddate); hres = to_number(ctx, argv[1], ei, &ddate);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
}else { }else {
...@@ -1853,12 +1853,12 @@ static HRESULT Date_setFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, ...@@ -1853,12 +1853,12 @@ static HRESULT Date_setFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
t = local_time(date->time, date); t = local_time(date->time, date);
hres = to_number_jsval(ctx, argv[0], ei, &year); hres = to_number(ctx, argv[0], ei, &year);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
if(argc > 1) { if(argc > 1) {
hres = to_number_jsval(ctx, argv[1], ei, &month); hres = to_number(ctx, argv[1], ei, &month);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
}else { }else {
...@@ -1866,7 +1866,7 @@ static HRESULT Date_setFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, ...@@ -1866,7 +1866,7 @@ static HRESULT Date_setFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
} }
if(argc > 2) { if(argc > 2) {
hres = to_number_jsval(ctx, argv[2], ei, &ddate); hres = to_number(ctx, argv[2], ei, &ddate);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
}else { }else {
...@@ -1899,12 +1899,12 @@ static HRESULT Date_setUTCFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag ...@@ -1899,12 +1899,12 @@ static HRESULT Date_setUTCFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
t = date->time; t = date->time;
hres = to_number_jsval(ctx, argv[0], ei, &year); hres = to_number(ctx, argv[0], ei, &year);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
if(argc > 1) { if(argc > 1) {
hres = to_number_jsval(ctx, argv[1], ei, &month); hres = to_number(ctx, argv[1], ei, &month);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
}else { }else {
...@@ -1912,7 +1912,7 @@ static HRESULT Date_setUTCFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag ...@@ -1912,7 +1912,7 @@ static HRESULT Date_setUTCFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
} }
if(argc > 2) { if(argc > 2) {
hres = to_number_jsval(ctx, argv[2], ei, &ddate); hres = to_number(ctx, argv[2], ei, &ddate);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
}else { }else {
...@@ -1970,7 +1970,7 @@ static HRESULT Date_setYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi ...@@ -1970,7 +1970,7 @@ static HRESULT Date_setYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
t = local_time(date->time, date); t = local_time(date->time, date);
hres = to_number_jsval(ctx, argv[0], ei, &year); hres = to_number(ctx, argv[0], ei, &year);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -2401,7 +2401,7 @@ static HRESULT date_utc(script_ctx_t *ctx, unsigned argc, jsval_t *argv, double ...@@ -2401,7 +2401,7 @@ static HRESULT date_utc(script_ctx_t *ctx, unsigned argc, jsval_t *argv, double
TRACE("\n"); TRACE("\n");
if(argc) { if(argc) {
hres = to_number_jsval(ctx, argv[0], ei, &year); hres = to_number(ctx, argv[0], ei, &year);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
if(0 <= year && year <= 99) if(0 <= year && year <= 99)
...@@ -2411,7 +2411,7 @@ static HRESULT date_utc(script_ctx_t *ctx, unsigned argc, jsval_t *argv, double ...@@ -2411,7 +2411,7 @@ static HRESULT date_utc(script_ctx_t *ctx, unsigned argc, jsval_t *argv, double
} }
if(argc>1) { if(argc>1) {
hres = to_number_jsval(ctx, argv[1], ei, &month); hres = to_number(ctx, argv[1], ei, &month);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
}else { }else {
...@@ -2419,7 +2419,7 @@ static HRESULT date_utc(script_ctx_t *ctx, unsigned argc, jsval_t *argv, double ...@@ -2419,7 +2419,7 @@ static HRESULT date_utc(script_ctx_t *ctx, unsigned argc, jsval_t *argv, double
} }
if(argc>2) { if(argc>2) {
hres = to_number_jsval(ctx, argv[2], ei, &vdate); hres = to_number(ctx, argv[2], ei, &vdate);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
}else { }else {
...@@ -2427,7 +2427,7 @@ static HRESULT date_utc(script_ctx_t *ctx, unsigned argc, jsval_t *argv, double ...@@ -2427,7 +2427,7 @@ static HRESULT date_utc(script_ctx_t *ctx, unsigned argc, jsval_t *argv, double
} }
if(argc>3) { if(argc>3) {
hres = to_number_jsval(ctx, argv[3], ei, &hours); hres = to_number(ctx, argv[3], ei, &hours);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
}else { }else {
...@@ -2435,7 +2435,7 @@ static HRESULT date_utc(script_ctx_t *ctx, unsigned argc, jsval_t *argv, double ...@@ -2435,7 +2435,7 @@ static HRESULT date_utc(script_ctx_t *ctx, unsigned argc, jsval_t *argv, double
} }
if(argc>4) { if(argc>4) {
hres = to_number_jsval(ctx, argv[4], ei, &minutes); hres = to_number(ctx, argv[4], ei, &minutes);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
}else { }else {
...@@ -2443,7 +2443,7 @@ static HRESULT date_utc(script_ctx_t *ctx, unsigned argc, jsval_t *argv, double ...@@ -2443,7 +2443,7 @@ static HRESULT date_utc(script_ctx_t *ctx, unsigned argc, jsval_t *argv, double
} }
if(argc>5) { if(argc>5) {
hres = to_number_jsval(ctx, argv[5], ei, &seconds); hres = to_number(ctx, argv[5], ei, &seconds);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
}else { }else {
...@@ -2451,7 +2451,7 @@ static HRESULT date_utc(script_ctx_t *ctx, unsigned argc, jsval_t *argv, double ...@@ -2451,7 +2451,7 @@ static HRESULT date_utc(script_ctx_t *ctx, unsigned argc, jsval_t *argv, double
} }
if(argc>6) { if(argc>6) {
hres = to_number_jsval(ctx, argv[6], ei, &ms); hres = to_number(ctx, argv[6], ei, &ms);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
} else { } else {
...@@ -2515,7 +2515,7 @@ static HRESULT DateConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, ...@@ -2515,7 +2515,7 @@ static HRESULT DateConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
if(is_string(prim)) if(is_string(prim))
hres = date_parse(get_string(prim), &n); hres = date_parse(get_string(prim), &n);
else else
hres = to_number_jsval(ctx, prim, ei, &n); hres = to_number(ctx, prim, ei, &n);
jsval_release(prim); jsval_release(prim);
if(FAILED(hres)) if(FAILED(hres))
......
...@@ -130,7 +130,7 @@ static HRESULT stack_pop_number(exec_ctx_t *ctx, double *r) ...@@ -130,7 +130,7 @@ static HRESULT stack_pop_number(exec_ctx_t *ctx, double *r)
HRESULT hres; HRESULT hres;
v = stack_pop(ctx); v = stack_pop(ctx);
hres = to_number_jsval(ctx->script, v, ctx->ei, r); hres = to_number(ctx->script, v, ctx->ei, r);
jsval_release(v); jsval_release(v);
return hres; return hres;
} }
...@@ -1454,9 +1454,9 @@ static HRESULT add_eval(script_ctx_t *ctx, jsval_t lval, jsval_t rval, jsexcept_ ...@@ -1454,9 +1454,9 @@ static HRESULT add_eval(script_ctx_t *ctx, jsval_t lval, jsval_t rval, jsexcept_
}else { }else {
double nl, nr; double nl, nr;
hres = to_number_jsval(ctx, l, ei, &nl); hres = to_number(ctx, l, ei, &nl);
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
hres = to_number_jsval(ctx, r, ei, &nr); hres = to_number(ctx, r, ei, &nr);
if(SUCCEEDED(hres)) if(SUCCEEDED(hres))
*ret = jsval_number(nl+nr); *ret = jsval_number(nl+nr);
} }
...@@ -1799,7 +1799,7 @@ static HRESULT interp_tonum(exec_ctx_t *ctx) ...@@ -1799,7 +1799,7 @@ static HRESULT interp_tonum(exec_ctx_t *ctx)
TRACE("\n"); TRACE("\n");
v = stack_pop(ctx); v = stack_pop(ctx);
hres = to_number_jsval(ctx->script, v, ctx->ei, &n); hres = to_number(ctx->script, v, ctx->ei, &n);
jsval_release(v); jsval_release(v);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -1826,7 +1826,7 @@ static HRESULT interp_postinc(exec_ctx_t *ctx) ...@@ -1826,7 +1826,7 @@ static HRESULT interp_postinc(exec_ctx_t *ctx)
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
double n; double n;
hres = to_number_jsval(ctx->script, v, ctx->ei, &n); hres = to_number(ctx->script, v, ctx->ei, &n);
if(SUCCEEDED(hres)) if(SUCCEEDED(hres))
hres = disp_propput(ctx->script, obj, id, jsval_number(n+(double)arg), ctx->ei); hres = disp_propput(ctx->script, obj, id, jsval_number(n+(double)arg), ctx->ei);
if(FAILED(hres)) if(FAILED(hres))
...@@ -1859,7 +1859,7 @@ static HRESULT interp_preinc(exec_ctx_t *ctx) ...@@ -1859,7 +1859,7 @@ static HRESULT interp_preinc(exec_ctx_t *ctx)
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
double n; double n;
hres = to_number_jsval(ctx->script, v, ctx->ei, &n); hres = to_number(ctx->script, v, ctx->ei, &n);
jsval_release(v); jsval_release(v);
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
ret = n+(double)arg; ret = n+(double)arg;
...@@ -1894,7 +1894,7 @@ static HRESULT equal_values(script_ctx_t *ctx, jsval_t lval, jsval_t rval, jsexc ...@@ -1894,7 +1894,7 @@ static HRESULT equal_values(script_ctx_t *ctx, jsval_t lval, jsval_t rval, jsexc
double n; double n;
HRESULT hres; HRESULT hres;
hres = to_number_jsval(ctx, lval, ei, &n); hres = to_number(ctx, lval, ei, &n);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -1906,7 +1906,7 @@ static HRESULT equal_values(script_ctx_t *ctx, jsval_t lval, jsval_t rval, jsexc ...@@ -1906,7 +1906,7 @@ static HRESULT equal_values(script_ctx_t *ctx, jsval_t lval, jsval_t rval, jsexc
double n; double n;
HRESULT hres; HRESULT hres;
hres = to_number_jsval(ctx, rval, ei, &n); hres = to_number(ctx, rval, ei, &n);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -2061,10 +2061,10 @@ static HRESULT less_eval(script_ctx_t *ctx, jsval_t lval, jsval_t rval, BOOL gre ...@@ -2061,10 +2061,10 @@ static HRESULT less_eval(script_ctx_t *ctx, jsval_t lval, jsval_t rval, BOOL gre
return S_OK; return S_OK;
} }
hres = to_number_jsval(ctx, l, ei, &ln); hres = to_number(ctx, l, ei, &ln);
jsval_release(l); jsval_release(l);
if(SUCCEEDED(hres)) if(SUCCEEDED(hres))
hres = to_number_jsval(ctx, r, ei, &rn); hres = to_number(ctx, r, ei, &rn);
jsval_release(r); jsval_release(r);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
......
...@@ -231,7 +231,7 @@ static HRESULT error_constr(script_ctx_t *ctx, WORD flags, unsigned argc, jsval_ ...@@ -231,7 +231,7 @@ static HRESULT error_constr(script_ctx_t *ctx, WORD flags, unsigned argc, jsval_
if(argc) { if(argc) {
double n; double n;
hres = to_number_jsval(ctx, argv[0], ei, &n); hres = to_number(ctx, argv[0], ei, &n);
if(FAILED(hres)) /* FIXME: really? */ if(FAILED(hres)) /* FIXME: really? */
n = NAN; n = NAN;
if(isnan(n)) if(isnan(n))
......
...@@ -392,7 +392,7 @@ static HRESULT JSGlobal_isNaN(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un ...@@ -392,7 +392,7 @@ static HRESULT JSGlobal_isNaN(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
TRACE("\n"); TRACE("\n");
if(argc) { if(argc) {
hres = to_number_jsval(ctx, argv[0], ei, &n); hres = to_number(ctx, argv[0], ei, &n);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -416,7 +416,7 @@ static HRESULT JSGlobal_isFinite(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, ...@@ -416,7 +416,7 @@ static HRESULT JSGlobal_isFinite(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
if(argc) { if(argc) {
double n; double n;
hres = to_number_jsval(ctx, argv[0], ei, &n); hres = to_number(ctx, argv[0], ei, &n);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
......
...@@ -256,10 +256,8 @@ typedef enum { ...@@ -256,10 +256,8 @@ typedef enum {
HRESULT to_primitive(script_ctx_t*,jsval_t,jsexcept_t*,jsval_t*, hint_t) DECLSPEC_HIDDEN; HRESULT to_primitive(script_ctx_t*,jsval_t,jsexcept_t*,jsval_t*, hint_t) DECLSPEC_HIDDEN;
HRESULT to_boolean(jsval_t,BOOL*) DECLSPEC_HIDDEN; HRESULT to_boolean(jsval_t,BOOL*) DECLSPEC_HIDDEN;
HRESULT to_number(script_ctx_t*,VARIANT*,jsexcept_t*,double*) DECLSPEC_HIDDEN; HRESULT to_number(script_ctx_t*,jsval_t,jsexcept_t*,double*) DECLSPEC_HIDDEN;
HRESULT to_number_jsval(script_ctx_t*,jsval_t,jsexcept_t*,double*) DECLSPEC_HIDDEN;
HRESULT to_integer(script_ctx_t*,jsval_t,jsexcept_t*,double*) DECLSPEC_HIDDEN; HRESULT to_integer(script_ctx_t*,jsval_t,jsexcept_t*,double*) DECLSPEC_HIDDEN;
HRESULT to_int32_var(script_ctx_t*,VARIANT*,jsexcept_t*,INT*) DECLSPEC_HIDDEN;
HRESULT to_int32(script_ctx_t*,jsval_t,jsexcept_t*,INT*) DECLSPEC_HIDDEN; HRESULT to_int32(script_ctx_t*,jsval_t,jsexcept_t*,INT*) DECLSPEC_HIDDEN;
HRESULT to_uint32(script_ctx_t*,VARIANT*,jsexcept_t*,DWORD*) DECLSPEC_HIDDEN; HRESULT to_uint32(script_ctx_t*,VARIANT*,jsexcept_t*,DWORD*) DECLSPEC_HIDDEN;
HRESULT to_uint32_jsval(script_ctx_t*,jsval_t,jsexcept_t*,DWORD*) DECLSPEC_HIDDEN; HRESULT to_uint32_jsval(script_ctx_t*,jsval_t,jsexcept_t*,DWORD*) DECLSPEC_HIDDEN;
......
...@@ -575,67 +575,42 @@ static HRESULT str_to_number(BSTR str, double *ret) ...@@ -575,67 +575,42 @@ static HRESULT str_to_number(BSTR str, double *ret)
} }
/* ECMA-262 3rd Edition 9.3 */ /* ECMA-262 3rd Edition 9.3 */
HRESULT to_number(script_ctx_t *ctx, VARIANT *v, jsexcept_t *ei, double *ret) HRESULT to_number(script_ctx_t *ctx, jsval_t val, jsexcept_t *ei, double *ret)
{ {
switch(V_VT(v)) { switch(val.type) {
case VT_EMPTY: case JSV_UNDEFINED:
*ret = NAN; *ret = NAN;
break; return S_OK;
case VT_NULL: case JSV_NULL:
*ret = 0; *ret = 0;
break; return S_OK;
case VT_I4: case JSV_NUMBER:
*ret = V_I4(v); *ret = get_number(val);
break; return S_OK;
case VT_R8: case JSV_STRING:
*ret = V_R8(v); return str_to_number(get_string(val), ret);
break; case JSV_OBJECT: {
case VT_BSTR:
return str_to_number(V_BSTR(v), ret);
case VT_DISPATCH: {
jsval_t prim; jsval_t prim;
HRESULT hres; HRESULT hres;
hres = to_primitive(ctx, jsval_disp(V_DISPATCH(v)), ei, &prim, HINT_NUMBER); hres = to_primitive(ctx, val, ei, &prim, HINT_NUMBER);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
hres = to_number_jsval(ctx, prim, ei, ret); hres = to_number(ctx, prim, ei, ret);
jsval_release(prim); jsval_release(prim);
return hres; return hres;
} }
case VT_BOOL: case JSV_BOOL:
*ret = V_BOOL(v) ? 1 : 0; *ret = get_bool(val) ? 1 : 0;
break;
case VT_I2:
case VT_INT:
assert(0);
default:
FIXME("unimplemented for vt %d\n", V_VT(v));
return E_NOTIMPL;
}
return S_OK;
}
/* ECMA-262 3rd Edition 9.3 */
HRESULT to_number_jsval(script_ctx_t *ctx, jsval_t v, jsexcept_t *ei, double *ret)
{
VARIANT var;
HRESULT hres;
if(v.type == JSV_NUMBER) {
*ret = v.u.n;
return S_OK; return S_OK;
} case JSV_VARIANT:
FIXME("unimplemented for variant %s\n", debugstr_variant(get_variant(val)));
hres = jsval_to_variant(v, &var); return E_NOTIMPL;
if(FAILED(hres)) };
return hres;
hres = to_number(ctx, &var, ei, ret); assert(0);
VariantClear(&var); return E_FAIL;
return hres;
} }
/* ECMA-262 3rd Edition 9.4 */ /* ECMA-262 3rd Edition 9.4 */
...@@ -644,7 +619,7 @@ HRESULT to_integer(script_ctx_t *ctx, jsval_t v, jsexcept_t *ei, double *ret) ...@@ -644,7 +619,7 @@ HRESULT to_integer(script_ctx_t *ctx, jsval_t v, jsexcept_t *ei, double *ret)
double n; double n;
HRESULT hres; HRESULT hres;
hres = to_number_jsval(ctx, v, ei, &n); hres = to_number(ctx, v, ei, &n);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -656,31 +631,12 @@ HRESULT to_integer(script_ctx_t *ctx, jsval_t v, jsexcept_t *ei, double *ret) ...@@ -656,31 +631,12 @@ HRESULT to_integer(script_ctx_t *ctx, jsval_t v, jsexcept_t *ei, double *ret)
} }
/* ECMA-262 3rd Edition 9.5 */ /* ECMA-262 3rd Edition 9.5 */
HRESULT to_int32_var(script_ctx_t *ctx, VARIANT *v, jsexcept_t *ei, INT *ret)
{
double n;
HRESULT hres;
if(V_VT(v) == VT_I4) {
*ret = V_I4(v);
return S_OK;
}
hres = to_number(ctx, v, ei, &n);
if(FAILED(hres))
return hres;
*ret = isnan(n) || isinf(n) ? 0 : n;
return S_OK;
}
/* ECMA-262 3rd Edition 9.5 */
HRESULT to_int32(script_ctx_t *ctx, jsval_t v, jsexcept_t *ei, INT *ret) HRESULT to_int32(script_ctx_t *ctx, jsval_t v, jsexcept_t *ei, INT *ret)
{ {
double n; double n;
HRESULT hres; HRESULT hres;
hres = to_number_jsval(ctx, v, ei, &n); hres = to_number(ctx, v, ei, &n);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -691,6 +647,7 @@ HRESULT to_int32(script_ctx_t *ctx, jsval_t v, jsexcept_t *ei, INT *ret) ...@@ -691,6 +647,7 @@ HRESULT to_int32(script_ctx_t *ctx, jsval_t v, jsexcept_t *ei, INT *ret)
/* ECMA-262 3rd Edition 9.6 */ /* ECMA-262 3rd Edition 9.6 */
HRESULT to_uint32(script_ctx_t *ctx, VARIANT *v, jsexcept_t *ei, DWORD *ret) HRESULT to_uint32(script_ctx_t *ctx, VARIANT *v, jsexcept_t *ei, DWORD *ret)
{ {
jsval_t val;
double n; double n;
HRESULT hres; HRESULT hres;
...@@ -699,7 +656,12 @@ HRESULT to_uint32(script_ctx_t *ctx, VARIANT *v, jsexcept_t *ei, DWORD *ret) ...@@ -699,7 +656,12 @@ HRESULT to_uint32(script_ctx_t *ctx, VARIANT *v, jsexcept_t *ei, DWORD *ret)
return S_OK; return S_OK;
} }
hres = to_number(ctx, v, ei, &n); hres = variant_to_jsval(v, &val);
if(FAILED(hres))
return hres;
hres = to_number(ctx, val, ei, &n);
jsval_release(val);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -924,8 +886,13 @@ HRESULT to_object_jsval(script_ctx_t *ctx, jsval_t v, IDispatch **disp) ...@@ -924,8 +886,13 @@ HRESULT to_object_jsval(script_ctx_t *ctx, jsval_t v, IDispatch **disp)
HRESULT variant_change_type(script_ctx_t *ctx, VARIANT *dst, VARIANT *src, VARTYPE vt) HRESULT variant_change_type(script_ctx_t *ctx, VARIANT *dst, VARIANT *src, VARTYPE vt)
{ {
jsexcept_t ei; jsexcept_t ei;
jsval_t val;
HRESULT hres; HRESULT hres;
hres = variant_to_jsval(src, &val);
if(FAILED(hres))
return hres;
memset(&ei, 0, sizeof(ei)); memset(&ei, 0, sizeof(ei));
switch(vt) { switch(vt) {
...@@ -933,7 +900,7 @@ HRESULT variant_change_type(script_ctx_t *ctx, VARIANT *dst, VARIANT *src, VARTY ...@@ -933,7 +900,7 @@ HRESULT variant_change_type(script_ctx_t *ctx, VARIANT *dst, VARIANT *src, VARTY
case VT_I4: { case VT_I4: {
INT i; INT i;
hres = to_int32_var(ctx, src, &ei, &i); hres = to_int32(ctx, val, &ei, &i);
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
if(vt == VT_I4) if(vt == VT_I4)
V_I4(dst) = i; V_I4(dst) = i;
...@@ -944,7 +911,7 @@ HRESULT variant_change_type(script_ctx_t *ctx, VARIANT *dst, VARIANT *src, VARTY ...@@ -944,7 +911,7 @@ HRESULT variant_change_type(script_ctx_t *ctx, VARIANT *dst, VARIANT *src, VARTY
} }
case VT_R8: { case VT_R8: {
double n; double n;
hres = to_number(ctx, src, &ei, &n); hres = to_number(ctx, val, &ei, &n);
if(SUCCEEDED(hres)) if(SUCCEEDED(hres))
V_R8(dst) = n; V_R8(dst) = n;
break; break;
...@@ -952,21 +919,15 @@ HRESULT variant_change_type(script_ctx_t *ctx, VARIANT *dst, VARIANT *src, VARTY ...@@ -952,21 +919,15 @@ HRESULT variant_change_type(script_ctx_t *ctx, VARIANT *dst, VARIANT *src, VARTY
case VT_R4: { case VT_R4: {
double n; double n;
hres = to_number(ctx, src, &ei, &n); hres = to_number(ctx, val, &ei, &n);
if(SUCCEEDED(hres)) if(SUCCEEDED(hres))
V_R4(dst) = n; V_R4(dst) = n;
break; break;
} }
case VT_BOOL: { case VT_BOOL: {
jsval_t val;
BOOL b; BOOL b;
hres = variant_to_jsval(src, &val);
if(FAILED(hres))
return hres;
hres = to_boolean(val, &b); hres = to_boolean(val, &b);
jsval_release(val);
if(SUCCEEDED(hres)) if(SUCCEEDED(hres))
V_BOOL(dst) = b ? VARIANT_TRUE : VARIANT_FALSE; V_BOOL(dst) = b ? VARIANT_TRUE : VARIANT_FALSE;
break; break;
...@@ -990,6 +951,7 @@ HRESULT variant_change_type(script_ctx_t *ctx, VARIANT *dst, VARIANT *src, VARTY ...@@ -990,6 +951,7 @@ HRESULT variant_change_type(script_ctx_t *ctx, VARIANT *dst, VARIANT *src, VARTY
hres = E_NOTIMPL; hres = E_NOTIMPL;
} }
jsval_release(val);
if(FAILED(hres)) { if(FAILED(hres)) {
jsval_release(ei.val); jsval_release(ei.val);
return hres; return hres;
......
...@@ -72,7 +72,7 @@ static HRESULT Math_abs(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned ...@@ -72,7 +72,7 @@ static HRESULT Math_abs(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
return S_OK; return S_OK;
} }
hres = to_number_jsval(ctx, argv[0], ei, &d); hres = to_number(ctx, argv[0], ei, &d);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -95,7 +95,7 @@ static HRESULT Math_acos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne ...@@ -95,7 +95,7 @@ static HRESULT Math_acos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne
return S_OK; return S_OK;
} }
hres = to_number_jsval(ctx, argv[0], ei, &x); hres = to_number(ctx, argv[0], ei, &x);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -118,7 +118,7 @@ static HRESULT Math_asin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne ...@@ -118,7 +118,7 @@ static HRESULT Math_asin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne
return S_OK; return S_OK;
} }
hres = to_number_jsval(ctx, argv[0], ei, &x); hres = to_number(ctx, argv[0], ei, &x);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -141,7 +141,7 @@ static HRESULT Math_atan(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne ...@@ -141,7 +141,7 @@ static HRESULT Math_atan(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne
return S_OK; return S_OK;
} }
hres = to_number_jsval(ctx, argv[0], ei, &x); hres = to_number(ctx, argv[0], ei, &x);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -164,11 +164,11 @@ static HRESULT Math_atan2(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsign ...@@ -164,11 +164,11 @@ static HRESULT Math_atan2(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsign
return S_OK; return S_OK;
} }
hres = to_number_jsval(ctx, argv[0], ei, &y); hres = to_number(ctx, argv[0], ei, &y);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
hres = to_number_jsval(ctx, argv[1], ei, &x); hres = to_number(ctx, argv[1], ei, &x);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -192,7 +192,7 @@ static HRESULT Math_ceil(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne ...@@ -192,7 +192,7 @@ static HRESULT Math_ceil(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne
return S_OK; return S_OK;
} }
hres = to_number_jsval(ctx, argv[0], ei, &x); hres = to_number(ctx, argv[0], ei, &x);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -215,7 +215,7 @@ static HRESULT Math_cos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned ...@@ -215,7 +215,7 @@ static HRESULT Math_cos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
return S_OK; return S_OK;
} }
hres = to_number_jsval(ctx, argv[0], ei, &x); hres = to_number(ctx, argv[0], ei, &x);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -238,7 +238,7 @@ static HRESULT Math_exp(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned ...@@ -238,7 +238,7 @@ static HRESULT Math_exp(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
return S_OK; return S_OK;
} }
hres = to_number_jsval(ctx, argv[0], ei, &x); hres = to_number(ctx, argv[0], ei, &x);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -261,7 +261,7 @@ static HRESULT Math_floor(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsign ...@@ -261,7 +261,7 @@ static HRESULT Math_floor(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsign
return S_OK; return S_OK;
} }
hres = to_number_jsval(ctx, argv[0], ei, &x); hres = to_number(ctx, argv[0], ei, &x);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -284,7 +284,7 @@ static HRESULT Math_log(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned ...@@ -284,7 +284,7 @@ static HRESULT Math_log(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
return S_OK; return S_OK;
} }
hres = to_number_jsval(ctx, argv[0], ei, &x); hres = to_number(ctx, argv[0], ei, &x);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -309,12 +309,12 @@ static HRESULT Math_max(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned ...@@ -309,12 +309,12 @@ static HRESULT Math_max(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
return S_OK; return S_OK;
} }
hres = to_number_jsval(ctx, argv[0], ei, &max); hres = to_number(ctx, argv[0], ei, &max);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
for(i=1; i < argc; i++) { for(i=1; i < argc; i++) {
hres = to_number_jsval(ctx, argv[i], ei, &d); hres = to_number(ctx, argv[i], ei, &d);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -343,12 +343,12 @@ static HRESULT Math_min(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned ...@@ -343,12 +343,12 @@ static HRESULT Math_min(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
return S_OK; return S_OK;
} }
hres = to_number_jsval(ctx, argv[0], ei, &min); hres = to_number(ctx, argv[0], ei, &min);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
for(i=1; i < argc; i++) { for(i=1; i < argc; i++) {
hres = to_number_jsval(ctx, argv[i], ei, &d); hres = to_number(ctx, argv[i], ei, &d);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -376,11 +376,11 @@ static HRESULT Math_pow(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned ...@@ -376,11 +376,11 @@ static HRESULT Math_pow(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
return S_OK; return S_OK;
} }
hres = to_number_jsval(ctx, argv[0], ei, &x); hres = to_number(ctx, argv[0], ei, &x);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
hres = to_number_jsval(ctx, argv[1], ei, &y); hres = to_number(ctx, argv[1], ei, &y);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -420,7 +420,7 @@ static HRESULT Math_round(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsign ...@@ -420,7 +420,7 @@ static HRESULT Math_round(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsign
return S_OK; return S_OK;
} }
hres = to_number_jsval(ctx, argv[0], ei, &x); hres = to_number(ctx, argv[0], ei, &x);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -443,7 +443,7 @@ static HRESULT Math_sin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned ...@@ -443,7 +443,7 @@ static HRESULT Math_sin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
return S_OK; return S_OK;
} }
hres = to_number_jsval(ctx, argv[0], ei, &x); hres = to_number(ctx, argv[0], ei, &x);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -466,7 +466,7 @@ static HRESULT Math_sqrt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne ...@@ -466,7 +466,7 @@ static HRESULT Math_sqrt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigne
return S_OK; return S_OK;
} }
hres = to_number_jsval(ctx, argv[0], ei, &x); hres = to_number(ctx, argv[0], ei, &x);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -489,7 +489,7 @@ static HRESULT Math_tan(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned ...@@ -489,7 +489,7 @@ static HRESULT Math_tan(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned
return S_OK; return S_OK;
} }
hres = to_number_jsval(ctx, argv[0], ei, &x); hres = to_number(ctx, argv[0], ei, &x);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
......
...@@ -559,7 +559,7 @@ static HRESULT NumberConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags ...@@ -559,7 +559,7 @@ static HRESULT NumberConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
return S_OK; return S_OK;
} }
hres = to_number_jsval(ctx, argv[0], ei, &n); hres = to_number(ctx, argv[0], ei, &n);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
...@@ -571,7 +571,7 @@ static HRESULT NumberConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags ...@@ -571,7 +571,7 @@ static HRESULT NumberConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
jsdisp_t *obj; jsdisp_t *obj;
if(argc) { if(argc) {
hres = to_number_jsval(ctx, argv[0], ei, &n); hres = to_number(ctx, argv[0], ei, &n);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
}else { }else {
......
...@@ -3523,7 +3523,7 @@ static INT index_from_val(script_ctx_t *ctx, jsval_t v) ...@@ -3523,7 +3523,7 @@ static INT index_from_val(script_ctx_t *ctx, jsval_t v)
HRESULT hres; HRESULT hres;
memset(&ei, 0, sizeof(ei)); memset(&ei, 0, sizeof(ei));
hres = to_number_jsval(ctx, v, &ei, &n); hres = to_number(ctx, v, &ei, &n);
if(FAILED(hres)) { /* FIXME: Move ignoring exceptions to to_primitive */ if(FAILED(hres)) { /* FIXME: Move ignoring exceptions to to_primitive */
jsval_release(ei.val); jsval_release(ei.val);
return 0; return 0;
......
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