From 5fd34b88068d8c84b8d32ebd8cde63e0bfcdde70 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" <nijtmans@users.sourceforge.net> Date: Tue, 16 Feb 2021 12:07:42 +0000 Subject: Fix bug in previous commit: Don't update stringPtr->numChars when doing a "string reverse", because TclUtfToUCS4() doesn't count surrogate pairs as 2 --- generic/tclStringObj.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index bdc9c99..0e1acf0 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -3003,7 +3003,6 @@ TclStringReverse( * Pass 1. Reverse the bytes of each multi-byte character. */ - int charCount = 0; int bytesLeft = numBytes; int chw; @@ -3021,11 +3020,9 @@ TclStringReverse( to += bytesInChar; from += bytesInChar; bytesLeft -= bytesInChar; - charCount++; } from = to = objPtr->bytes; - stringPtr->numChars = charCount; } /* Pass 2. Reverse all the bytes. */ ReverseBytes((unsigned char *)to, (unsigned char *)from, numBytes); -- cgit v0.12