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
b8aecb92
Commit
b8aecb92
authored
May 03, 2014
by
Shuai Meng
Committed by
Alexandre Julliard
May 08, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Fixed CBool handling.
parent
43241934
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
29 deletions
+67
-29
global.c
dlls/vbscript/global.c
+12
-29
api.vbs
dlls/vbscript/tests/api.vbs
+55
-0
No files found.
dlls/vbscript/global.c
View file @
b8aecb92
...
...
@@ -114,16 +114,6 @@ static HRESULT return_int(VARIANT *res, int val)
return
S_OK
;
}
static
HRESULT
return_bool
(
VARIANT
*
res
,
int
val
)
{
if
(
res
)
{
V_VT
(
res
)
=
VT_BOOL
;
V_BOOL
(
res
)
=
val
!=
0
?
VARIANT_TRUE
:
VARIANT_FALSE
;
}
return
S_OK
;
}
static
inline
HRESULT
return_double
(
VARIANT
*
res
,
double
val
)
{
if
(
res
)
{
...
...
@@ -413,30 +403,23 @@ static HRESULT Global_CLng(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARI
static
HRESULT
Global_CBool
(
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
);
switch
(
V_VT
(
arg
))
{
case
VT_I2
:
val
=
V_I2
(
arg
);
break
;
case
VT_I4
:
val
=
V_I4
(
arg
);
break
;
case
VT_R4
:
val
=
V_R4
(
arg
)
>
0
.
0
||
V_R4
(
arg
)
<
0
.
0
;
break
;
case
VT_R8
:
val
=
V_R8
(
arg
)
>
0
.
0
||
V_R8
(
arg
)
<
0
.
0
;
break
;
default:
ERR
(
"Not a numeric value: %s
\n
"
,
debugstr_variant
(
arg
));
return
E_FAIL
;
}
V_VT
(
&
v
)
=
VT_EMPTY
;
hres
=
VariantChangeType
(
&
v
,
arg
,
VARIANT_LOCALBOOL
,
VT_BOOL
);
if
(
FAILED
(
hres
))
return
hres
;
return
return_bool
(
res
,
val
);
if
(
res
)
*
res
=
v
;
else
VariantClear
(
&
v
);
return
S_OK
;
}
static
HRESULT
Global_CByte
(
vbdisp_t
*
This
,
VARIANT
*
arg
,
unsigned
args_cnt
,
VARIANT
*
res
)
...
...
dlls/vbscript/tests/api.vbs
View file @
b8aecb92
...
...
@@ -478,4 +478,59 @@ Call ok(getVT(CBool(0)) = "VT_BOOL", "getVT(CBool(0)) = " & getVT(CBool(0)))
Call
ok
(
CBool
(
-
5
)
=
true
,
"CBool(-5) = "
&
CBool
(
-
5
))
Call
ok
(
getVT
(
CBool
(
-
5
))
=
"VT_BOOL"
,
"getVT(CBool(-5)) = "
&
getVT
(
CBool
(
-
5
)))
Sub
testCBoolError
(
strings
,
error_num
)
on
error
resume
next
Call
Err
.
clear
()
Call
CBool
(
strings
)
Call
ok
(
Err
.
number
=
error_num
,
"Err.number = "
&
Err
.
number
)
End
Sub
Class
ValClass
Public
myval
Public
default
Property
Get
defprop
defprop
=
myval
End
Property
End
Class
Dim
MyObject
Set
MyObject
=
New
ValClass
Call
ok
(
CBool
(
Empty
)
=
False
,
"CBool(Empty) = "
&
CBool
(
Empty
))
Call
ok
(
getVT
(
CBool
(
Empty
))
=
"VT_BOOL"
,
"getVT(CBool(Empty)) = "
&
getVT
(
CBool
(
Empty
)))
Call
ok
(
CBool
(
1
)
=
True
,
"CBool(1) = "
&
CBool
(
1
))
Call
ok
(
getVT
(
CBool
(
1
))
=
"VT_BOOL"
,
"getVT(CBool(1)) = "
&
getVT
(
CBool
(
1
)))
Call
ok
(
CBool
(
0
)
=
False
,
"CBool(0) = "
&
CBool
(
0
))
Call
ok
(
getVT
(
CBool
(
0
))
=
"VT_BOOL"
,
"getVT(CBool(0)) = "
&
getVT
(
CBool
(
0
)))
Call
ok
(
CBool
(
-
0.56
)
=
True
,
"CBool(-0.56) = "
&
CBool
(
-
0.56
))
Call
ok
(
getVT
(
CBool
(
-
0.56
))
=
"VT_BOOL"
,
"getVT(CBool(-0.56)) = "
&
getVT
(
CBool
(
-
0.56
)))
Call
testCBoolError
(
""
,
13
)
Call
ok
(
CBool
(
"0"
)
=
False
,
"CBool(
""
0
""
) = "
&
CBool
(
"0"
))
Call
ok
(
getVT
(
CBool
(
"0"
))
=
"VT_BOOL"
,
"getVT(CBool(
""
0
""
)) = "
&
getVT
(
CBool
(
"0"
)))
If
isEnglishLang
Then
Call
ok
(
CBool
(
"0.1"
)
=
True
,
"CBool(
""
0.1
""
) = "
&
CBool
(
"0.1"
))
Call
ok
(
getVT
(
CBool
(
"0.1"
))
=
"VT_BOOL"
,
"getVT(CBool(
""
0.1
""
)) = "
&
getVT
(
CBool
(
"0.1"
)))
End
If
Call
ok
(
CBool
(
"true"
)
=
True
,
"CBool(
""
true
""
) = "
&
CBool
(
"true"
))
Call
ok
(
getVT
(
CBool
(
"true"
))
=
"VT_BOOL"
,
"getVT(CBool(
""
true
""
)) = "
&
getVT
(
CBool
(
"true"
)))
Call
ok
(
CBool
(
"false"
)
=
False
,
"CBool(
""
false
""
) = "
&
CBool
(
"false"
))
Call
ok
(
getVT
(
CBool
(
"false"
))
=
"VT_BOOL"
,
"getVT(CBool(
""
false
""
)) = "
&
getVT
(
CBool
(
"false"
)))
Call
ok
(
CBool
(
"TRUE"
)
=
True
,
"CBool(
""
TRUE
""
) = "
&
CBool
(
"TRUE"
))
Call
ok
(
getVT
(
CBool
(
"TRUE"
))
=
"VT_BOOL"
,
"getVT(CBool(
""
TRUE
""
)) = "
&
getVT
(
CBool
(
"TRUE"
)))
Call
ok
(
CBool
(
"FALSE"
)
=
False
,
"CBool(
""
FALSE
""
) = "
&
CBool
(
"FALSE"
))
Call
ok
(
getVT
(
CBool
(
"FALSE"
))
=
"VT_BOOL"
,
"getVT(CBool(
""
FALSE
""
)) = "
&
getVT
(
CBool
(
"FALSE"
)))
Call
ok
(
CBool
(
"#TRUE#"
)
=
True
,
"CBool(
""
#TRUE#
""
) = "
&
CBool
(
"#TRUE#"
))
Call
ok
(
getVT
(
CBool
(
"#TRUE#"
))
=
"VT_BOOL"
,
"getVT(CBool(
""
#TRUE#
""
)) = "
&
getVT
(
CBool
(
"#TRUE#"
)))
Call
ok
(
CBool
(
"#FALSE#"
)
=
False
,
"CBool(
""
#FALSE#
""
) = "
&
CBool
(
"#FALSE#"
))
Call
ok
(
getVT
(
CBool
(
"#FALSE#"
))
=
"VT_BOOL"
,
"getVT(CBool(
""
#FALSE#
""
)) = "
&
getVT
(
CBool
(
"#FALSE#"
)))
Call
ok
(
CBool
(
MyObject
)
=
False
,
"CBool(MyObject) = "
&
CBool
(
MyObject
))
Call
ok
(
getVT
(
CBool
(
MyObject
))
=
"VT_BOOL"
,
"getVT(CBool(MyObject)) = "
&
getVT
(
CBool
(
MyObject
)))
MyObject
.
myval
=
1
Call
ok
(
CBool
(
MyObject
)
=
True
,
"CBool(MyObject) = "
&
CBool
(
MyObject
))
Call
ok
(
getVT
(
CBool
(
MyObject
))
=
"VT_BOOL"
,
"getVT(CBool(MyObject)) = "
&
getVT
(
CBool
(
MyObject
)))
MyObject
.
myval
=
0
Call
ok
(
CBool
(
MyObject
)
=
False
,
"CBool(MyObject) = "
&
CBool
(
MyObject
))
Call
ok
(
getVT
(
CBool
(
MyObject
))
=
"VT_BOOL"
,
"getVT(CBool(MyObject)) = "
&
getVT
(
CBool
(
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