Hello Nikolay,
On 08/27/2013 12:16 PM, Nikolay Sivov wrote:
+static OLEMISC get_olemisc_value(const WCHAR *str, int len) +{
- int min, max;
- min = 0;
- max = sizeof(olemisc_values)/sizeof(struct olemisc_entry) - 1;
- while (min <= max)
- {
int n, c;
n = (min+max)/2;
c = strncmpW(olemisc_values[n].name, str, len);
why don't you just compare the length first? If the length matches you can do a simple strcmpW between the strings to verify the match. Something like the below code:
if (olemisc_values[n].len == len) { if (!strcmpW(olemisc_values[n].name, str) return olemisc_values[n].value; else ... } else if (olemisc_values[n].len > len) max = n-1; else min = n+1;
if (!c)
{
if (olemisc_values[n].len < len)
c = -1;
else if (olemisc_values[n].len > len)
c = 1;
}
if (!c)
return olemisc_values[n].value;
if (c > 0)
max = n-1;
else
min = n+1;
- }
- WARN("unknown flag %s\n", debugstr_wn(str, len));
- return 0;
+}
bye michael