Make the msistring_makehash return something other than just 1 or
0. Also handle the case where the string or stored string is null.
This commit is contained in:
parent
06e9945f70
commit
8d81d671eb
|
@ -56,11 +56,14 @@ static int msistring_makehash( const WCHAR *str )
|
||||||
{
|
{
|
||||||
int hash = 0;
|
int hash = 0;
|
||||||
|
|
||||||
|
if (str==NULL)
|
||||||
|
return hash;
|
||||||
|
|
||||||
while( *str )
|
while( *str )
|
||||||
{
|
{
|
||||||
hash ^= *str++;
|
hash ^= *str++;
|
||||||
hash *= 53;
|
hash *= 53;
|
||||||
hash = (hash<<5) || (hash>>27);
|
hash = (hash<<5) | (hash>>27);
|
||||||
}
|
}
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
@ -354,8 +357,9 @@ UINT msi_string2idW( string_table *st, LPCWSTR str, UINT *id )
|
||||||
hash = msistring_makehash( str );
|
hash = msistring_makehash( str );
|
||||||
for( i=0; i<st->maxcount; i++ )
|
for( i=0; i<st->maxcount; i++ )
|
||||||
{
|
{
|
||||||
if( ( st->strings[i].hash == hash ) &&
|
if ( (str == NULL && st->strings[i].str == NULL) ||
|
||||||
!strcmpW( st->strings[i].str, str ) )
|
( ( st->strings[i].hash == hash ) &&
|
||||||
|
!strcmpW( st->strings[i].str, str ) ))
|
||||||
{
|
{
|
||||||
r = ERROR_SUCCESS;
|
r = ERROR_SUCCESS;
|
||||||
*id = i;
|
*id = i;
|
||||||
|
|
Loading…
Reference in New Issue