From 970995d516c48cff4a1d54a83ea6b8281b28f6ae Mon Sep 17 00:00:00 2001 From: hobbs Date: Tue, 3 Jul 2001 03:33:42 +0000 Subject: * tests/util.test: added util-4.6 * generic/tclUtil.c (Tcl_ConcatObj): Corrected walking backwards over utf-8 chars. [Bug #227512] --- ChangeLog | 6 ++++++ generic/tclUtil.c | 10 +++++----- tests/util.test | 6 +++++- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5c1e273..da7a5e3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2001-07-02 Jeff Hobbs + + * tests/util.test: added util-4.6 + * generic/tclUtil.c (Tcl_ConcatObj): Corrected walking backwards + over utf-8 chars. [Bug #227512] + 2001-07-02 Don Porter * tests/unixInit.test (unixInit-2.8): Corrected test for all diff --git a/generic/tclUtil.c b/generic/tclUtil.c index bd75075..340d004 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUtil.c,v 1.19 2001/06/04 01:25:04 hobbs Exp $ + * RCS: @(#) $Id: tclUtil.c,v 1.20 2001/07/03 03:33:42 hobbs Exp $ */ #include "tclInt.h" @@ -1071,8 +1071,8 @@ Tcl_ConcatObj(objc, objv) for (i = 0; i < objc; i++) { objPtr = objv[i]; element = Tcl_GetStringFromObj(objPtr, &elemLength); - while ((elemLength > 0) - && (isspace(UCHAR(*element)))) { /* INTL: ISO space. */ + while ((elemLength > 0) && (UCHAR(*element) < 127) + && isspace(UCHAR(*element))) { /* INTL: ISO C space. */ element++; elemLength--; } @@ -1083,8 +1083,8 @@ Tcl_ConcatObj(objc, objv) * this case it could be significant. */ - while ((elemLength > 0) - && isspace(UCHAR(element[elemLength-1])) /* INTL: ISO space. */ + while ((elemLength > 0) && (UCHAR(element[elemLength-1]) < 127) + && isspace(UCHAR(element[elemLength-1])) /* INTL: ISO C space. */ && ((elemLength < 2) || (element[elemLength-2] != '\\'))) { elemLength--; } diff --git a/tests/util.test b/tests/util.test index 93962d0..d783eff 100644 --- a/tests/util.test +++ b/tests/util.test @@ -7,7 +7,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: util.test,v 1.7 2000/04/10 17:19:06 ericm Exp $ +# RCS: @(#) $Id: util.test,v 1.8 2001/07/03 03:33:42 hobbs Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -62,6 +62,10 @@ test util-4.4 {Tcl_ConcatObj - backslash-space at end of argument} { test util-4.5 {Tcl_ConcatObj - backslash-space at end of argument} { concat a { } c } {a c} +test util-4.6 {Tcl_ConcatObj - utf-8 sequence with "whitespace" char} { + # Check for Bug #227512. If this violates C isspace, then it returns \xc3. + concat \xe0 +} \xe0 test util-5.1 {Tcl_StringMatch} { string match ab*c abc -- cgit v0.12