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
fc0cc66b
Commit
fc0cc66b
authored
Nov 14, 2005
by
Mike McCormack
Committed by
Alexandre Julliard
Nov 14, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix comparison of empty properties to numbers and add test cases.
parent
0940654d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
2 deletions
+82
-2
cond.y
dlls/msi/cond.y
+28
-2
package.c
dlls/msi/tests/package.c
+54
-0
No files found.
dlls/msi/cond.y
View file @
fc0cc66b
...
...
@@ -75,6 +75,30 @@ static INT compare_and_free_strings( LPWSTR a, INT op, LPWSTR b )
return
r
;
}
static
BOOL
num_from_prop
(
LPCWSTR
p
,
INT
*
val
)
{
INT
ret
=
0
,
sign
=
1
;
if
(
!p)
return
FALSE
;
if
(*
p
==
'-'
)
{
sign
=
-
1
;
p
++;
}
if
(
!*p)
return
FALSE
;
while
(*
p
)
{
if
(
*
p
<
'0'
||
*
p
>
'9'
)
return
FALSE
;
ret
=
ret
*
10
+
(*
p
-
'0'
);
p
++;
}
*
val
=
ret
*
sign
;
return
TRUE
;
}
%}
%
pure
-
parser
...
...
@@ -169,11 +193,13 @@ boolean_factor:
}
|
symbol_s
operator
value_i
{
$$
=
compare_int
(
$
1
?
atoiW
($
1
)
:
0
,
$
2
,
$
3
);
int
num
;
$$
=
num_from_prop
(
$
1
,
&
num
)
&&
compare_int
(
num
,
$
2
,
$
3
);
}
|
value_i
operator
symbol_s
{
$$
=
compare_int
(
$
1
,
$
2
,
$
3
?
atoiW
($
3
)
:
0
);
int
num
;
$$
=
num_from_prop
(
$
3
,
&
num
)
&&
compare_int
(
$
1
,
$
2
,
num
);
}
|
symbol_s
operator
symbol_s
{
...
...
dlls/msi/tests/package.c
View file @
fc0cc66b
...
...
@@ -593,6 +593,60 @@ void test_condition(void)
r
=
MsiEvaluateCondition
(
hpkg
,
"Installed<>
\"\"
"
);
ok
(
r
==
MSICONDITION_FALSE
,
"wrong return val
\n
"
);
r
=
MsiEvaluateCondition
(
hpkg
,
"NOT 1 AND 0"
);
ok
(
r
==
MSICONDITION_FALSE
,
"wrong return val
\n
"
);
r
=
MsiEvaluateCondition
(
hpkg
,
"bandalmael=0"
);
ok
(
r
==
MSICONDITION_FALSE
,
"wrong return val
\n
"
);
MsiSetProperty
(
hpkg
,
"bandalmael"
,
"0"
);
r
=
MsiEvaluateCondition
(
hpkg
,
"bandalmael=0"
);
ok
(
r
==
MSICONDITION_TRUE
,
"wrong return val
\n
"
);
MsiSetProperty
(
hpkg
,
"bandalmael"
,
""
);
r
=
MsiEvaluateCondition
(
hpkg
,
"bandalmael=0"
);
ok
(
r
==
MSICONDITION_FALSE
,
"wrong return val
\n
"
);
MsiSetProperty
(
hpkg
,
"bandalmael"
,
"asdf"
);
r
=
MsiEvaluateCondition
(
hpkg
,
"bandalmael=0"
);
ok
(
r
==
MSICONDITION_FALSE
,
"wrong return val
\n
"
);
MsiSetProperty
(
hpkg
,
"bandalmael"
,
"0asdf"
);
r
=
MsiEvaluateCondition
(
hpkg
,
"bandalmael=0"
);
ok
(
r
==
MSICONDITION_FALSE
,
"wrong return val
\n
"
);
MsiSetProperty
(
hpkg
,
"bandalmael"
,
"0 "
);
r
=
MsiEvaluateCondition
(
hpkg
,
"bandalmael=0"
);
ok
(
r
==
MSICONDITION_FALSE
,
"wrong return val
\n
"
);
MsiSetProperty
(
hpkg
,
"bandalmael"
,
"-0"
);
r
=
MsiEvaluateCondition
(
hpkg
,
"bandalmael=0"
);
ok
(
r
==
MSICONDITION_TRUE
,
"wrong return val
\n
"
);
MsiSetProperty
(
hpkg
,
"bandalmael"
,
"0000000000000"
);
r
=
MsiEvaluateCondition
(
hpkg
,
"bandalmael=0"
);
ok
(
r
==
MSICONDITION_TRUE
,
"wrong return val
\n
"
);
MsiSetProperty
(
hpkg
,
"bandalmael"
,
"--0"
);
r
=
MsiEvaluateCondition
(
hpkg
,
"bandalmael=0"
);
ok
(
r
==
MSICONDITION_FALSE
,
"wrong return val
\n
"
);
MsiSetProperty
(
hpkg
,
"bandalmael"
,
"0x00"
);
r
=
MsiEvaluateCondition
(
hpkg
,
"bandalmael=0"
);
ok
(
r
==
MSICONDITION_FALSE
,
"wrong return val
\n
"
);
MsiSetProperty
(
hpkg
,
"bandalmael"
,
"-"
);
r
=
MsiEvaluateCondition
(
hpkg
,
"bandalmael=0"
);
ok
(
r
==
MSICONDITION_FALSE
,
"wrong return val
\n
"
);
MsiSetProperty
(
hpkg
,
"bandalmael"
,
"+0"
);
r
=
MsiEvaluateCondition
(
hpkg
,
"bandalmael=0"
);
ok
(
r
==
MSICONDITION_FALSE
,
"wrong return val
\n
"
);
MsiSetProperty
(
hpkg
,
"bandalmael"
,
"0.0"
);
r
=
MsiEvaluateCondition
(
hpkg
,
"bandalmael=0"
);
ok
(
r
==
MSICONDITION_FALSE
,
"wrong return val
\n
"
);
MsiCloseHandle
(
hpkg
);
}
...
...
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