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
7c7ccc0e
Commit
7c7ccc0e
authored
May 16, 2014
by
Piotr Caban
Committed by
Alexandre Julliard
May 19, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Parse doubles with bigger precision in parse_numeric_literal.
parent
613c1045
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
10 deletions
+34
-10
lex.c
dlls/vbscript/lex.c
+33
-10
lang.vbs
dlls/vbscript/tests/lang.vbs
+1
-0
No files found.
dlls/vbscript/lex.c
View file @
7c7ccc0e
...
...
@@ -16,6 +16,9 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <assert.h>
#include "vbscript.h"
...
...
@@ -258,28 +261,48 @@ static int parse_string_literal(parser_ctx_t *ctx, const WCHAR **ret)
static
int
parse_numeric_literal
(
parser_ctx_t
*
ctx
,
void
**
ret
)
{
double
n
=
0
;
LONGLONG
d
=
0
,
hlp
;
int
exp
=
0
;
if
(
*
ctx
->
ptr
==
'0'
&&
!
(
'0'
<=
ctx
->
ptr
[
1
]
&&
ctx
->
ptr
[
1
]
<=
'9'
)
&&
ctx
->
ptr
[
1
]
!=
'.'
)
return
*
ctx
->
ptr
++
;
do
{
n
=
n
*
10
+
*
ctx
->
ptr
++
-
'0'
;
}
while
(
'0'
<=
*
ctx
->
ptr
&&
*
ctx
->
ptr
<=
'9'
);
while
(
ctx
->
ptr
<
ctx
->
end
&&
isdigitW
(
*
ctx
->
ptr
))
{
hlp
=
d
*
10
+
*
(
ctx
->
ptr
++
)
-
'0'
;
if
(
d
>
MAXLONGLONG
/
10
||
hlp
<
0
)
{
exp
++
;
break
;
}
else
d
=
hlp
;
}
while
(
ctx
->
ptr
<
ctx
->
end
&&
isdigitW
(
*
ctx
->
ptr
))
{
exp
++
;
ctx
->
ptr
++
;
}
if
(
*
ctx
->
ptr
!=
'.'
)
{
if
(
(
LONG
)
n
==
n
)
{
LONG
l
=
n
;
if
(
!
exp
&&
(
LONG
)
d
==
d
)
{
LONG
l
=
d
;
*
(
LONG
*
)
ret
=
l
;
return
(
short
)
l
==
l
?
tShort
:
tLong
;
}
}
else
{
double
e
=
1
.
0
;
while
(
'0'
<=
*++
ctx
->
ptr
&&
*
ctx
->
ptr
<=
'9'
)
n
+=
(
e
/=
10
.
0
)
*
(
*
ctx
->
ptr
-
'0'
);
ctx
->
ptr
++
;
while
(
ctx
->
ptr
<
ctx
->
end
&&
isdigitW
(
*
ctx
->
ptr
))
{
hlp
=
d
*
10
+
*
(
ctx
->
ptr
++
)
-
'0'
;
if
(
d
>
MAXLONGLONG
/
10
||
hlp
<
0
)
break
;
d
=
hlp
;
exp
--
;
}
while
(
ctx
->
ptr
<
ctx
->
end
&&
isdigitW
(
*
ctx
->
ptr
))
ctx
->
ptr
++
;
}
*
(
double
*
)
ret
=
n
;
*
(
double
*
)
ret
=
exp
>=
0
?
d
*
pow
(
10
,
exp
)
:
d
/
pow
(
10
,
-
exp
)
;
return
tDouble
;
}
...
...
dlls/vbscript/tests/lang.vbs
View file @
7c7ccc0e
...
...
@@ -187,6 +187,7 @@ Call ok(2*3 = 6, "2*3 = " & (2*3))
Call
ok
(
3
/
2
=
1.5
,
"3/2 = "
&
(
3
/
2
))
Call
ok
(
5
\
4
/
2
=
2
,
"5\4/2 = "
&
(
5
\
2
/
1
))
Call
ok
(
12
/
3
\
2
=
2
,
"12/3\2 = "
&
(
12
/
3
\
2
))
Call
ok
(
5
/
1000000
=
0.000005
,
"5/1000000 = "
&
(
5
/
1000000
))
Call
ok
(
2
^
3
=
8
,
"2^3 = "
&
(
2
^
3
))
Call
ok
(
2
^
3
^
2
=
64
,
"2^3^2 = "
&
(
2
^
3
^
2
))
...
...
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