summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs>2001-07-16 23:14:13 (GMT)
committerhobbs <hobbs>2001-07-16 23:14:13 (GMT)
commit857ae17df742da7ac70bee24c00ca6ce568e9011 (patch)
tree7e9a0ee1031efe79c0206e863be0d5deafb8df3d
parent4a83040c8a15e5f30bc3a02f549e71ab156307e8 (diff)
downloadtcl-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)
-rw-r--r--ChangeLog22
-rw-r--r--generic/tclCmdIL.c18
-rw-r--r--generic/tclObj.c7
-rw-r--r--generic/tclUtf.c19
-rw-r--r--generic/tclUtil.c6
-rw-r--r--tests/util.test6
6 files changed, 57 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index 27b2551..f947517 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+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)
+
2001-05-04 Daniel Steffen <das@users.sourceforge.net>
** Mac 8.3.3 binary release
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c
index 2668432..aa8f74d 100644
--- a/generic/tclCmdIL.c
+++ b/generic/tclCmdIL.c
@@ -14,7 +14,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCmdIL.c,v 1.24.2.1 2001/04/03 22:54:36 hobbs Exp $
+ * RCS: @(#) $Id: tclCmdIL.c,v 1.24.2.2 2001/07/16 23:14:13 hobbs Exp $
*/
#include "tclInt.h"
@@ -1506,19 +1506,19 @@ InfoProcsCmd(dummy, interp, objc, objv)
|| Tcl_StringMatch(cmdName, simplePattern)) {
cmdPtr = (Command *) Tcl_GetHashValue(entryPtr);
- if (specificNsInPattern) {
- elemObjPtr = Tcl_NewObj();
- Tcl_GetCommandFullName(interp, (Tcl_Command) cmdPtr,
- elemObjPtr);
- } else {
- elemObjPtr = Tcl_NewStringObj(cmdName, -1);
- }
-
realCmdPtr = (Command *)
TclGetOriginalCommand((Tcl_Command) cmdPtr);
if (TclIsProc(cmdPtr)
|| ((realCmdPtr != NULL) && TclIsProc(realCmdPtr))) {
+ if (specificNsInPattern) {
+ elemObjPtr = Tcl_NewObj();
+ Tcl_GetCommandFullName(interp, (Tcl_Command) cmdPtr,
+ elemObjPtr);
+ } else {
+ elemObjPtr = Tcl_NewStringObj(cmdName, -1);
+ }
+
Tcl_ListObjAppendElement(interp, listPtr, elemObjPtr);
}
}
diff --git a/generic/tclObj.c b/generic/tclObj.c
index 432cd4a..a463b3b 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.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: tclObj.c,v 1.12.2.2 2001/04/06 01:32:34 hobbs Exp $
+ * RCS: @(#) $Id: tclObj.c,v 1.12.2.3 2001/07/16 23:14:13 hobbs Exp $
*/
#include "tclInt.h"
@@ -523,8 +523,7 @@ Tcl_DbNewObj(file, line)
void
TclAllocateFreeObjects()
{
- size_t objSizePlusPadding = sizeof(Tcl_Obj);
- size_t bytesToAlloc = (OBJS_TO_ALLOC_EACH_TIME * objSizePlusPadding);
+ size_t bytesToAlloc = (OBJS_TO_ALLOC_EACH_TIME * sizeof(Tcl_Obj));
char *basePtr;
register Tcl_Obj *prevPtr, *objPtr;
register int i;
@@ -534,7 +533,7 @@ TclAllocateFreeObjects()
prevPtr = NULL;
objPtr = (Tcl_Obj *) basePtr;
- for (i = 0; i < OBJS_TO_ALLOC_EACH_TIME; i++) {
+ for (i = 0; i < OBJS_TO_ALLOC_EACH_TIME; i++) {
objPtr->internalRep.otherValuePtr = (VOID *) prevPtr;
prevPtr = objPtr;
objPtr++;
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);
}
/*
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index 6e99f32..1aeae89 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.17 1999/12/12 02:26:43 hobbs Exp $
+ * RCS: @(#) $Id: tclUtil.c,v 1.17.2.1 2001/07/16 23:14:13 hobbs Exp $
*/
#include "tclInt.h"
@@ -1071,7 +1071,7 @@ Tcl_ConcatObj(objc, objv)
for (i = 0; i < objc; i++) {
objPtr = objv[i];
element = Tcl_GetStringFromObj(objPtr, &elemLength);
- while ((elemLength > 0)
+ while ((elemLength > 0) && (UCHAR(*element) < 127)
&& (isspace(UCHAR(*element)))) { /* INTL: ISO space. */
element++;
elemLength--;
@@ -1083,7 +1083,7 @@ Tcl_ConcatObj(objc, objv)
* this case it could be significant.
*/
- while ((elemLength > 0)
+ while ((elemLength > 0) && (UCHAR(element[elemLength-1]) < 127)
&& isspace(UCHAR(element[elemLength-1])) /* INTL: ISO space. */
&& ((elemLength < 2) || (element[elemLength-2] != '\\'))) {
elemLength--;
diff --git a/tests/util.test b/tests/util.test
index 93962d0..a9564fd 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.7.2.1 2001/07/16 23:14:13 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