Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
4f6f8ef2
Commit
4f6f8ef2
authored
Oct 16, 2008
by
Jacek Caban
Committed by
Alexandre Julliard
Oct 17, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added NaN handling to relational operators.
parent
9a7265be
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
12 deletions
+31
-12
engine.c
dlls/jscript/engine.c
+19
-12
lang.js
dlls/jscript/tests/lang.js
+12
-0
No files found.
dlls/jscript/engine.c
View file @
4f6f8ef2
...
...
@@ -16,6 +16,9 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <math.h>
#include "jscript.h"
...
...
@@ -2599,7 +2602,7 @@ HRESULT not_equal2_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD f
}
/* ECMA-262 3rd Edition 11.8.5 */
static
HRESULT
less_eval
(
exec_ctx_t
*
ctx
,
VARIANT
*
lval
,
VARIANT
*
rval
,
jsexcept_t
*
ei
,
BOOL
*
ret
)
static
HRESULT
less_eval
(
exec_ctx_t
*
ctx
,
VARIANT
*
lval
,
VARIANT
*
rval
,
BOOL
greater
,
jsexcept_t
*
ei
,
BOOL
*
ret
)
{
VARIANT
l
,
r
,
ln
,
rn
;
HRESULT
hres
;
...
...
@@ -2615,7 +2618,7 @@ static HRESULT less_eval(exec_ctx_t *ctx, VARIANT *lval, VARIANT *rval, jsexcept
}
if
(
V_VT
(
&
l
)
==
VT_BSTR
&&
V_VT
(
&
r
)
==
VT_BSTR
)
{
*
ret
=
strcmpW
(
V_BSTR
(
&
l
),
V_BSTR
(
&
r
))
<
0
;
*
ret
=
(
strcmpW
(
V_BSTR
(
&
l
),
V_BSTR
(
&
r
))
<
0
)
^
greater
;
SysFreeString
(
V_BSTR
(
&
l
));
SysFreeString
(
V_BSTR
(
&
r
));
return
S_OK
;
...
...
@@ -2629,10 +2632,14 @@ static HRESULT less_eval(exec_ctx_t *ctx, VARIANT *lval, VARIANT *rval, jsexcept
if
(
FAILED
(
hres
))
return
hres
;
if
(
V_VT
(
&
ln
)
==
VT_I4
&&
V_VT
(
&
rn
)
==
VT_I4
)
*
ret
=
V_I4
(
&
ln
)
<
V_I4
(
&
rn
);
else
*
ret
=
num_val
(
&
ln
)
<
num_val
(
&
rn
);
if
(
V_VT
(
&
ln
)
==
VT_I4
&&
V_VT
(
&
rn
)
==
VT_I4
)
{
*
ret
=
(
V_I4
(
&
ln
)
<
V_I4
(
&
rn
))
^
greater
;
}
else
{
DOUBLE
ld
=
num_val
(
&
ln
);
DOUBLE
rd
=
num_val
(
&
rn
);
*
ret
=
!
isnan
(
ld
)
&&
!
isnan
(
rd
)
&&
((
ld
<
rd
)
^
greater
);
}
return
S_OK
;
}
...
...
@@ -2651,7 +2658,7 @@ HRESULT less_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD flags,
if
(
FAILED
(
hres
))
return
hres
;
hres
=
less_eval
(
ctx
,
&
lval
,
&
rval
,
ei
,
&
b
);
hres
=
less_eval
(
ctx
,
&
lval
,
&
rval
,
FALSE
,
ei
,
&
b
);
VariantClear
(
&
lval
);
VariantClear
(
&
rval
);
if
(
FAILED
(
hres
))
...
...
@@ -2674,13 +2681,13 @@ HRESULT lesseq_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD flags
if
(
FAILED
(
hres
))
return
hres
;
hres
=
less_eval
(
ctx
,
&
rval
,
&
lval
,
ei
,
&
b
);
hres
=
less_eval
(
ctx
,
&
rval
,
&
lval
,
TRUE
,
ei
,
&
b
);
VariantClear
(
&
lval
);
VariantClear
(
&
rval
);
if
(
FAILED
(
hres
))
return
hres
;
return
return_bool
(
ret
,
!
b
);
return
return_bool
(
ret
,
b
);
}
/* ECMA-262 3rd Edition 11.8.2 */
...
...
@@ -2697,7 +2704,7 @@ HRESULT greater_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD flag
if
(
FAILED
(
hres
))
return
hres
;
hres
=
less_eval
(
ctx
,
&
rval
,
&
lval
,
ei
,
&
b
);
hres
=
less_eval
(
ctx
,
&
rval
,
&
lval
,
FALSE
,
ei
,
&
b
);
VariantClear
(
&
lval
);
VariantClear
(
&
rval
);
if
(
FAILED
(
hres
))
...
...
@@ -2720,13 +2727,13 @@ HRESULT greatereq_expression_eval(exec_ctx_t *ctx, expression_t *_expr, DWORD fl
if
(
FAILED
(
hres
))
return
hres
;
hres
=
less_eval
(
ctx
,
&
lval
,
&
rval
,
ei
,
&
b
);
hres
=
less_eval
(
ctx
,
&
lval
,
&
rval
,
TRUE
,
ei
,
&
b
);
VariantClear
(
&
lval
);
VariantClear
(
&
rval
);
if
(
FAILED
(
hres
))
return
hres
;
return
return_bool
(
ret
,
!
b
);
return
return_bool
(
ret
,
b
);
}
/* ECMA-262 3rd Edition 11.4.8 */
...
...
dlls/jscript/tests/lang.js
View file @
4f6f8ef2
...
...
@@ -801,4 +801,16 @@ ok(isFinite(0.5, NaN) === true, "isFinite(0.5, NaN) !== true");
ok
(
isFinite
(
NaN
,
0.5
)
===
false
,
"isFinite(NaN, 0.5) !== false"
);
ok
(
isFinite
()
===
false
,
"isFinite() !== false"
);
ok
((
1
<
NaN
)
===
false
,
"(1 < NaN) !== false"
);
ok
((
1
>
NaN
)
===
false
,
"(1 > NaN) !== false"
);
ok
((
1
<=
NaN
)
===
false
,
"(1 <= NaN) !== false"
);
ok
((
1
>=
NaN
)
===
false
,
"(1 >= NaN) !== false"
);
ok
((
NaN
<
1
)
===
false
,
"(NaN < 1) !== false"
);
ok
((
NaN
>
1
)
===
false
,
"(NaN > 1) !== false"
);
ok
((
NaN
<=
1
)
===
false
,
"(NaN <= 1) !== false"
);
ok
((
NaN
>=
1
)
===
false
,
"(NaN >= 1) !== false"
);
ok
((
Infinity
<
2
)
===
false
,
"(Infinity < 2) !== false"
);
ok
((
Infinity
>
2
)
===
true
,
"(Infinity > 2) !== true"
);
ok
((
-
Infinity
<
2
)
===
true
,
"(-Infinity < 2) !== true"
);
reportSuccess
();
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment