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
369b540a
Commit
369b540a
authored
Nov 30, 2023
by
Robert Wilhelm
Committed by
Alexandre Julliard
Dec 01, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Handle numdecimalplaces argument in Round().
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=55185
parent
0a7f5646
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
8 deletions
+46
-8
global.c
dlls/vbscript/global.c
+23
-8
api.vbs
dlls/vbscript/tests/api.vbs
+23
-0
No files found.
dlls/vbscript/global.c
View file @
369b540a
...
...
@@ -3153,32 +3153,47 @@ static HRESULT Global_MonthName(BuiltinDisp *This, VARIANT *args, unsigned args_
return
return_bstr
(
res
,
ret
);
}
static
HRESULT
Global_Round
(
BuiltinDisp
*
This
,
VARIANT
*
arg
,
unsigned
args_cnt
,
VARIANT
*
res
)
static
HRESULT
Global_Round
(
BuiltinDisp
*
This
,
VARIANT
*
arg
s
,
unsigned
args_cnt
,
VARIANT
*
res
)
{
double
n
;
int
decimal_places
=
0
;
double
d
;
HRESULT
hres
;
TRACE
(
"%s
\n
"
,
debugstr_variant
(
arg
));
TRACE
(
"%s %s
\n
"
,
debugstr_variant
(
args
),
args_cnt
==
2
?
debugstr_variant
(
args
+
1
)
:
"0"
);
assert
(
args_cnt
==
1
||
args_cnt
==
2
);
if
(
!
res
)
return
S_OK
;
switch
(
V_VT
(
arg
))
{
if
(
args_cnt
==
2
)
{
if
(
V_VT
(
args
+
1
)
!=
VT_ERROR
)
{
hres
=
to_int
(
args
+
1
,
&
decimal_places
);
if
(
FAILED
(
hres
))
return
hres
;
}
}
switch
(
V_VT
(
args
))
{
case
VT_I2
:
case
VT_I4
:
case
VT_BOOL
:
*
res
=
*
arg
;
*
res
=
*
arg
s
;
return
S_OK
;
case
VT_R8
:
n
=
V_R8
(
arg
);
d
=
V_R8
(
args
);
break
;
default:
hres
=
to_double
(
arg
,
&
n
);
hres
=
to_double
(
arg
s
,
&
d
);
if
(
FAILED
(
hres
))
return
hres
;
}
return
return_double
(
res
,
round
(
n
));
hres
=
VarR8Round
(
d
,
decimal_places
,
&
d
);
if
(
FAILED
(
hres
))
return
hres
;
return
return_double
(
res
,
d
);
}
static
HRESULT
Global_Escape
(
BuiltinDisp
*
This
,
VARIANT
*
arg
,
unsigned
args_cnt
,
VARIANT
*
res
)
...
...
dlls/vbscript/tests/api.vbs
View file @
369b540a
...
...
@@ -1090,6 +1090,29 @@ TestRound "2", 2, "VT_R8"
TestRound
true
,
true
,
"VT_BOOL"
TestRound
false
,
false
,
"VT_BOOL"
Sub
TestRound2
(
val
,
decnum
,
exval
,
vt
)
Call
ok
(
Round
(
val
,
decnum
)
=
exval
,
"Round("
&
val
&
" , "
&
decnum
&
") = "
&
Round
(
val
,
decnum
))
Call
ok
(
getVT
(
Round
(
val
,
decnum
))
=
vt
,
"getVT(Round("
&
val
&
" , "
&
decnum
&
")) = "
&
getVT
(
Round
(
val
,
decnum
)))
End
Sub
TestRound2
3
,
0
,
3
,
"VT_I2"
TestRound2
3
,
1
,
3
,
"VT_I2"
TestRound2
3.3
,
0
,
3
,
"VT_R8"
TestRound2
3.8
,
0
,
4
,
"VT_R8"
TestRound2
3.5
,
0
,
4
,
"VT_R8"
TestRound2
-
3.3
,
0
,
-
3
,
"VT_R8"
TestRound2
-
3.5
,
0
,
-
4
,
"VT_R8"
TestRound2
3.3
,
1
,
3.3
,
"VT_R8"
TestRound2
3.8
,
1
,
3.8
,
"VT_R8"
TestRound2
3.5
,
1
,
3.5
,
"VT_R8"
TestRound2
-
3.3
,
1
,
-
3.3
,
"VT_R8"
TestRound2
-
3.5
,
1
,
-
3.5
,
"VT_R8"
TestRound2
"2"
,
1
,
2
,
"VT_R8"
TestRound2
true
,
0
,
true
,
"VT_BOOL"
TestRound2
false
,
0
,
false
,
"VT_BOOL"
TestRound2
true
,
1
,
true
,
"VT_BOOL"
TestRound2
false
,
1
,
false
,
"VT_BOOL"
if
isEnglishLang
then
Call
ok
(
WeekDayName
(
1
)
=
"Sunday"
,
"WeekDayName(1) = "
&
WeekDayName
(
1
))
Call
ok
(
WeekDayName
(
3
)
=
"Tuesday"
,
"WeekDayName(3) = "
&
WeekDayName
(
3
))
...
...
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