summaryrefslogtreecommitdiffstats
path: root/generic/tclUtf.c
diff options
context:
space:
mode:
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) {