profile fix
Andreas Mohr
andi at rhlx01.fht-esslingen.de
Fri May 10 16:27:13 CDT 2002
Hi all,
GetPrivateProfileString16 turned out to be broken in the "return entire
section" case.
In case of an unexisting section name, it didn't honor the default
value.
- make PROFILE_GetString account for default value in all cases
This fixes BugZilla #573.
Someone with a lot of free time should probably rewrite the whole
profile handling, I guess ;-)
(taking all myriads of special cases in Win16/Win32 into account, of course !)
--
Andreas Mohr Stauferstr. 6, D-71272 Renningen, Germany
-------------- next part --------------
Determining best CVS host...
Using CVSROOT :pserver:cvs at rhlx01.fht-esslingen.de:/home/wine
Index: files/profile.c
===================================================================
RCS file: /home/wine/wine/files/profile.c,v
retrieving revision 1.66
diff -u -r1.66 profile.c
--- files/profile.c 9 Mar 2002 23:50:37 -0000 1.66
+++ files/profile.c 10 May 2002 21:22:25 -0000
@@ -846,8 +846,11 @@
if(!buffer) return 0;
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);
PROFILE_CopyEntry( buffer, (key && key->value) ? key->value : def_val,
len, FALSE );
@@ -855,12 +858,15 @@
section, key_name, def_val, buffer );
return strlen( buffer );
}
- if (key_name && !(key_name[0]))
- /* Win95 returns 0 on keyname "". Tested with Likse32 bon 000227 */
- return 0;
+ /* no "else" here ! */
if (section && section[0])
- return PROFILE_GetSection(CurProfile->section, section, buffer, len,
+ {
+ PROFILE_GetSection(CurProfile->section, section, buffer, len,
FALSE, FALSE);
+ if (!buffer[0]) /* no luck -> def_val */
+ PROFILE_CopyEntry(buffer, def_val, len, FALSE);
+ return strlen(buffer);
+ }
buffer[0] = '\0';
return 0;
}
More information about the wine-patches
mailing list