Fix regression in GetPrivateProfileSection for lines without an '='.

Add test.
oldstable
Huw Davies 2005-03-04 10:46:55 +00:00 committed by Alexandre Julliard
parent 486fd1f6f4
commit 00ced5e3af
2 changed files with 9 additions and 1 deletions

View File

@ -863,7 +863,7 @@ static INT PROFILE_GetSection( PROFILESECTION *section, LPCWSTR section_name,
if (len <= 2) break;
if (!*key->name) continue; /* Skip empty lines */
if (IS_ENTRY_COMMENT(key->name)) continue; /* Skip comments */
if (!key->value) continue; /* Skip lines w.o. '=' */
if (!return_values && !key->value) continue; /* Skip lines w.o. '=' */
PROFILE_CopyEntry( buffer, key->name, len - 1, 0 );
len -= strlenW(buffer) + 1;
buffer += strlenW(buffer) + 1;

View File

@ -114,6 +114,14 @@ void test_profile_string()
/* and test */
ok( !strcmp( buf, "name1,name2,name4"), "wrong keys returned: %s\n",
buf);
ret=GetPrivateProfileSectionA("s", buf, sizeof(buf), TESTFILE2);
for( p = buf + strlen(buf) + 1; *p;p += strlen(p)+1)
p[-1] = ',';
/* and test */
ok( !strcmp( buf, "name1=val1,name2=,name3,name4=val4"), "wrong section returned: %s\n",
buf);
/* add a new key to test that the file is quite usable */
WritePrivateProfileStringA( "s", "name5", "val5", TESTFILE2);
ret=GetPrivateProfileStringA( "s", NULL, "", buf, sizeof(buf),