wine/dlls/msi tests/package.c cond.y
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Nov 2 13:58:01 CST 2005
ChangeSet ID: 21053
CVSROOT: /opt/cvs-commit
Module name: wine
Changes by: julliard at winehq.org 2005/11/02 13:58:01
Modified files:
dlls/msi/tests : package.c
dlls/msi : cond.y
Log message:
Mike McCormack <mike at codeweavers.com>
NULL and empty strings are the same in conditions.
Patch: http://cvs.winehq.org/patch.py?id=21053
Old revision New revision Changes Path
1.8 1.9 +6 -0 wine/dlls/msi/tests/package.c
1.23 1.24 +6 -2 wine/dlls/msi/cond.y
Index: wine/dlls/msi/tests/package.c
diff -u -p wine/dlls/msi/tests/package.c:1.8 wine/dlls/msi/tests/package.c:1.9
--- wine/dlls/msi/tests/package.c:1.8 2 Nov 2005 19:58: 1 -0000
+++ wine/dlls/msi/tests/package.c 2 Nov 2005 19:58: 1 -0000
@@ -587,6 +587,12 @@ void test_condition(void)
r = MsiEvaluateCondition(hpkg, "NOT ( 1 AND 1 )");
ok( r == MSICONDITION_FALSE, "wrong return val\n");
+ r = MsiEvaluateCondition(hpkg, "NOT A AND (BBBBBBBBBB=2 OR CCC=1) AND Ddddddddd");
+ ok( r == MSICONDITION_FALSE, "wrong return val\n");
+
+ r = MsiEvaluateCondition(hpkg, "Installed<>\"\"");
+ ok( r == MSICONDITION_FALSE, "wrong return val\n");
+
MsiCloseHandle( hpkg );
}
Index: wine/dlls/msi/cond.y
diff -u -p wine/dlls/msi/cond.y:1.23 wine/dlls/msi/cond.y:1.24
--- wine/dlls/msi/cond.y:1.23 2 Nov 2005 19:58: 1 -0000
+++ wine/dlls/msi/cond.y 2 Nov 2005 19:58: 1 -0000
@@ -361,6 +361,10 @@ static WCHAR *strstriW( const WCHAR *str
static INT compare_string( LPCWSTR a, INT operator, LPCWSTR b )
{
+ /* null and empty string are equivalent */
+ if (!a) a = szEmpty;
+ if (!b) b = szEmpty;
+
/* a or b may be NULL */
switch (operator)
{
@@ -377,7 +381,7 @@ static INT compare_string( LPCWSTR a, IN
case COND_LE:
return 1 != lstrcmpW( a, b );
case COND_SS: /* substring */
- return ( a && b && strstrW( a, b ) ) ? 1 : 0;
+ return strstrW( a, b ) ? 1 : 0;
case COND_ILT:
return -1 == lstrcmpiW( a, b );
case COND_IGT:
@@ -391,7 +395,7 @@ static INT compare_string( LPCWSTR a, IN
case COND_ILE:
return 1 != lstrcmpiW( a, b );
case COND_ISS:
- return ( a && b && strstriW( a, b ) ) ? 1 : 0;
+ return strstriW( a, b ) ? 1 : 0;
case COND_LHS:
case COND_RHS:
case COND_ILHS:
More information about the wine-cvs
mailing list