summaryrefslogtreecommitdiffstats
path: root/generic/tclUtf.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-04-17 10:32:52 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-04-17 10:32:52 (GMT)
commit0c272ad2ce2e910b0642d1a2691ddb19e63291fb (patch)
treea612a54786dbdd46b99c7fde24a183fc5b1d93e6 /generic/tclUtf.c
parent98700eaf2b0d54d262c427dd5dd30133e6a14fbd (diff)
parentb4ecc6b747780c309fbf05d525ecb3c5f74f3ff2 (diff)
downloadtcl-0c272ad2ce2e910b0642d1a2691ddb19e63291fb.zip
tcl-0c272ad2ce2e910b0642d1a2691ddb19e63291fb.tar.gz
tcl-0c272ad2ce2e910b0642d1a2691ddb19e63291fb.tar.bz2
More test-cases. Mark test-case utf-2.11 as "knownBug", doesn't give the right answer for any TCL_UTC_MAX value. TODO: To Be Fixed! (Don ????)
Fix build/testcase for TCL_UTF_MAX=6 (testcase is OK, "string length" implementation was not!)
Diffstat (limited to 'generic/tclUtf.c')
-rw-r--r--generic/tclUtf.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/generic/tclUtf.c b/generic/tclUtf.c
index 4b5d500..94fa5f6 100644
--- a/generic/tclUtf.c
+++ b/generic/tclUtf.c
@@ -598,7 +598,11 @@ Tcl_NumUtfChars(
if (length < 0) {
while ((*src != '\0') && (i < INT_MAX)) {
next = TclUtfNext(src);
+#if TCL_UTF_MAX > 4
+ i++;
+#else
i += 1 + ((next - src) > 3);
+#endif
src = next;
}
} else {
@@ -606,13 +610,21 @@ Tcl_NumUtfChars(
while (src < endPtr) {
next = TclUtfNext(src);
+#if TCL_UTF_MAX > 4
+ i++;
+#else
i += 1 + ((next - src) > 3);
+#endif
src = next;
}
endPtr += /*TCL_UTF_MAX*/ 4;
while ((src < endPtr) && Tcl_UtfCharComplete(src, endPtr - src)) {
next = TclUtfNext(src);
+#if TCL_UTF_MAX > 4
+ i++;
+#else
i += 1 + ((next - src) > 3);
+#endif
src = next;
}
if (src < endPtr) {