NTDLL/loader.c: Remove spaces at end of name in import_dll

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Sat Feb 18 13:29:04 CST 2006


>>>>> "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.

Bye
-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------



More information about the wine-devel mailing list