Module: wine Branch: master Commit: eb203a149b2d3a20525ddb2eca4edb2ae59f5887 URL: http://source.winehq.org/git/wine.git/?a=commit;h=eb203a149b2d3a20525ddb2eca...
Author: Piotr Caban piotr.caban@gmail.com Date: Wed Jun 3 21:11:20 2009 +0200
jscript: Remove NaN related FIXMEs.
---
dlls/jscript/date.c | 5 +---- dlls/jscript/global.c | 4 ++-- dlls/jscript/jscript.h | 7 +++++++ dlls/jscript/string.c | 4 ++-- dlls/jscript/tests/api.js | 6 ++++++ 5 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/dlls/jscript/date.c b/dlls/jscript/date.c index 0dac085..53ff314 100644 --- a/dlls/jscript/date.c +++ b/dlls/jscript/date.c @@ -81,11 +81,8 @@ static const WCHAR setUTCFullYearW[] = {'s','e','t','U','T','C','F','u','l','l', /* ECMA-262 3rd Edition 15.9.1.14 */ static inline DOUBLE time_clip(DOUBLE time) { - /* FIXME: Handle inf */ - if(8.64e15 < time || time < -8.64e15) { - FIXME("return NaN\n"); - return 0.0; + return ret_nan(); }
return floor(time); diff --git a/dlls/jscript/global.c b/dlls/jscript/global.c index 01d9eb2..a714f8e 100644 --- a/dlls/jscript/global.c +++ b/dlls/jscript/global.c @@ -351,8 +351,8 @@ static HRESULT JSGlobal_parseInt(DispatchEx *dispex, LCID lcid, WORD flags, DISP HRESULT hres;
if(!arg_cnt(dp)) { - FIXME("NAN\n"); - return E_NOTIMPL; + if(retv) num_set_nan(retv); + return S_OK; }
if(arg_cnt(dp) >= 2) { diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index 4862b28..6cf3535 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -255,6 +255,13 @@ static inline void num_set_nan(VARIANT *v) #endif }
+static inline DOUBLE ret_nan() +{ + VARIANT v; + num_set_nan(&v); + return V_R8(&v); +} + static inline void num_set_inf(VARIANT *v, BOOL positive) { V_VT(v) = VT_R8; diff --git a/dlls/jscript/string.c b/dlls/jscript/string.c index eeceb1f..82c1043 100644 --- a/dlls/jscript/string.c +++ b/dlls/jscript/string.c @@ -254,8 +254,8 @@ static HRESULT String_charCodeAt(DispatchEx *dispex, LCID lcid, WORD flags, DISP return hres;
if(V_VT(&v) != VT_I4 || V_I4(&v) < 0 || V_I4(&v) >= length) { - FIXME("NAN\n"); - return E_FAIL; + if(retv) num_set_nan(&v); + return S_OK; }
idx = V_I4(&v); diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js index a17b067..2b6e0b2 100644 --- a/dlls/jscript/tests/api.js +++ b/dlls/jscript/tests/api.js @@ -934,6 +934,12 @@ var date = new Date(); date = new Date(100); ok(date.getTime() === 100, "date.getTime() = " + date.getTime()); ok(Date.prototype.getTime() === 0, "date.prototype.getTime() = " + Date.prototype.getTime()); +date = new Date(8.64e15); +ok(date.getTime() === 8.64e15, "date.getTime() = " + date.getTime()); +date = new Date(8.64e15+1); +ok(isNaN(0+date.getTime()), "date.getTime() is not NaN"); +date = new Date(Infinity); +ok(isNaN(0+date.getTime()), "date.getTime() is not NaN");
ok(typeof(Math.PI) === "number", "typeof(Math.PI) = " + typeof(Math.PI)); ok(Math.floor(Math.PI*100) === 314, "Math.PI = " + Math.PI);