Commit 470a3f93 authored by Andreas Mohr's avatar Andreas Mohr Committed by Alexandre Julliard

Make PROFILE_GetString account for default value in all cases.

parent 7f9cc2e4
...@@ -846,8 +846,11 @@ static INT PROFILE_GetString( LPCSTR section, LPCSTR key_name, ...@@ -846,8 +846,11 @@ static INT PROFILE_GetString( LPCSTR section, LPCSTR key_name,
if(!buffer) return 0; if(!buffer) return 0;
if (!def_val) def_val = ""; if (!def_val) def_val = "";
if (key_name && key_name[0]) if (key_name)
{ {
if (!key_name[0])
/* Win95 returns 0 on keyname "". Tested with Likse32 bon 000227 */
return 0;
key = PROFILE_Find( &CurProfile->section, section, key_name, FALSE, FALSE); key = PROFILE_Find( &CurProfile->section, section, key_name, FALSE, FALSE);
PROFILE_CopyEntry( buffer, (key && key->value) ? key->value : def_val, PROFILE_CopyEntry( buffer, (key && key->value) ? key->value : def_val,
len, FALSE ); len, FALSE );
...@@ -855,12 +858,15 @@ static INT PROFILE_GetString( LPCSTR section, LPCSTR key_name, ...@@ -855,12 +858,15 @@ static INT PROFILE_GetString( LPCSTR section, LPCSTR key_name,
section, key_name, def_val, buffer ); section, key_name, def_val, buffer );
return strlen( buffer ); return strlen( buffer );
} }
if (key_name && !(key_name[0])) /* no "else" here ! */
/* Win95 returns 0 on keyname "". Tested with Likse32 bon 000227 */
return 0;
if (section && section[0]) if (section && section[0])
return PROFILE_GetSection(CurProfile->section, section, buffer, len, {
PROFILE_GetSection(CurProfile->section, section, buffer, len,
FALSE, FALSE); FALSE, FALSE);
if (!buffer[0]) /* no luck -> def_val */
PROFILE_CopyEntry(buffer, def_val, len, FALSE);
return strlen(buffer);
}
buffer[0] = '\0'; buffer[0] = '\0';
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