Commit db737291 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Get rid of num_set_nan hack.

parent d0a719a7
...@@ -1987,7 +1987,7 @@ static HRESULT Date_getYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP ...@@ -1987,7 +1987,7 @@ static HRESULT Date_getYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP
t = local_time(date->time, date); t = local_time(date->time, date);
if(isnan(t)) { if(isnan(t)) {
if(retv) if(retv)
num_set_nan(retv); num_set_val(retv, NAN);
return S_OK; return S_OK;
} }
...@@ -2023,7 +2023,7 @@ static HRESULT Date_setYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP ...@@ -2023,7 +2023,7 @@ static HRESULT Date_setYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP
if(isnan(year)) { if(isnan(year)) {
date->time = year; date->time = year;
if(retv) if(retv)
num_set_nan(retv); num_set_val(retv, NAN);
return S_OK; return S_OK;
} }
...@@ -2414,7 +2414,7 @@ static HRESULT DateConstr_parse(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, ...@@ -2414,7 +2414,7 @@ static HRESULT DateConstr_parse(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
if(!arg_cnt(dp)) { if(!arg_cnt(dp)) {
if(retv) if(retv)
num_set_nan(retv); num_set_val(retv, NAN);
return S_OK; return S_OK;
} }
......
...@@ -456,7 +456,7 @@ static HRESULT JSGlobal_parseInt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, ...@@ -456,7 +456,7 @@ static HRESULT JSGlobal_parseInt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
HRESULT hres; HRESULT hres;
if(!arg_cnt(dp)) { if(!arg_cnt(dp)) {
if(retv) num_set_nan(retv); if(retv) num_set_val(retv, NAN);
return S_OK; return S_OK;
} }
...@@ -468,7 +468,7 @@ static HRESULT JSGlobal_parseInt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, ...@@ -468,7 +468,7 @@ static HRESULT JSGlobal_parseInt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
if(radix && (radix < 2 || radix > 36)) { if(radix && (radix < 2 || radix > 36)) {
WARN("radix %d out of range\n", radix); WARN("radix %d out of range\n", radix);
if(retv) if(retv)
num_set_nan(retv); num_set_val(retv, NAN);
return S_OK; return S_OK;
} }
} }
...@@ -537,7 +537,7 @@ static HRESULT JSGlobal_parseFloat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag ...@@ -537,7 +537,7 @@ static HRESULT JSGlobal_parseFloat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
if(!arg_cnt(dp)) { if(!arg_cnt(dp)) {
if(retv) if(retv)
num_set_nan(retv); num_set_val(retv, NAN);
return S_OK; return S_OK;
} }
...@@ -616,7 +616,7 @@ static HRESULT JSGlobal_parseFloat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag ...@@ -616,7 +616,7 @@ static HRESULT JSGlobal_parseFloat(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
if(ret_nan) { if(ret_nan) {
if(retv) if(retv)
num_set_nan(retv); num_set_val(retv, NAN);
return S_OK; return S_OK;
} }
...@@ -1284,7 +1284,7 @@ HRESULT init_global(script_ctx_t *ctx) ...@@ -1284,7 +1284,7 @@ HRESULT init_global(script_ctx_t *ctx)
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
num_set_nan(&var); num_set_val(&var, NAN);
hres = jsdisp_propput_name(ctx->global, NaNW, &var, NULL/*FIXME*/); hres = jsdisp_propput_name(ctx->global, NaNW, &var, NULL/*FIXME*/);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
......
...@@ -435,16 +435,6 @@ static inline void num_set_val(VARIANT *v, DOUBLE d) ...@@ -435,16 +435,6 @@ static inline void num_set_val(VARIANT *v, DOUBLE d)
} }
} }
static inline void num_set_nan(VARIANT *v)
{
V_VT(v) = VT_R8;
#ifdef NAN
V_R8(v) = NAN;
#else
V_UI8(v) = (ULONGLONG)0x7ff80000<<32;
#endif
}
static inline void num_set_inf(VARIANT *v, BOOL positive) static inline void num_set_inf(VARIANT *v, BOOL positive)
{ {
V_VT(v) = VT_R8; V_VT(v) = VT_R8;
......
...@@ -68,7 +68,7 @@ static HRESULT Math_abs(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA ...@@ -68,7 +68,7 @@ static HRESULT Math_abs(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA
if(!arg_cnt(dp)) { if(!arg_cnt(dp)) {
if(retv) if(retv)
num_set_nan(retv); num_set_val(retv, NAN);
return S_OK; return S_OK;
} }
...@@ -90,7 +90,7 @@ static HRESULT Math_acos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPAR ...@@ -90,7 +90,7 @@ static HRESULT Math_acos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPAR
TRACE("\n"); TRACE("\n");
if(!arg_cnt(dp)) { if(!arg_cnt(dp)) {
if(retv) num_set_nan(retv); if(retv) num_set_val(retv, NAN);
return S_OK; return S_OK;
} }
...@@ -98,12 +98,8 @@ static HRESULT Math_acos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPAR ...@@ -98,12 +98,8 @@ static HRESULT Math_acos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPAR
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
if(retv) { if(retv)
if(x < -1.0 || x > 1.0) num_set_val(retv, x < -1.0 || x > 1.0 ? NAN : acos(x));
num_set_nan(retv);
else
num_set_val(retv, acos(x));
}
return S_OK; return S_OK;
} }
...@@ -116,7 +112,7 @@ static HRESULT Math_asin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPAR ...@@ -116,7 +112,7 @@ static HRESULT Math_asin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPAR
TRACE("\n"); TRACE("\n");
if(!arg_cnt(dp)) { if(!arg_cnt(dp)) {
if(retv) num_set_nan(retv); if(retv) num_set_val(retv, NAN);
return S_OK; return S_OK;
} }
...@@ -124,12 +120,8 @@ static HRESULT Math_asin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPAR ...@@ -124,12 +120,8 @@ static HRESULT Math_asin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPAR
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
if(retv) { if(retv)
if(x < -1.0 || x > 1.0) num_set_val(retv, x < -1.0 || x > 1.0 ? NAN : asin(x));
num_set_nan(retv);
else
num_set_val(retv, asin(x));
}
return S_OK; return S_OK;
} }
...@@ -142,7 +134,7 @@ static HRESULT Math_atan(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPAR ...@@ -142,7 +134,7 @@ static HRESULT Math_atan(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPAR
TRACE("\n"); TRACE("\n");
if(!arg_cnt(dp)) { if(!arg_cnt(dp)) {
if(retv) num_set_nan(retv); if(retv) num_set_val(retv, NAN);
return S_OK; return S_OK;
} }
...@@ -163,7 +155,7 @@ static HRESULT Math_atan2(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPA ...@@ -163,7 +155,7 @@ static HRESULT Math_atan2(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPA
TRACE("\n"); TRACE("\n");
if(arg_cnt(dp)<2) { if(arg_cnt(dp)<2) {
if(retv) num_set_nan(retv); if(retv) num_set_val(retv, NAN);
return S_OK; return S_OK;
} }
...@@ -190,7 +182,7 @@ static HRESULT Math_ceil(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPAR ...@@ -190,7 +182,7 @@ static HRESULT Math_ceil(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPAR
if(!arg_cnt(dp)) { if(!arg_cnt(dp)) {
if(retv) if(retv)
num_set_nan(retv); num_set_val(retv, NAN);
return S_OK; return S_OK;
} }
...@@ -212,7 +204,7 @@ static HRESULT Math_cos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA ...@@ -212,7 +204,7 @@ static HRESULT Math_cos(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA
TRACE("\n"); TRACE("\n");
if(!arg_cnt(dp)) { if(!arg_cnt(dp)) {
if(retv) num_set_nan(retv); if(retv) num_set_val(retv, NAN);
return S_OK; return S_OK;
} }
...@@ -233,7 +225,7 @@ static HRESULT Math_exp(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA ...@@ -233,7 +225,7 @@ static HRESULT Math_exp(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA
TRACE("\n"); TRACE("\n");
if(!arg_cnt(dp)) { if(!arg_cnt(dp)) {
if(retv) num_set_nan(retv); if(retv) num_set_val(retv, NAN);
return S_OK; return S_OK;
} }
...@@ -255,7 +247,7 @@ static HRESULT Math_floor(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPA ...@@ -255,7 +247,7 @@ static HRESULT Math_floor(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPA
if(!arg_cnt(dp)) { if(!arg_cnt(dp)) {
if(retv) if(retv)
num_set_nan(retv); num_set_val(retv, NAN);
return S_OK; return S_OK;
} }
...@@ -278,7 +270,7 @@ static HRESULT Math_log(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA ...@@ -278,7 +270,7 @@ static HRESULT Math_log(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA
if(!arg_cnt(dp)) { if(!arg_cnt(dp)) {
if(retv) if(retv)
num_set_nan(retv); num_set_val(retv, NAN);
return S_OK; return S_OK;
} }
...@@ -286,12 +278,8 @@ static HRESULT Math_log(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA ...@@ -286,12 +278,8 @@ static HRESULT Math_log(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
if(retv) { if(retv)
if(x < -0.0) num_set_val(retv, x < -0.0 ? NAN : log(x));
num_set_nan(retv);
else
num_set_val(retv, log(x));
}
return S_OK; return S_OK;
} }
...@@ -373,7 +361,7 @@ static HRESULT Math_pow(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA ...@@ -373,7 +361,7 @@ static HRESULT Math_pow(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA
TRACE("\n"); TRACE("\n");
if(arg_cnt(dp) < 2) { if(arg_cnt(dp) < 2) {
if(retv) num_set_nan(retv); if(retv) num_set_val(retv, NAN);
return S_OK; return S_OK;
} }
...@@ -417,7 +405,8 @@ static HRESULT Math_round(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPA ...@@ -417,7 +405,8 @@ static HRESULT Math_round(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPA
TRACE("\n"); TRACE("\n");
if(!arg_cnt(dp)) { if(!arg_cnt(dp)) {
num_set_nan(retv); if(retv)
num_set_val(retv, NAN);
return S_OK; return S_OK;
} }
...@@ -439,7 +428,7 @@ static HRESULT Math_sin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA ...@@ -439,7 +428,7 @@ static HRESULT Math_sin(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA
TRACE("\n"); TRACE("\n");
if(!arg_cnt(dp)) { if(!arg_cnt(dp)) {
if(retv) num_set_nan(retv); if(retv) num_set_val(retv, NAN);
return S_OK; return S_OK;
} }
...@@ -460,7 +449,7 @@ static HRESULT Math_sqrt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPAR ...@@ -460,7 +449,7 @@ static HRESULT Math_sqrt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPAR
TRACE("\n"); TRACE("\n");
if(!arg_cnt(dp)) { if(!arg_cnt(dp)) {
if(retv) num_set_nan(retv); if(retv) num_set_val(retv, NAN);
return S_OK; return S_OK;
} }
...@@ -481,7 +470,7 @@ static HRESULT Math_tan(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA ...@@ -481,7 +470,7 @@ static HRESULT Math_tan(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARA
TRACE("\n"); TRACE("\n");
if(!arg_cnt(dp)) { if(!arg_cnt(dp)) {
if(retv) num_set_nan(retv); if(retv) num_set_val(retv, NAN);
return S_OK; return S_OK;
} }
......
...@@ -16,6 +16,9 @@ ...@@ -16,6 +16,9 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#include "wine/port.h"
#include "jscript.h" #include "jscript.h"
#include "wine/debug.h" #include "wine/debug.h"
...@@ -358,7 +361,7 @@ static HRESULT String_charCodeAt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, ...@@ -358,7 +361,7 @@ static HRESULT String_charCodeAt(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
if(!is_int32(d) || d < 0 || d >= length) { if(!is_int32(d) || d < 0 || d >= length) {
SysFreeString(val_str); SysFreeString(val_str);
if(retv) if(retv)
num_set_nan(retv); num_set_val(retv, NAN);
return S_OK; return S_OK;
} }
......
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