ntdll: Store all 'comClass' attributes (try2)

Alexandre Julliard julliard at winehq.org
Tue Aug 27 04:01:04 CDT 2013


Nikolay Sivov <nsivov at 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...)

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list