summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2021-02-16 08:30:17 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2021-02-16 08:30:17 (GMT)
commitc5ac00f842a5733ee27fcf4a64ff95a7d83dd22f (patch)
tree451376147b090249350e5ffffa780c92c4e47cbc
parent9c5bc7d1de700e3e80126e1cc2459471566aaf9e (diff)
parent34580421592530f8a2cbfb7c2e4b1fd65a427f8e (diff)
downloadtcl-c5ac00f842a5733ee27fcf4a64ff95a7d83dd22f.zip
tcl-c5ac00f842a5733ee27fcf4a64ff95a7d83dd22f.tar.gz
tcl-c5ac00f842a5733ee27fcf4a64ff95a7d83dd22f.tar.bz2
Merge 8.6
-rw-r--r--generic/tclUtil.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index eef6393..1904e2f 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -1708,7 +1708,8 @@ TclTrimRight(
int pInc = 0, bytesLeft = numTrim;
pp = TclUtfPrev(p, bytes);
-#if TCL_UTF_MAX < 4
+#if TCL_UTF_MAX < 4 /* Needed because TclUtfPrev() cannot always jump back */
+ /* sufficiently. See [d43f96c1a8] */
pp = TclUtfPrev(pp, bytes);
#endif
do {
@@ -1721,14 +1722,14 @@ TclTrimRight(
*/
do {
- int qInc = TclUtfToUCS4(q, &ch2);
+ pInc = TclUtfToUCS4(q, &ch2);
if (ch1 == ch2) {
break;
}
- q += qInc;
- bytesLeft -= qInc;
+ q += pInc;
+ bytesLeft -= pInc;
} while (bytesLeft);
if (bytesLeft == 0) {