diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-04-17 11:02:19 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-04-17 11:02:19 (GMT) |
commit | 4de1b924a8f4f41a574d576427acfea490cd06ca (patch) | |
tree | dd059d43339e32810bfe1f0b1b185434113571bf /generic/tclUtf.c | |
parent | 0c272ad2ce2e910b0642d1a2691ddb19e63291fb (diff) | |
download | tcl-4de1b924a8f4f41a574d576427acfea490cd06ca.zip tcl-4de1b924a8f4f41a574d576427acfea490cd06ca.tar.gz tcl-4de1b924a8f4f41a574d576427acfea490cd06ca.tar.bz2 |
Fix implementation of Tcl_UtfAtIndex() for TCL_UTF_MAX=6 (There's no test-case for this in the core-8-6-branch, but there is in core-8-branch).
Diffstat (limited to 'generic/tclUtf.c')
-rw-r--r-- | generic/tclUtf.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/generic/tclUtf.c b/generic/tclUtf.c index 94fa5f6..1ba474e 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -971,14 +971,16 @@ Tcl_UtfAtIndex( register int index) /* The position of the desired character. */ { while (index-- > 0) { - const char *next = TclUtfNext(src); + const char *next = TclUtfNext(src); +#if TCL_UTF_MAX <= 4 /* * 4-byte sequences generate two UCS-2 code units in the * UTF-16 representation, so in the current indexing scheme * we need to account for an extra index (total of two). */ index -= ((next - src) > 3); +#endif src = next; } |