diff options
author | dgp <dgp@users.sourceforge.net> | 2009-02-10 14:59:34 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2009-02-10 14:59:34 (GMT) |
commit | 526787f45e75e5f6fb736b3f4b3938ec4eaf2c44 (patch) | |
tree | 6c18170d903d3f6c6874816b9cf4df59c00b310b | |
parent | 34980e46f1c6693dba7bcab875f6a227085a87ec (diff) | |
download | tcl-526787f45e75e5f6fb736b3f4b3938ec4eaf2c44.zip tcl-526787f45e75e5f6fb736b3f4b3938ec4eaf2c44.tar.gz tcl-526787f45e75e5f6fb736b3f4b3938ec4eaf2c44.tar.bz2 |
* generic/tclStringObj.c: Reduce code duplication in Tcl_GetUnicode*.
Restrict AppendUtfToUtfRep to non-negative length appends.
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | generic/tclStringObj.c | 8 |
2 files changed, 5 insertions, 6 deletions
@@ -1,6 +1,7 @@ 2009-02-10 Don Porter <dgp@users.sourceforge.net> - * generic/tclStringObj.c (Tcl_GetUnicode*): Reduce code duplication. + * generic/tclStringObj.c: Reduce code duplication in Tcl_GetUnicode*. + Restrict AppendUtfToUtfRep to non-negative length appends. 2009-02-09 Jan Nijtmans <nijtmans@users.sf.net> diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index da17c2f..f74f90b 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -33,7 +33,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclStringObj.c,v 1.88 2009/02/10 14:38:55 dgp Exp $ */ + * RCS: @(#) $Id: tclStringObj.c,v 1.89 2009/02/10 14:59:34 dgp Exp $ */ #include "tclInt.h" #include "tommath.h" @@ -1146,7 +1146,7 @@ Tcl_AppendLimitedToObj( if (stringPtr->hasUnicode != 0) { AppendUtfToUnicodeRep(objPtr, ellipsis, -1); } else { - AppendUtfToUtfRep(objPtr, ellipsis, -1); + AppendUtfToUtfRep(objPtr, ellipsis, strlen(ellipsis)); } } @@ -1518,6 +1518,7 @@ AppendUtfToUnicodeRep( * * This function appends "numBytes" bytes of "bytes" to the UTF string * rep of "objPtr". objPtr must already have a valid String rep. + * numBytes must be non-negative. * * Results: * None. @@ -1537,9 +1538,6 @@ AppendUtfToUtfRep( String *stringPtr; int newLength, oldLength; - if (numBytes < 0) { - numBytes = (bytes ? strlen(bytes) : 0); - } if (numBytes == 0) { return; } |