From 41a89c36a8f7b088c02c032fa5f61056dfd1f383 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 8 Apr 2020 18:07:07 +0000 Subject: Cherry pick the [string trim] changes. --- generic/tclUtil.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/generic/tclUtil.c b/generic/tclUtil.c index cb5072b..f4879a1 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -1589,10 +1589,7 @@ TrimRight( Tcl_UniChar ch2; int qInc = TclUtfToUniChar(q, &ch2); - /* compare chars and real length of char, e.g. if TclUtfToUniChar - * mistakenly considers NTS 0-byte as a continuation of invalid utf-8 - * sequence, bug [c61818e4c9] */ - if (ch1 == ch2 && p - pp == qInc) { + if (ch1 == ch2) { break; } @@ -1604,8 +1601,7 @@ TrimRight( /* No match; trim task done; *p is last non-trimmed char */ break; } - p = pp; - } while (p > bytes); + } while ((p = pp) > bytes); return numBytes - (p - bytes); } @@ -1684,7 +1680,7 @@ TrimLeft( Tcl_UniChar ch2; int qInc = TclUtfToUniChar(q, &ch2); - if (ch1 == ch2 && pInc == qInc) { + if (ch1 == ch2) { break; } -- cgit v0.12