public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin/main] Cygwin: is_unicode_equiv: fix normalization
@ 2023-02-18 22:14 Corinna Vinschen
0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2023-02-18 22:14 UTC (permalink / raw)
To: cygwin-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=f0417a620182083fa787eea90e2e1d9884c8e573
commit f0417a620182083fa787eea90e2e1d9884c8e573
Author: Corinna Vinschen <corinna@vinschen.de>
AuthorDate: Sat Feb 18 23:14:11 2023 +0100
Commit: Corinna Vinschen <corinna@vinschen.de>
CommitDate: Sat Feb 18 23:14:11 2023 +0100
Cygwin: is_unicode_equiv: fix normalization
Change normalization to form KD and make room for longer
decomposed sequences.
Diff:
---
winsup/cygwin/nlsfuncs.cc | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/winsup/cygwin/nlsfuncs.cc b/winsup/cygwin/nlsfuncs.cc
index aa7e8434d7cf..d80567737d7b 100644
--- a/winsup/cygwin/nlsfuncs.cc
+++ b/winsup/cygwin/nlsfuncs.cc
@@ -1200,14 +1200,14 @@ __collate_range_cmp (int c1, int c2)
Note that we only recognize input in Unicode normalization form C, that
is, we expect all letters to be composed. A single character is all we
look at.
- To check equivalence, decompose pattern letter and input letter and check
- the base character for equality. Also, convert all digits to the ASCII
- digits 0 - 9 and compare. */
+ To check equivalence, decompose pattern letter and input letter into
+ normalization form KD and check the base character for equality. Also,
+ convert all digits to the ASCII digits 0 - 9 and compare. */
extern "C" int
is_unicode_equiv (wint_t test, wint_t eqv)
{
- wchar_t decomp_testc[5] = { 0 };
- wchar_t decomp_eqvc[5] = { 0 };
+ wchar_t decomp_testc[24] = { 0 };
+ wchar_t decomp_eqvc[24] = { 0 };
wchar_t testc[3] = { 0 };
wchar_t eqvc[3] = { 0 };
@@ -1229,8 +1229,10 @@ is_unicode_equiv (wint_t test, wint_t eqv)
} else
testc[0] = test;
/* Convert to denormalized form */
- FoldStringW (MAP_COMPOSITE | MAP_FOLDDIGITS, eqvc, -1, decomp_eqvc, 5);
- FoldStringW (MAP_COMPOSITE | MAP_FOLDDIGITS, testc, -1, decomp_testc, 5);
+ FoldStringW (MAP_COMPOSITE | MAP_FOLDCZONE | MAP_FOLDDIGITS,
+ eqvc, -1, decomp_eqvc, 24);
+ FoldStringW (MAP_COMPOSITE | MAP_FOLDCZONE | MAP_FOLDDIGITS,
+ testc, -1, decomp_testc, 24);
/* If they are equivalent, the base char must be the same. */
if (decomp_eqvc[0] != decomp_testc[0])
return 0;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-02-18 22:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-18 22:14 [newlib-cygwin/main] Cygwin: is_unicode_equiv: fix normalization Corinna Vinschen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).