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
0a7f5646
Commit
0a7f5646
authored
Jun 21, 2023
by
Nikolay Sivov
Committed by
Alexandre Julliard
Dec 01, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vbscript: Coerce to VT_BOOL when evaluating jump conditions.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
parent
295d521b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
26 deletions
+76
-26
interp.c
dlls/vbscript/interp.c
+13
-26
lang.vbs
dlls/vbscript/tests/lang.vbs
+63
-0
No files found.
dlls/vbscript/interp.c
View file @
0a7f5646
...
...
@@ -413,43 +413,30 @@ static HRESULT stack_assume_val(exec_ctx_t *ctx, unsigned n)
return
S_OK
;
}
static
int
stack_pop_bool
(
exec_ctx_t
*
ctx
,
BOOL
*
b
)
static
HRESULT
stack_pop_bool
(
exec_ctx_t
*
ctx
,
BOOL
*
b
)
{
variant_val_t
val
;
HRESULT
hres
;
VARIANT
_BOOL
vb
;
VARIANT
v
;
hres
=
stack_pop_val
(
ctx
,
&
val
);
if
(
FAILED
(
hres
))
return
hres
;
switch
(
V_VT
(
val
.
v
)
)
if
(
V_VT
(
val
.
v
)
==
VT_NULL
)
{
case
VT_BOOL
:
*
b
=
V_BOOL
(
val
.
v
);
break
;
case
VT_NULL
:
case
VT_EMPTY
:
*
b
=
FALSE
;
break
;
case
VT_I2
:
*
b
=
V_I2
(
val
.
v
);
break
;
case
VT_I4
:
*
b
=
V_I4
(
val
.
v
);
break
;
case
VT_BSTR
:
hres
=
VarBoolFromStr
(
V_BSTR
(
val
.
v
),
ctx
->
script
->
lcid
,
0
,
&
vb
);
if
(
FAILED
(
hres
))
return
hres
;
*
b
=
vb
;
break
;
default:
FIXME
(
"unsupported for %s
\n
"
,
debugstr_variant
(
val
.
v
));
release_val
(
&
val
);
return
E_NOTIMPL
;
}
return
S_OK
;
else
{
V_VT
(
&
v
)
=
VT_EMPTY
;
if
(
SUCCEEDED
(
hres
=
VariantChangeType
(
&
v
,
val
.
v
,
VARIANT_LOCALBOOL
,
VT_BOOL
)))
*
b
=
!!
V_BOOL
(
&
v
);
}
release_val
(
&
val
);
return
hres
;
}
static
HRESULT
stack_pop_disp
(
exec_ctx_t
*
ctx
,
IDispatch
**
ret
)
...
...
dlls/vbscript/tests/lang.vbs
View file @
0a7f5646
...
...
@@ -421,6 +421,69 @@ end if
Call
ok
(
x
=
1
,
"if
""
-1
""
not executed"
)
x
=
0
if
0.1
then
x
=
1
else
ok
false
,
"if
""
0.1
""
else executed"
end
if
Call
ok
(
x
=
1
,
"if
""
0.1
""
not executed"
)
x
=
0
if
"TRUE"
then
x
=
1
else
ok
false
,
"if
""
TRUE
""
else executed"
end
if
Call
ok
(
x
=
1
,
"if
""
TRUE
""
not executed"
)
x
=
0
if
"#TRUE#"
then
x
=
1
else
ok
false
,
"if
""
#TRUE#
""
else executed"
end
if
Call
ok
(
x
=
1
,
"if
""
#TRUE#
""
not executed"
)
x
=
0
if
(
not
"#FALSE#"
)
then
x
=
1
else
ok
false
,
"if
""
not #FALSE#
""
else executed"
end
if
Call
ok
(
x
=
1
,
"if
""
not #FALSE#
""
not executed"
)
Class
ValClass
Public
myval
Public
default
Property
Get
defprop
defprop
=
myval
End
Property
End
Class
Dim
MyObject
Set
MyObject
=
New
ValClass
MyObject
.
myval
=
1
Call
ok
(
CBool
(
MyObject
)
=
True
,
"CBool(MyObject) = "
&
CBool
(
MyObject
))
x
=
0
if
MyObject
then
x
=
1
else
ok
false
,
"if
""
MyObject(1)
""
else executed"
end
if
Call
ok
(
x
=
1
,
"if
""
MyObject(1)
""
not executed"
)
MyObject
.
myval
=
0
Call
ok
(
CBool
(
MyObject
)
=
False
,
"CBool(MyObject) = "
&
CBool
(
MyObject
))
x
=
0
if
not
MyObject
then
x
=
1
else
ok
false
,
"if
""
MyObject(0)
""
else executed"
end
if
Call
ok
(
x
=
1
,
"if
""
MyObject(0)
""
not executed"
)
x
=
0
WHILE
x
<
3
:
x
=
x
+
1
:
Wend
Call
ok
(
x
=
3
,
"x not equal to 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