summaryrefslogtreecommitdiffstats
path: root/generic/tclUtil.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclUtil.c')
-rw-r--r--generic/tclUtil.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index d7baedd..0e3449d 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -1686,7 +1686,7 @@ TclTrimRight(
* rely on (trim[numTrim] == '\0'). */
{
const char *pp, *p = bytes + numBytes;
- Tcl_UniChar ch1 = 0;
+ int ch1, ch2;
/* Empty strings -> nothing to do */
if ((numBytes == 0) || (numTrim == 0)) {
@@ -1700,12 +1700,14 @@ TclTrimRight(
do {
const char *q = trim;
int pInc = 0, bytesLeft = numTrim;
- Tcl_UniChar ch2 = 0;
pp = TclUtfPrev(p, bytes);
+#if TCL_UTF_MAX <= 4
+ pp = TclUtfPrev(pp, bytes);
+#endif
do {
pp += pInc;
- pInc = TclUtfToUniChar(pp, &ch1);
+ pInc = TclUtfToUCS4(pp, &ch1);
} while (pp + pInc < p);
/*
@@ -1713,7 +1715,7 @@ TclTrimRight(
*/
do {
- int qInc = TclUtfToUniChar(q, &ch2);
+ int qInc = TclUtfToUCS4(q, &ch2);
if (ch1 == ch2) {
break;
@@ -1766,7 +1768,7 @@ TclTrimLeft(
* rely on (trim[numTrim] == '\0'). */
{
const char *p = bytes;
- Tcl_UniChar ch1 = 0;
+ int ch1, ch2;
/* Empty strings -> nothing to do */
if ((numBytes == 0) || (numTrim == 0)) {
@@ -1778,8 +1780,7 @@ TclTrimLeft(
*/
do {
- Tcl_UniChar ch2 = 0;
- int pInc = TclUtfToUniChar(p, &ch1);
+ int pInc = TclUtfToUCS4(p, &ch1);
const char *q = trim;
int bytesLeft = numTrim;
@@ -1788,7 +1789,7 @@ TclTrimLeft(
*/
do {
- int qInc = TclUtfToUniChar(q, &ch2);
+ int qInc = TclUtfToUCS4(q, &ch2);
if (ch1 == ch2) {
break;