From 14c89d4578837d90146079be2916bef926a50737 Mon Sep 17 00:00:00 2001 From: Liang Chang Date: Wed, 2 Mar 2022 09:07:33 +0000 Subject: [PATCH] DtSearch: processing multibyte characters based on locale settings to avoid confusion. --- cde/lib/DtSearch/lang.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cde/lib/DtSearch/lang.c b/cde/lib/DtSearch/lang.c index fcf319945..2f865866d 100644 --- a/cde/lib/DtSearch/lang.c +++ b/cde/lib/DtSearch/lang.c @@ -276,7 +276,7 @@ static int euro_mbtowc (wchar_t *pwc, const char *p, const char *s) if (p == s) goto done; - mbtowc (NULL, NULL, 0); len = mbtowc (pwc, p - 1, 2); + len = mbtowc (pwc, p - 1, MB_CUR_MAX); done: if (len < 0 || *pwc > 0xFF) *pwc = 0x100; @@ -302,18 +302,18 @@ static int euro_readchar (READCFP cofunction, void *cofunction_arg, char *outp, if (*pwc >= 0 && *pwc <= 0x7F) goto done; - *(outp + len) = cofunction (NULL); + *(outp + len++) = cofunction (NULL); - mbtowc (NULL, NULL, 0); if (mbtowc (pwc, outp, ++len) >= 0) goto done; + if (mbtowc (pwc, outp, MB_CUR_MAX) >= 0) goto done; *pwc = 0x100; for (;;) { if (len >= MB_CUR_MAX) break; - *(outp + len) = cofunction (NULL); + *(outp + len++) = cofunction (NULL); - mblen (NULL, 0); if (mblen (outp, ++len) >= 0) break; + if (mblen (outp, MB_CUR_MAX) >= 0) break; } done: