summaryrefslogtreecommitdiffstats
path: root/generic/tclStubInit.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-05-13 22:07:13 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-05-13 22:07:13 (GMT)
commit9402bad3f48c98253d00cb0249db13442691e289 (patch)
treeb43e9d664bac2450b256c839babcc43bd5971525 /generic/tclStubInit.c
parent648162204d4c9bd80cde739b4cad361de6ebe6f1 (diff)
parent5efc8e4cfbcc400b2a929dd4b828afd5308d3b53 (diff)
downloadtcl-9402bad3f48c98253d00cb0249db13442691e289.zip
tcl-9402bad3f48c98253d00cb0249db13442691e289.tar.gz
tcl-9402bad3f48c98253d00cb0249db13442691e289.tar.bz2
Merge 8.7. Further progress with TIP implementation.
Diffstat (limited to 'generic/tclStubInit.c')
-rw-r--r--generic/tclStubInit.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index ae9a4e3..9aa7301 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -94,7 +94,7 @@ static void uniCodePanic(void) {
static int TclUtfCharComplete(const char *src, int length) {
if ((unsigned)((unsigned char)*(src) - 0xF0) < 5) {
- return length < 5;
+ return length < 3;
}
return Tcl_UtfCharComplete(src, length);
}
@@ -107,9 +107,10 @@ static const char *TclUtfNext(const char *src) {
}
static const char *TclUtfPrev(const char *src, const char *start) {
- if (((unsigned)((unsigned char)*(src) - 0xF0) < 5) && (src >= start)) {
- return src - 1;
- }
+ if ((src >= start + 3) && ((src[-1] & 0xC0) == 0x80)
+ && ((src[-2] & 0xC0) == 0x80) && ((src[-3] & 0xC0) == 0x80)) {
+ return src - 3;
+ }
return Tcl_UtfPrev(src, start);
}