diff options
author | dgp <dgp@users.sourceforge.net> | 2008-04-07 16:06:52 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2008-04-07 16:06:52 (GMT) |
commit | 871b84cdfe3b833bb5d1496f8d8bc70013257619 (patch) | |
tree | b71c71442b752790c7d30cdc1fbd4b44cb88095e /generic | |
parent | 6bdb3d6484f629725b9eaf6638099976ad8717c7 (diff) | |
download | tcl-871b84cdfe3b833bb5d1496f8d8bc70013257619.zip tcl-871b84cdfe3b833bb5d1496f8d8bc70013257619.tar.gz tcl-871b84cdfe3b833bb5d1496f8d8bc70013257619.tar.bz2 |
* generic/tclStringObj.c (Tcl_AppendFormatToObj):
Fix [format {% d}] so that it behaves the same way as in 8.4 and
as C's printf().
* tests/format.test: Add a test for '% d' and '%+d'.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclStringObj.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 9664726..b9311ec 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.70 2008/02/28 17:36:49 dgp Exp $ */ + * RCS: @(#) $Id: tclStringObj.c,v 1.70.2.1 2008/04/07 16:07:00 dgp Exp $ */ #include "tclInt.h" #include "tommath.h" @@ -2003,8 +2003,8 @@ Tcl_AppendFormatToObj( allocSegment = 1; Tcl_IncrRefCount(segment); - if ((isNegative || gotPlus) && (useBig || (ch == 'd'))) { - Tcl_AppendToObj(segment, (isNegative ? "-" : "+"), 1); + if ((isNegative || gotPlus || gotSpace) && (useBig || (ch == 'd'))) { + Tcl_AppendToObj(segment, (isNegative ? "-" : gotPlus ? "+" : " "), 1); } if (gotHash) { |