From 8d81d671ebd0972e9692c78c0c4567e4cb27b0af Mon Sep 17 00:00:00 2001 From: Aric Stewart Date: Thu, 29 Jul 2004 23:59:15 +0000 Subject: [PATCH] Make the msistring_makehash return something other than just 1 or 0. Also handle the case where the string or stored string is null. --- dlls/msi/string.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/dlls/msi/string.c b/dlls/msi/string.c index fa69ebc57a1..59affef468f 100644 --- a/dlls/msi/string.c +++ b/dlls/msi/string.c @@ -56,11 +56,14 @@ static int msistring_makehash( const WCHAR *str ) { int hash = 0; + if (str==NULL) + return hash; + while( *str ) { hash ^= *str++; hash *= 53; - hash = (hash<<5) || (hash>>27); + hash = (hash<<5) | (hash>>27); } return hash; } @@ -354,8 +357,9 @@ UINT msi_string2idW( string_table *st, LPCWSTR str, UINT *id ) hash = msistring_makehash( str ); for( i=0; imaxcount; i++ ) { - if( ( st->strings[i].hash == hash ) && - !strcmpW( st->strings[i].str, str ) ) + if ( (str == NULL && st->strings[i].str == NULL) || + ( ( st->strings[i].hash == hash ) && + !strcmpW( st->strings[i].str, str ) )) { r = ERROR_SUCCESS; *id = i; -- 2.11.4.GIT