From 24e4669c51e1dbe148a0bba31d38e5c626d4b075 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 12 May 2020 19:20:20 +0000 Subject: Revert implementation of Tcl_UniCharAtIndex() change done in this commit: [6596c4af31e29b5d]. Just look at the Tcl_UtfAtIndex() implementation for TCL_UTF_MAX=4: It's not the same. There are no test-cases for Tcl_UniCharAtIndex(), see [f45d0dc1a7], not really worth to write one, since the implementation of this function didn't change in 20 years. --- generic/tclUtf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/generic/tclUtf.c b/generic/tclUtf.c index 9596aed..c7f8a94 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -937,7 +937,9 @@ Tcl_UniCharAtIndex( { Tcl_UniChar ch = 0; - TclUtfToUniChar(Tcl_UtfAtIndex(src, index), &ch); + while (index-- >= 0) { + src += TclUtfToUniChar(src, &ch); + } return ch; } -- cgit v0.12