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
063df731
Commit
063df731
authored
May 27, 2009
by
Piotr Caban
Committed by
Alexandre Julliard
May 27, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Fix integer/double parsing.
parent
f2c1095a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
6 deletions
+22
-6
lex.c
dlls/jscript/lex.c
+20
-6
lang.js
dlls/jscript/tests/lang.js
+2
-0
No files found.
dlls/jscript/lex.c
View file @
063df731
...
...
@@ -17,6 +17,7 @@
*/
#include <math.h>
#include <limits.h>
#include "jscript.h"
#include "activscp.h"
...
...
@@ -374,13 +375,19 @@ static int parse_double_literal(parser_ctx_t *ctx, LONG int_part, literal_t **li
{
double
d
,
tmp
=
1
.
0
;
if
(
ctx
->
ptr
==
ctx
->
end
||
!
isdigitW
(
*
ctx
->
ptr
))
{
ERR
(
"No digit after point
\n
"
);
if
(
ctx
->
ptr
==
ctx
->
end
||
(
!
isdigitW
(
*
ctx
->
ptr
)
&&
*
ctx
->
ptr
!=
'.'
&&
*
ctx
->
ptr
!=
'e'
&&
*
ctx
->
ptr
!=
'E'
))
{
ERR
(
"Illegal character
\n
"
);
return
0
;
}
d
=
int_part
;
while
(
ctx
->
ptr
<
ctx
->
end
&&
isdigitW
(
*
ctx
->
ptr
))
d
=
d
*
10
+
*
(
ctx
->
ptr
++
)
-
'0'
;
if
(
*
ctx
->
ptr
==
'.'
)
ctx
->
ptr
++
;
while
(
ctx
->
ptr
<
ctx
->
end
&&
isdigitW
(
*
ctx
->
ptr
))
d
+=
(
tmp
/=
10
.
0
)
*
(
*
ctx
->
ptr
++
-
'0'
);
if
(
ctx
->
ptr
<
ctx
->
end
&&
(
*
ctx
->
ptr
==
'e'
||
*
ctx
->
ptr
==
'E'
))
{
...
...
@@ -458,14 +465,21 @@ static int parse_numeric_literal(parser_ctx_t *ctx, literal_t **literal)
}
while
(
ctx
->
ptr
<
ctx
->
end
&&
isdigitW
(
*
ctx
->
ptr
))
l
=
l
*
10
+
*
(
ctx
->
ptr
++
)
-
'0'
;
{
d
=
l
*
10
+
*
(
ctx
->
ptr
)
-
'0'
;
if
(
ctx
->
ptr
<
ctx
->
end
)
{
if
(
*
ctx
->
ptr
==
'.'
)
{
ctx
->
ptr
++
;
/* Check for integer overflow */
if
(
l
>
INT_MAX
/
10
||
d
<
0
)
return
parse_double_literal
(
ctx
,
l
,
literal
);
l
=
d
;
ctx
->
ptr
++
;
}
if
(
ctx
->
ptr
<
ctx
->
end
)
{
if
(
*
ctx
->
ptr
==
'.'
||
*
ctx
->
ptr
==
'e'
||
*
ctx
->
ptr
==
'E'
)
return
parse_double_literal
(
ctx
,
l
,
literal
);
if
(
is_identifier_char
(
*
ctx
->
ptr
))
{
WARN
(
"unexpected identifier char
\n
"
);
return
lex_error
(
ctx
,
E_FAIL
);
...
...
dlls/jscript/tests/lang.js
View file @
063df731
...
...
@@ -33,6 +33,8 @@ ok(true === true, "true === true is false");
ok
(
null
===
null
,
"null === null is false"
);
ok
(
undefined
===
undefined
,
"undefined === undefined is false"
);
ok
(
!
(
undefined
===
null
),
"!(undefined === null) is false"
);
ok
(
1
E0
===
1
,
"1E0 === 1 is false"
);
ok
(
1000000
*
1000000
===
1000000000000
,
"1000000*1000000 === 1000000000000 is false"
);
ok
(
1
!==
2
,
"1 !== 2 is false"
);
ok
(
null
!==
undefined
,
"null !== undefined is false"
);
...
...
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