Nikolay Sivov nsivov@codeweavers.com writes:
+static OLEMISC get_olemisc_value(const WCHAR *str, int len) +{
- int min, max;
- min = 0;
- max = ARRAY_SIZE(olemisc_values) - 1;
- while (min <= max)
- {
int n, c;
n = (min+max)/2;
c = memcmp(olemisc_values[n].name, str, min(len, olemisc_values[n].len)*sizeof(WCHAR));
if (!c)
{
if (olemisc_values[n].len < len)
c = -1;
else if (olemisc_values[n].len > len)
c = 1;
}
Actually, memcmp is not a good choice for comparing Unicode strings. It doesn't make a difference for ASCII-only strings, but it would still be cleaner to do it right. strncmpW is preferable (as long as you use it correctly...)