[PATCH 2/2] libwine: Decompose characters before comparing in wine_compare_string.
Alexandre Julliard
julliard at winehq.org
Mon May 20 15:14:56 CDT 2019
Piotr Caban <piotr at codeweavers.com> writes:
> @@ -206,30 +209,107 @@ static inline int compare_unicode_weights(int flags, const WCHAR *str1, int len1
> }
> }
>
> - ce1 = collation_table[collation_table[*str1 >> 8] + (*str1 & 0xff)];
> - ce2 = collation_table[collation_table[*str2 >> 8] + (*str2 & 0xff)];
> + if (!dlen1)
> + {
> + dlen1 = wine_decompose(0, *str1, dstr1, 4);
> + dpos1 = 0;
> + }
> + ce1 = collation_table[collation_table[dstr1[dpos1] >> 8] + (dstr1[dpos1] & 0xff)];
> + if (!(ce1 >> 16))
> + {
> + dpos1++;
> + if (dpos1 == dlen1)
> + {
> + str1++;
> + len1--;
> + dlen1 = 0;
> + }
> + continue;
> + }
> +
> + if (!dlen2)
> + {
> + dlen2 = wine_decompose(0, *str2, dstr2, 4);
> + dpos2 = 0;
> + }
> + ce2 = collation_table[collation_table[dstr2[dpos2] >> 8] + (dstr2[dpos2] & 0xff)];
> + if (!(ce2 >> 16))
> + {
> + dpos2++;
> + if (dpos2 == dlen2)
> + {
> + str2++;
> + len2--;
> + dlen2 = 0;
> + }
> + continue;
> + }
It looks like this could benefit from using some kind of helper
function.
--
Alexandre Julliard
julliard at winehq.org
More information about the wine-devel
mailing list