summaryrefslogtreecommitdiffstats
path: root/generic/tclUtf.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-04-24 13:15:53 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-04-24 13:15:53 (GMT)
commitf0b58b55b62e4dea5694b49b1bd846839cbef1f3 (patch)
treefe18b00adfed90c061548af41cd70a62cecc513d /generic/tclUtf.c
parent2ca7ab9af0d59c9907dde3d844e1785d33df4812 (diff)
parent423df1f681b111dff8a5633b5aaa6e0049aaeddf (diff)
downloadtcl-f0b58b55b62e4dea5694b49b1bd846839cbef1f3.zip
tcl-f0b58b55b62e4dea5694b49b1bd846839cbef1f3.tar.gz
tcl-f0b58b55b62e4dea5694b49b1bd846839cbef1f3.tar.bz2
Merge 8.5.
Fix regression in Tcl_UtfComplete(), actually already present for longer time but masked by error in TclUtfNext() macro. Adapt expectations accordingly ("/xA0/xA0" should really have length 2 ....)
Diffstat (limited to 'generic/tclUtf.c')
-rw-r--r--generic/tclUtf.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/generic/tclUtf.c b/generic/tclUtf.c
index 0e11e0e..96953e2 100644
--- a/generic/tclUtf.c
+++ b/generic/tclUtf.c
@@ -64,7 +64,7 @@ static const unsigned char totalBytes[256] = {
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-#if TCL_UTF_MAX > 4
+#if TCL_UTF_MAX != 4
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
#else /* Tcl_UtfCharComplete() might point to 2nd byte of valid 4-byte sequence */
@@ -733,13 +733,6 @@ Tcl_UtfNext(
int left = totalBytes[UCHAR(*src)];
const char *next = src + 1;
- if (((*src) & 0xC0) == 0x80) {
- if ((((*++src) & 0xC0) == 0x80) && (((*++src) & 0xC0) == 0x80)) {
- ++src;
- }
- return src;
- }
-
while (--left) {
if ((*next & 0xC0) != 0x80) {
/*
@@ -751,7 +744,7 @@ Tcl_UtfNext(
}
next++;
}
- if (Invalid((unsigned char *)src)) {
+ if ((next == src + 1) || Invalid((unsigned char *)src)) {
return src + 1;
}
return next;