summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-05-04 08:35:44 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-05-04 08:35:44 (GMT)
commit8c3587a6e899c6fd12fd0563312c4a20c289d8fd (patch)
treeb47368d619057dd4547f33dff63bd8e83c8dd16e /generic
parentc17661c31e3f4fac5a70dd487b4c9b3372ee5e5b (diff)
downloadtcl-8c3587a6e899c6fd12fd0563312c4a20c289d8fd.zip
tcl-8c3587a6e899c6fd12fd0563312c4a20c289d8fd.tar.gz
tcl-8c3587a6e899c6fd12fd0563312c4a20c289d8fd.tar.bz2
(partial) fix for [9d0cb35bb2]: Various issues with core-8-6-branch, TCL_UTF_MAX=4. (even though TCL_UTF_MAX=4 is unsupported, it would be nice to make it work)
Marked various test-cases as "knownBug", those work correctly in core-8-branch (8.7). The fix there could be backported. Low prio.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclUtf.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/generic/tclUtf.c b/generic/tclUtf.c
index a2080dd..ab3c577 100644
--- a/generic/tclUtf.c
+++ b/generic/tclUtf.c
@@ -359,8 +359,8 @@ Tcl_UniCharToUtfDString(
int
Tcl_UtfToUniChar(
- register const char *src, /* The UTF-8 string. */
- register Tcl_UniChar *chPtr)/* Filled with the Tcl_UniChar represented by
+ const char *src, /* The UTF-8 string. */
+ Tcl_UniChar *chPtr)/* Filled with the Tcl_UniChar represented by
* the UTF-8 string. */
{
Tcl_UniChar byte;
@@ -580,12 +580,12 @@ Tcl_UtfCharComplete(
int
Tcl_NumUtfChars(
- register const char *src, /* The UTF-8 string to measure. */
+ const char *src, /* The UTF-8 string to measure. */
int length) /* The length of the string in bytes, or -1
* for strlen(string). */
{
Tcl_UniChar ch = 0;
- register int i = 0;
+ int i = 0;
/*
* The separate implementations are faster.
@@ -601,27 +601,29 @@ Tcl_NumUtfChars(
}
if (i < 0) i = INT_MAX; /* Bug [2738427] */
} else {
- register const char *endPtr = src + length - TCL_UTF_MAX;
+ const char *endPtr = src + length - TCL_UTF_MAX;
while (src < endPtr) {
+#if TCL_UTF_MAX < 4
if (((unsigned)UCHAR(*src) - 0xF0) < 5) {
/* treat F0 - F4 as single character */
ch = 0;
src++;
- } else {
- src += TclUtfToUniChar(src, &ch);
- }
+ } else
+#endif
+ src += TclUtfToUniChar(src, &ch);
i++;
}
endPtr += TCL_UTF_MAX;
while ((src < endPtr) && Tcl_UtfCharComplete(src, endPtr - src)) {
+#if TCL_UTF_MAX < 4
if (((unsigned)UCHAR(*src) - 0xF0) < 5) {
/* treat F0 - F4 as single character */
ch = 0;
src++;
- } else {
- src += TclUtfToUniChar(src, &ch);
- }
+ } else
+#endif
+ src += TclUtfToUniChar(src, &ch);
i++;
}
if (src < endPtr) {
@@ -890,8 +892,8 @@ Tcl_UtfPrev(
Tcl_UniChar
Tcl_UniCharAtIndex(
- register const char *src, /* The UTF-8 string to dereference. */
- register int index) /* The position of the desired character. */
+ const char *src, /* The UTF-8 string to dereference. */
+ int index) /* The position of the desired character. */
{
Tcl_UniChar ch = 0;
@@ -918,8 +920,8 @@ Tcl_UniCharAtIndex(
const char *
Tcl_UtfAtIndex(
- register const char *src, /* The UTF-8 string. */
- register int index) /* The position of the desired character. */
+ const char *src, /* The UTF-8 string. */
+ int index) /* The position of the desired character. */
{
Tcl_UniChar ch = 0;
int len = 0;
@@ -1191,7 +1193,7 @@ TclpUtfNcmp2(
* fine in the strcmp manner.
*/
- register int result = 0;
+ int result = 0;
for ( ; numBytes != 0; numBytes--, cs++, ct++) {
if (*cs != *ct) {