diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-05-05 16:00:06 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-05-05 16:00:06 (GMT) |
commit | 96f7e93f0b671b1d35f78a5e3058f9a83e2caedc (patch) | |
tree | 51e0d5f17d6e5e6fa4a20021f2937740c9735a10 /generic/tclUtf.c | |
parent | c6d9c4cee08c88cac3ba885b637147fe8808c62a (diff) | |
download | tcl-96f7e93f0b671b1d35f78a5e3058f9a83e2caedc.zip tcl-96f7e93f0b671b1d35f78a5e3058f9a83e2caedc.tar.gz tcl-96f7e93f0b671b1d35f78a5e3058f9a83e2caedc.tar.bz2 |
More usage of TclUtfToUCS4(), so we can use the whole Unicode range better in TCL_UTF_MAX>3 builds.
Diffstat (limited to 'generic/tclUtf.c')
-rw-r--r-- | generic/tclUtf.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/generic/tclUtf.c b/generic/tclUtf.c index 5e9b7a1..9792071 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -88,7 +88,6 @@ static const unsigned char totalBytes[256] = { static int UtfCount(int ch); static int Invalid(unsigned char *src); static int UCS4ToUpper(int ch); -static int UCS4ToLower(int ch); static int UCS4ToTitle(int ch); /* @@ -1078,7 +1077,7 @@ Tcl_UtfToLower( src = dst = str; while (*src) { len = TclUtfToUCS4(src, &ch); - lowChar = UCS4ToLower(ch); + lowChar = TclUCS4ToLower(ch); /* * To keep badly formed Utf strings from getting inflated by the @@ -1149,7 +1148,7 @@ Tcl_UtfToTitle( lowChar = ch; /* Special exception for Georgian Asomtavruli chars, no titlecase. */ if ((unsigned)(lowChar - 0x1C90) >= 0x30) { - lowChar = UCS4ToLower(lowChar); + lowChar = TclUCS4ToLower(lowChar); } if (len < UtfCount(lowChar) || ((lowChar & ~0x7FF) == 0xD800)) { @@ -1254,11 +1253,11 @@ Tcl_UtfNcmp( if (ch1 != ch2) { #if TCL_UTF_MAX == 4 /* Surrogates always report higher than non-surrogates */ - if (((ch1 & 0xFC00) == 0xD800)) { - if ((ch2 & 0xFC00) != 0xD800) { + if (((ch1 & ~0x3FF) == 0xD800)) { + if ((ch2 & ~0x3FF) != 0xD800) { return ch1; } - } else if ((ch2 & 0xFC00) == 0xD800) { + } else if ((ch2 & ~0x3FF) == 0xD800) { return -ch2; } #endif @@ -1427,8 +1426,8 @@ Tcl_UniCharToUpper( *---------------------------------------------------------------------- */ -static int -UCS4ToLower( +int +TclUCS4ToLower( int ch) /* Unicode character to convert. */ { if (!UNICODE_OUT_OF_RANGE(ch)) { @@ -1447,7 +1446,7 @@ Tcl_UniChar Tcl_UniCharToLower( int ch) /* Unicode character to convert. */ { - return (Tcl_UniChar) UCS4ToLower(ch); + return (Tcl_UniChar) TclUCS4ToLower(ch); } /* |