[PATCH 4/8] msi: Fix merging string type checks.

Hib Eris hib at hiberis.nl
Tue Oct 20 08:28:06 CDT 2009


On Tue, Oct 20, 2009 at 3:06 PM, Alexandre Julliard <julliard at winehq.org> wrote:
> Hib Eris <hib at hiberis.nl> writes:
>
>> +static BOOL merge_type_match(LPCWSTR type1, LPCWSTR type2)
>> +{
>> +    const WCHAR szl[] = {'l', 0};
>> +    const WCHAR szs[] = {'s', 0};
>> +    const WCHAR szL[] = {'L', 0};
>> +    const WCHAR szS[] = {'S', 0};
>> +
>> +    if ((!StrCmpNW(type1, szl, 1) || !StrCmpNW(type1, szs, 1)) &&
>> +        (!StrCmpNW(type2, szl, 1) || !StrCmpNW(type2, szs, 1)))
>> +        return TRUE;
>> +
>> +    if ((!StrCmpNW(type1, szL, 1) || !StrCmpNW(type1, szS, 1)) &&
>> +        (!StrCmpNW(type2, szL, 1) || !StrCmpNW(type2, szS, 1)))
>> +        return TRUE;
>> +
>> +    return !StrCmpNW(type1, type2, 1);
>> +}
>
> Surely you don't need StrCmpNW to compare one character...

I guess not. This may sound as a stupid question to you, but how should I do it?
Can I just do

if (type[0] == 's')  ?

I am a bit worried that this comparison on WCHAR is not guaranteed to work?

Hib Eris



More information about the wine-devel mailing list