[PATCH 5/6] kernel32: Fix an off-by-one error.

James Hawkins truiken at gmail.com
Tue Mar 24 16:20:14 CDT 2009


On Tue, Mar 24, 2009 at 3:42 AM, Alexandre Julliard <julliard at winehq.org> wrote:
> James Hawkins <truiken at gmail.com> writes:
>
>> ---
>>  dlls/kernel32/profile.c       |    2 +-
>>  dlls/kernel32/tests/profile.c |   30 ++++++------------------------
>>  2 files changed, 7 insertions(+), 25 deletions(-)
>>
>> diff --git a/dlls/kernel32/profile.c b/dlls/kernel32/profile.c
>> index 5d563a5..b6ad6d0 100644
>> --- a/dlls/kernel32/profile.c
>> +++ b/dlls/kernel32/profile.c
>> @@ -396,7 +396,7 @@ static PROFILESECTION *PROFILE_Load(HANDLE hFile, ENCODING * pEncoding)
>>      first_section->name[0] = 0;
>>      first_section->key  = NULL;
>>      first_section->next = NULL;
>> -    next_section = &first_section->next;
>> +    next_section = &first_section;
>
> This cannot be right. What happens to the original first_section then?
>

I don't really understand your question.  By original first_section,
do you mean the first_section that we loaded from an existing file or
that is in the cache?  If so, then the answer is that the cache is
cleared when the file is re-read.  That doesn't really seem like what
you're asking though.  next_section is just a poorly worded name for a
list iterator which starts at the first section and loads all of the
sections into the file.  Without this fix, the first section is loaded
as a blank section and the real first section starts second in the
linked list.  After all of the loading is done, the first_section is
returned to the caller.

-- 
James Hawkins



More information about the wine-devel mailing list