diff options
author | hobbs <hobbs> | 2001-07-16 23:14:13 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2001-07-16 23:14:13 (GMT) |
commit | 857ae17df742da7ac70bee24c00ca6ce568e9011 (patch) | |
tree | 7e9a0ee1031efe79c0206e863be0d5deafb8df3d /generic/tclUtf.c | |
parent | 4a83040c8a15e5f30bc3a02f549e71ab156307e8 (diff) | |
download | tcl-857ae17df742da7ac70bee24c00ca6ce568e9011.zip tcl-857ae17df742da7ac70bee24c00ca6ce568e9011.tar.gz tcl-857ae17df742da7ac70bee24c00ca6ce568e9011.tar.bz2 |
2001-07-02 Jeff Hobbs <jeffh@ActiveState.com>
* tests/util.test: added util-4.6
* generic/tclUtil.c (Tcl_ConcatObj): Corrected walking backwards
over utf-8 chars. [Bug #227512]
2001-06-27 Jeff Hobbs <jeffh@ActiveState.com>
* generic/tclUtf.c (Tcl_UtfBackslash): Corrected backslash
handling of multibyte utf-8 chars. [Bug #217987]
* generic/tclCmdIL.c (InfoProcsCmd): fixed potential mem leak in
info procs that created objects without using them.
* generic/tclCompCmds.c (TclCompileStringCmd): fixed mem leak when
string command failed to parse the subcommand.
2001-05-22 Jeff Hobbs <jeffh@ActiveState.com>
* generic/tclObj.c (TclAllocateFreeObjects): simplified
objSizePlusPadding to use sizeof(Tcl_Obj) (max)
Diffstat (limited to 'generic/tclUtf.c')
-rw-r--r-- | generic/tclUtf.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/generic/tclUtf.c b/generic/tclUtf.c index 5fe3c41..c25a255 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUtf.c,v 1.11 2000/01/11 22:09:00 hobbs Exp $ + * RCS: @(#) $Id: tclUtf.c,v 1.11.2.1 2001/07/16 23:14:13 hobbs Exp $ */ #include "tclInt.h" @@ -111,7 +111,7 @@ static int UtfCount _ANSI_ARGS_((int ch)); *--------------------------------------------------------------------------- */ -static int +INLINE static int UtfCount(ch) int ch; /* The Tcl_UniChar whose size is returned. */ { @@ -781,7 +781,8 @@ Tcl_UtfBackslash(src, readPtr, dst) * backslash sequence. */ { register CONST char *p = src+1; - int result, count, n; + Tcl_UniChar result; + int count, n; char buf[TCL_UTF_MAX]; if (dst == NULL) { @@ -883,15 +884,25 @@ Tcl_UtfBackslash(src, readPtr, dst) result = (unsigned char)((result << 3) + (*p - '0')); break; } + if (UCHAR(*p) < UNICODE_SELF) { result = *p; count = 2; + } else { + /* + * We have to convert here because the user has put a + * backslash in front of a multi-byte utf-8 character. + * While this means nothing special, we shouldn't break up + * a correct utf-8 character. [Bug #217987] test subst-3.2 + */ + count = Tcl_UtfToUniChar(p, &result) + 1; /* +1 for '\' */ + } break; } if (readPtr != NULL) { *readPtr = count; } - return Tcl_UniCharToUtf(result, dst); + return Tcl_UniCharToUtf((int) result, dst); } /* |