Hib Eris hib@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...
On Tue, Oct 20, 2009 at 3:06 PM, Alexandre Julliard julliard@winehq.org wrote:
Hib Eris hib@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
Hib Eris wrote:
On Tue, Oct 20, 2009 at 3:06 PM, Alexandre Julliard julliard@winehq.org wrote:
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
WCHAR is just unsigned short, so the char will promote to short, padding with 0s on the high byte. The comparison will work fine.