diff options
author | rmax <rmax> | 2008-04-07 15:23:04 (GMT) |
---|---|---|
committer | rmax <rmax> | 2008-04-07 15:23:04 (GMT) |
commit | 50b90140ddeee58a28221cf9fe44c352f2d4b054 (patch) | |
tree | 977c901d0fab00597fe986e630e23630f418d622 /generic | |
parent | d4d4d0027f1947f9ad87ec563837df22d21e55b2 (diff) | |
download | tcl-50b90140ddeee58a28221cf9fe44c352f2d4b054.zip tcl-50b90140ddeee58a28221cf9fe44c352f2d4b054.tar.gz tcl-50b90140ddeee58a28221cf9fe44c352f2d4b054.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..16a5bae 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.71 2008/04/07 15:23:10 rmax 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) { |