Commit fadc820f authored by Alexandre Julliard's avatar Alexandre Julliard

Revert "msi: Comparisons with null in conditions are special."

This reverts commit 9dce96b3.
parent 598f2be5
...@@ -445,91 +445,46 @@ static INT compare_substring( LPCWSTR a, INT operator, LPCWSTR b ) ...@@ -445,91 +445,46 @@ static INT compare_substring( LPCWSTR a, INT operator, LPCWSTR b )
return 0; return 0;
} }
static BOOL is_empty( LPCWSTR p )
{
return !p || !p[0];
}
static BOOL is_alphaless( LPCWSTR p )
{
while (*p)
{
if (isalphaW( *p ) || (*p == '_'))
return FALSE;
p++;
}
return TRUE;
}
static INT compare_string( LPCWSTR a, INT operator, LPCWSTR b ) static INT compare_string( LPCWSTR a, INT operator, LPCWSTR b )
{ {
int r;
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 );
if (is_empty( a ) && is_empty( b ))
r = 0;
else if (is_empty( a ) && is_alphaless( b ))
r = 1;
else if (is_empty( b ) && is_alphaless( a ))
r = -1;
else
{
/* null and empty string are equivalent */ /* null and empty string are equivalent */
if (!a) a = szEmpty; if (!a) a = szEmpty;
if (!b) b = szEmpty; if (!b) b = szEmpty;
/* a or b may be NULL */
switch (operator) switch (operator)
{ {
case COND_LT: case COND_LT:
return -1 == lstrcmpW( a, b );
case COND_GT: case COND_GT:
return 1 == lstrcmpW( a, b );
case COND_EQ: case COND_EQ:
return 0 == lstrcmpW( a, b );
case COND_NE: case COND_NE:
return 0 != lstrcmpW( a, b );
case COND_GE: case COND_GE:
return -1 != lstrcmpW( a, b );
case COND_LE: case COND_LE:
r = lstrcmpW( a, b ); return 1 != lstrcmpW( a, b );
break;
case COND_ILT: case COND_ILT:
return -1 == lstrcmpiW( a, b );
case COND_IGT: case COND_IGT:
return 1 == lstrcmpiW( a, b );
case COND_IEQ: case COND_IEQ:
return 0 == lstrcmpiW( a, b );
case COND_INE: case COND_INE:
return 0 != lstrcmpiW( a, b );
case COND_IGE: case COND_IGE:
return -1 != lstrcmpiW( a, b );
case COND_ILE: case COND_ILE:
r = lstrcmpiW( a, b ); return 1 != lstrcmpiW( a, b );
break;
default: default:
ERR("invalid string operator\n"); ERR("invalid string operator\n");
return 0; return 0;
} }
}
switch (operator)
{
case COND_LT:
case COND_ILT:
return -1 == r;
case COND_GT:
case COND_IGT:
return 1 == r;
case COND_EQ:
case COND_IEQ:
return 0 == r;
case COND_NE:
case COND_INE:
return 0 != r;
case COND_GE:
case COND_IGE:
return -1 != r;
case COND_LE:
case COND_ILE:
return 1 != r;
default:
ERR("invalid string operator\n");
}
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment