Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
efda5561
Commit
efda5561
authored
Dec 04, 2009
by
Jacek Caban
Committed by
Alexandre Julliard
Dec 04, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Correctly handle NaN and Infinity in to_int32 and to_uint32.
parent
8ea4102a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
2 deletions
+20
-2
jsutils.c
dlls/jscript/jsutils.c
+8
-2
lang.js
dlls/jscript/tests/lang.js
+12
-0
No files found.
dlls/jscript/jsutils.c
View file @
efda5561
...
...
@@ -467,7 +467,10 @@ HRESULT to_int32(script_ctx_t *ctx, VARIANT *v, jsexcept_t *ei, INT *ret)
if
(
FAILED
(
hres
))
return
hres
;
*
ret
=
V_VT
(
&
num
)
==
VT_I4
?
V_I4
(
&
num
)
:
(
INT
)
V_R8
(
&
num
);
if
(
V_VT
(
&
num
)
==
VT_I4
)
*
ret
=
V_I4
(
&
num
);
else
*
ret
=
isnan
(
V_R8
(
&
num
))
||
isinf
(
V_R8
(
&
num
))
?
0
:
(
INT
)
V_R8
(
&
num
);
return
S_OK
;
}
...
...
@@ -481,7 +484,10 @@ HRESULT to_uint32(script_ctx_t *ctx, VARIANT *v, jsexcept_t *ei, DWORD *ret)
if
(
FAILED
(
hres
))
return
hres
;
*
ret
=
V_VT
(
&
num
)
==
VT_I4
?
V_I4
(
&
num
)
:
(
DWORD
)
V_R8
(
&
num
);
if
(
V_VT
(
&
num
)
==
VT_I4
)
*
ret
=
V_I4
(
&
num
);
else
*
ret
=
isnan
(
V_R8
(
&
num
))
||
isinf
(
V_R8
(
&
num
))
?
0
:
(
DWORD
)
V_R8
(
&
num
);
return
S_OK
;
}
...
...
dlls/jscript/tests/lang.js
View file @
efda5561
...
...
@@ -346,6 +346,15 @@ tmp = -3.5 | 0;
ok
(
tmp
===
-
3
,
"-3.5 | 0 !== -3"
);
ok
(
getVT
(
tmp
)
===
"VT_I4"
,
"getVT(3.5|0) = "
+
getVT
(
tmp
));
tmp
=
0
|
NaN
;
ok
(
tmp
===
0
,
"0 | NaN = "
+
tmp
);
tmp
=
0
|
Infinity
;
ok
(
tmp
===
0
,
"0 | NaN = "
+
tmp
);
tmp
=
0
|
(
-
Infinity
);
ok
(
tmp
===
0
,
"0 | NaN = "
+
tmp
);
tmp
=
10
;
ok
((
tmp
|=
0x10
)
===
26
,
"tmp(10) |= 0x10 !== 26"
);
ok
(
getVT
(
tmp
)
===
"VT_I4"
,
"getVT(tmp |= 10) = "
+
getVT
(
tmp
));
...
...
@@ -380,6 +389,9 @@ ok(tmp === 2, "8 >> 2 = " + tmp);
tmp
=
-
64
>>>
4
;
ok
(
tmp
===
0x0ffffffc
,
"-64 >>> 4 = "
+
tmp
);
tmp
=
4
>>>
NaN
;
ok
(
tmp
===
4
,
"4 >>> NaN = "
+
tmp
);
tmp
=
10
;
ok
((
tmp
&=
8
)
===
8
,
"tmp(10) &= 8 !== 8"
);
ok
(
getVT
(
tmp
)
===
"VT_I4"
,
"getVT(tmp &= 8) = "
+
getVT
(
tmp
));
...
...
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