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
7ae4f695
Commit
7ae4f695
authored
May 12, 2008
by
James Hawkins
Committed by
Alexandre Julliard
May 13, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Convert string variables to ints when appropriate.
parent
ca8e867d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
8 deletions
+54
-8
cond.y
dlls/msi/cond.y
+14
-8
package.c
dlls/msi/tests/package.c
+40
-0
No files found.
dlls/msi/cond.y
View file @
7ae4f695
...
@@ -67,13 +67,13 @@ static int cond_lex( void *COND_lval, COND_input *info);
...
@@ -67,13 +67,13 @@ static int cond_lex( void *COND_lval, COND_input *info);
static
const
WCHAR
szEmpty
[]
=
{
0
};
static
const
WCHAR
szEmpty
[]
=
{
0
};
static
INT
compare_int
(
INT
a
,
INT
operator
,
INT
b
);
static
INT
compare_int
(
INT
a
,
INT
operator
,
INT
b
);
static
INT
compare_string
(
LPCWSTR
a
,
INT
operator
,
LPCWSTR
b
);
static
INT
compare_string
(
LPCWSTR
a
,
INT
operator
,
LPCWSTR
b
,
BOOL
convert
);
static
INT
compare_and_free_strings
(
LPWSTR
a
,
INT
op
,
LPWSTR
b
)
static
INT
compare_and_free_strings
(
LPWSTR
a
,
INT
op
,
LPWSTR
b
,
BOOL
convert
)
{
{
INT
r
;
INT
r
;
r
=
compare_string
(
a
,
op
,
b
);
r
=
compare_string
(
a
,
op
,
b
,
convert
);
msi_free
(
a
);
msi_free
(
a
);
msi_free
(
b
);
msi_free
(
b
);
return
r
;
return
r
;
...
@@ -216,19 +216,19 @@ boolean_factor:
...
@@ -216,19 +216,19 @@ boolean_factor:
}
}
|
symbol_s
operator
symbol_s
|
symbol_s
operator
symbol_s
{
{
$$
=
compare_and_free_strings
(
$
1
,
$
2
,
$
3
);
$$
=
compare_and_free_strings
(
$
1
,
$
2
,
$
3
,
TRUE
);
}
}
|
symbol_s
operator
literal
|
symbol_s
operator
literal
{
{
$$
=
compare_and_free_strings
(
$
1
,
$
2
,
$
3
);
$$
=
compare_and_free_strings
(
$
1
,
$
2
,
$
3
,
TRUE
);
}
}
|
literal
operator
symbol_s
|
literal
operator
symbol_s
{
{
$$
=
compare_and_free_strings
(
$
1
,
$
2
,
$
3
);
$$
=
compare_and_free_strings
(
$
1
,
$
2
,
$
3
,
TRUE
);
}
}
|
literal
operator
literal
|
literal
operator
literal
{
{
$$
=
compare_and_free_strings
(
$
1
,
$
2
,
$
3
);
$$
=
compare_and_free_strings
(
$
1
,
$
2
,
$
3
,
FALSE
);
}
}
|
literal
operator
value_i
|
literal
operator
value_i
{
{
...
@@ -408,6 +408,9 @@ static BOOL str_is_number( LPCWSTR str )
...
@@ -408,6 +408,9 @@ static BOOL str_is_number( LPCWSTR str )
{
{
int
i
;
int
i
;
if
(
!*str)
return
FALSE
;
for
(
i
=
0
;
i
<
lstrlenW
(
str
);
i
++)
for
(
i
=
0
;
i
<
lstrlenW
(
str
);
i
++)
if
(
!isdigitW(str[i]))
if
(
!isdigitW(str[i]))
return
FALSE
;
return
FALSE
;
...
@@ -454,7 +457,7 @@ static INT compare_substring( LPCWSTR a, INT operator, LPCWSTR b )
...
@@ -454,7 +457,7 @@ static INT compare_substring( LPCWSTR a, INT operator, LPCWSTR b )
return
0
;
return
0
;
}
}
static
INT
compare_string
(
LPCWSTR
a
,
INT
operator
,
LPCWSTR
b
)
static
INT
compare_string
(
LPCWSTR
a
,
INT
operator
,
LPCWSTR
b
,
BOOL
convert
)
{
{
if
(
operator
>=
COND_SS
&&
operator
<=
COND_RHS
)
if
(
operator
>=
COND_SS
&&
operator
<=
COND_RHS
)
return
compare_substring
(
a
,
operator
,
b
);
return
compare_substring
(
a
,
operator
,
b
);
...
@@ -463,6 +466,9 @@ static INT compare_string( LPCWSTR a, INT operator, LPCWSTR b )
...
@@ -463,6 +466,9 @@ static INT compare_string( LPCWSTR a, INT operator, LPCWSTR b )
if
(
!a) a = szEmpty;
if
(
!a) a = szEmpty;
if
(
!b) b = szEmpty;
if
(
!b) b = szEmpty;
if
(
convert
&&
str_is_number
(
a
)
&&
str_is_number
(
b
))
return
compare_int
(
atoiW
(
a
),
operator
,
atoiW
(
b
)
);
/*
a
or
b
may
be
NULL
*/
/*
a
or
b
may
be
NULL
*/
switch
(
operator
)
switch
(
operator
)
{
{
...
...
dlls/msi/tests/package.c
View file @
7ae4f695
...
@@ -1631,6 +1631,46 @@ static void test_condition(void)
...
@@ -1631,6 +1631,46 @@ static void test_condition(void)
r
=
MsiEvaluateCondition
(
hpkg
,
"&nofeature"
);
r
=
MsiEvaluateCondition
(
hpkg
,
"&nofeature"
);
ok
(
r
==
MSICONDITION_FALSE
,
"wrong return val (%d)
\n
"
,
r
);
ok
(
r
==
MSICONDITION_FALSE
,
"wrong return val (%d)
\n
"
,
r
);
MsiSetProperty
(
hpkg
,
"A"
,
"2"
);
MsiSetProperty
(
hpkg
,
"X"
,
"50"
);
r
=
MsiEvaluateCondition
(
hpkg
,
"2 <= X"
);
ok
(
r
==
MSICONDITION_TRUE
,
"wrong return val (%d)
\n
"
,
r
);
r
=
MsiEvaluateCondition
(
hpkg
,
"A <= X"
);
ok
(
r
==
MSICONDITION_TRUE
,
"wrong return val (%d)
\n
"
,
r
);
r
=
MsiEvaluateCondition
(
hpkg
,
"A <= 50"
);
ok
(
r
==
MSICONDITION_TRUE
,
"wrong return val (%d)
\n
"
,
r
);
MsiSetProperty
(
hpkg
,
"X"
,
"50val"
);
r
=
MsiEvaluateCondition
(
hpkg
,
"2 <= X"
);
ok
(
r
==
MSICONDITION_FALSE
,
"wrong return val (%d)
\n
"
,
r
);
r
=
MsiEvaluateCondition
(
hpkg
,
"A <= X"
);
ok
(
r
==
MSICONDITION_TRUE
,
"wrong return val (%d)
\n
"
,
r
);
MsiSetProperty
(
hpkg
,
"A"
,
"7"
);
MsiSetProperty
(
hpkg
,
"X"
,
"50"
);
r
=
MsiEvaluateCondition
(
hpkg
,
"7 <= X"
);
ok
(
r
==
MSICONDITION_TRUE
,
"wrong return val (%d)
\n
"
,
r
);
r
=
MsiEvaluateCondition
(
hpkg
,
"A <= X"
);
ok
(
r
==
MSICONDITION_TRUE
,
"wrong return val (%d)
\n
"
,
r
);
r
=
MsiEvaluateCondition
(
hpkg
,
"A <= 50"
);
ok
(
r
==
MSICONDITION_TRUE
,
"wrong return val (%d)
\n
"
,
r
);
MsiSetProperty
(
hpkg
,
"X"
,
"50val"
);
r
=
MsiEvaluateCondition
(
hpkg
,
"2 <= X"
);
ok
(
r
==
MSICONDITION_FALSE
,
"wrong return val (%d)
\n
"
,
r
);
r
=
MsiEvaluateCondition
(
hpkg
,
"A <= X"
);
ok
(
r
==
MSICONDITION_FALSE
,
"wrong return val (%d)
\n
"
,
r
);
MsiCloseHandle
(
hpkg
);
MsiCloseHandle
(
hpkg
);
DeleteFile
(
msifile
);
DeleteFile
(
msifile
);
}
}
...
...
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