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
89dd8401
Commit
89dd8401
authored
Jun 02, 2014
by
Shuai Meng
Committed by
Alexandre Julliard
Jun 12, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Fixed CInt.
parent
ded01d65
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
3 deletions
+68
-3
global.c
dlls/vbscript/global.c
+9
-3
api.vbs
dlls/vbscript/tests/api.vbs
+59
-0
No files found.
dlls/vbscript/global.c
View file @
89dd8401
...
...
@@ -398,18 +398,24 @@ static HRESULT Global_CCur(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARI
static
HRESULT
Global_CInt
(
vbdisp_t
*
This
,
VARIANT
*
arg
,
unsigned
args_cnt
,
VARIANT
*
res
)
{
int
val
;
VARIANT
v
;
HRESULT
hres
;
TRACE
(
"%s
\n
"
,
debugstr_variant
(
arg
));
assert
(
args_cnt
==
1
);
hres
=
to_int
(
arg
,
&
val
);
V_VT
(
&
v
)
=
VT_EMPTY
;
hres
=
VariantChangeType
(
&
v
,
arg
,
0
,
VT_I2
);
if
(
FAILED
(
hres
))
return
hres
;
return
return_int
(
res
,
val
);
if
(
!
res
)
return
DISP_E_BADVARTYPE
;
else
{
*
res
=
v
;
return
S_OK
;
}
}
static
HRESULT
Global_CLng
(
vbdisp_t
*
This
,
VARIANT
*
arg
,
unsigned
args_cnt
,
VARIANT
*
res
)
...
...
dlls/vbscript/tests/api.vbs
View file @
89dd8401
...
...
@@ -738,4 +738,63 @@ MyObject.myval = 0
Call
ok
(
CLng
(
MyObject
)
=
0
,
"CLng(MyObject) = "
&
CLng
(
MyObject
))
Call
ok
(
getVT
(
CLng
(
MyObject
))
=
"VT_I4"
,
"getVT(CLng(MyObject)) = "
&
getVT
(
CLng
(
MyObject
)))
Sub
testCIntError
(
strings
,
error_num1
,
error_num2
)
on
error
resume
next
Dim
x
Call
Err
.
clear
()
x
=
CInt
(
strings
)
Call
ok
(
Err
.
number
=
error_num1
,
"Err.number = "
&
Err
.
number
)
Call
Err
.
clear
()
Call
CInt
(
strings
)
Call
ok
(
Err
.
number
=
error_num2
,
"Err.number = "
&
Err
.
number
)
End
Sub
Call
ok
(
CInt
(
Empty
)
=
0
,
"CInt(Empty) = "
&
CInt
(
Empty
))
Call
ok
(
getVT
(
CInt
(
Empty
))
=
"VT_I2"
,
"getVT(CInt(Empty)) = "
&
getVT
(
CInt
(
Empty
)))
Call
ok
(
CInt
(
CByte
(
0
))
=
0
,
"CInt(CByte(0)) = "
&
CInt
(
CByte
(
0
)))
Call
ok
(
getVT
(
CInt
(
CByte
(
0
)))
=
"VT_I2"
,
"getVT(CInt(CByte(0))) = "
&
getVT
(
CInt
(
CByte
(
0
))))
Call
ok
(
CInt
(
CCur
(
0
))
=
0
,
"CInt(CCur(0)) = "
&
CInt
(
CCur
(
0
)))
Call
ok
(
getVT
(
CInt
(
CCur
(
0
)))
=
"VT_I2"
,
"getVT(CInt(CCur(0))) = "
&
getVT
(
CInt
(
CCur
(
0
))))
Call
ok
(
CInt
(
0.49
)
=
0
,
"CInt(0.49) = "
&
CInt
(
0.49
))
Call
ok
(
getVT
(
CInt
(
0.49
))
=
"VT_I2"
,
"getVT(CInt(0.49)) = "
&
getVT
(
CInt
(
0.49
)))
Call
ok
(
CInt
(
0.5
)
=
0
,
"CInt(0.5) = "
&
CInt
(
0.5
))
Call
ok
(
getVT
(
CInt
(
0.5
))
=
"VT_I2"
,
"getVT(CInt(0.5)) = "
&
getVT
(
CInt
(
0.5
)))
Call
ok
(
CInt
(
0.51
)
=
1
,
"CInt(0.51) = "
&
CInt
(
0.51
))
Call
ok
(
getVT
(
CInt
(
0.51
))
=
"VT_I2"
,
"getVT(CInt(0.51)) = "
&
getVT
(
CInt
(
0.51
)))
Call
ok
(
CInt
(
1.49
)
=
1
,
"CInt(0.49) = "
&
CInt
(
0.49
))
Call
ok
(
getVT
(
CInt
(
0.49
))
=
"VT_I2"
,
"getVT(CInt(0.49)) = "
&
getVT
(
CInt
(
0.49
)))
Call
ok
(
CInt
(
1.5
)
=
2
,
"CInt(1.5) = "
&
CInt
(
1.5
))
Call
ok
(
getVT
(
CInt
(
1.5
))
=
"VT_I2"
,
"getVT(CInt(1.5)) = "
&
getVT
(
CInt
(
1.5
)))
Call
ok
(
CInt
(
1.51
)
=
2
,
"CInt(1.51) = "
&
CInt
(
1.51
))
Call
ok
(
getVT
(
CInt
(
1.51
))
=
"VT_I2"
,
"getVT(CInt(1.51)) = "
&
getVT
(
CInt
(
1.51
)))
Call
ok
(
CInt
(
"-1"
)
=
-
1
,
"CInt(
""
-1
""
) = "
&
CInt
(
"-1"
))
Call
ok
(
getVT
(
CInt
(
"-1"
))
=
"VT_I2"
,
"getVT(CInt(
""
-1
""
)) = "
&
getVT
(
CInt
(
"-1"
)))
If
isEnglishLang
Then
Call
ok
(
CInt
(
"-0.5"
)
=
0
,
"CInt(
""
-0.5
""
) = "
&
CInt
(
"-0.5"
))
Call
ok
(
getVT
(
CInt
(
"-0.5"
))
=
"VT_I2"
,
"getVT(CInt(
""
-0.5
""
)) = "
&
getVT
(
CInt
(
"-0.5"
)))
End
If
Call
testCIntError
(
""
,
13
,
13
)
Call
testCIntError
(
"-1"
,
0
,
458
)
Call
testCIntError
(
"TRUE"
,
13
,
13
)
Call
testCIntError
(
"FALSE"
,
13
,
13
)
Call
testCIntError
(
"#TRue#"
,
13
,
13
)
Call
testCIntError
(
"#fAlSE#"
,
13
,
13
)
Call
testCIntError
(
1
,
0
,
458
)
Call
testCIntError
(
32767.49
,
0
,
458
)
Call
testCIntError
(
32767.5
,
6
,
6
)
Call
testCIntError
(
-
32768.5
,
0
,
458
)
Call
testCIntError
(
-
32768.51
,
6
,
6
)
Call
ok
(
CInt
(
True
)
=
-
1
,
"CInt(True) = "
&
CInt
(
True
))
Call
ok
(
getVT
(
CInt
(
True
))
=
"VT_I2"
,
"getVT(CInt(True)) = "
&
getVT
(
CInt
(
True
)))
Call
ok
(
CInt
(
False
)
=
0
,
"CInt(False) = "
&
CInt
(
False
))
Call
ok
(
getVT
(
CInt
(
False
))
=
"VT_I2"
,
"getVT(CInt(False)) = "
&
getVT
(
CInt
(
False
)))
MyObject
.
myval
=
2.5
Call
ok
(
CInt
(
MyObject
)
=
2
,
"CInt(MyObject) = "
&
CInt
(
MyObject
))
Call
ok
(
getVT
(
CInt
(
MyObject
))
=
"VT_I2"
,
"getVT(CInt(MyObject)) = "
&
getVT
(
CInt
(
MyObject
)))
MyObject
.
myval
=
1.5
Call
ok
(
CInt
(
MyObject
)
=
2
,
"CInt(MyObject) = "
&
CInt
(
MyObject
))
Call
ok
(
getVT
(
CInt
(
MyObject
))
=
"VT_I2"
,
"getVT(CInt(MyObject)) = "
&
getVT
(
CInt
(
MyObject
)))
Call
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