NTDLL/loader.c: Remove spaces at end of name in import_dll
Vitaliy Margolen
wine-devel at kievinfo.com
Sat Feb 18 14:14:22 CST 2006
Saturday, February 18, 2006, 12:29:04 PM, Uwe Bonnes wrote:
>>>>>> "Vitaliy" == Vitaliy Margolen <wine-devel at kievinfo.com> writes:
> Vitaliy> Saturday, February 18, 2006, 11:16:10 AM, Uwe Bonnes wrote:
> >> Changelog: ntdll/loader.c import_dll() Remove spaces at end of name
> >> retrieved with get_rva( module,
> descr-> Name )
> >> +/* Overwrite spaces at end of buffer with NULL */ +inline static
> >> void skip_spaces(WCHAR *buffer, size_t len) +{ + while (buffer[len
> >> -2] == (WCHAR)' ') + { + buffer[len -2] = 0; + len --; + } +}
> Vitaliy> This is wrong (number of errors). It should look something like
> Vitaliy> this:
> Vitaliy> while (len > sizeof(WCHAR)&& buffer[len/sizeof(WCHAR) - 1]
> Vitaliy> == ' ') { len -= sizeof(WCHAR); buffer[len/sizeof(WCHAR)] = 0;
> Vitaliy> }
> Vitaly,
> I disagree with your objection.
> "len" is the number of chars in name and is also number of WCHARs in buffer.
> So accessing buffer[len/sizeof(WCHAR)] will go astray.
Ah right, missed that part, sorry. But you still have to check for
(len > 1) in while loop.
More information about the wine-devel
mailing list