diff options
author | dgp <dgp@users.sourceforge.net> | 2008-01-10 16:09:22 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2008-01-10 16:09:22 (GMT) |
commit | c1ca08db8c81d3993594cb75b7ff33a35a9bd321 (patch) | |
tree | 4725991e79f7264b8778b2cad167b022eb6f19e6 /generic/tclStringObj.c | |
parent | 6adf6fbdbe0e957b34ece292a0c4dfa88a7c4c92 (diff) | |
download | tcl-c1ca08db8c81d3993594cb75b7ff33a35a9bd321.zip tcl-c1ca08db8c81d3993594cb75b7ff33a35a9bd321.tar.gz tcl-c1ca08db8c81d3993594cb75b7ff33a35a9bd321.tar.bz2 |
* generic/tclStringObj.c (Tcl_AppendFormatToObj): Correct failure to
* tests/format.test: account for big.used == 0 corner case in the
%ll(idox) format directives. [Bug 1867855].
Diffstat (limited to 'generic/tclStringObj.c')
-rw-r--r-- | generic/tclStringObj.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 1b39745..57b1669 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.68 2007/12/13 15:23:20 dgp Exp $ */ + * RCS: @(#) $Id: tclStringObj.c,v 1.69 2008/01/10 16:09:23 dgp Exp $ */ #include "tclInt.h" #include "tommath.h" @@ -2105,7 +2105,7 @@ Tcl_AppendFormatToObj( numDigits++; uw /= base; } - } else if (useBig) { + } else if (useBig && big.used) { int leftover = (big.used * DIGIT_BIT) % numBits; mp_digit mask = (~(mp_digit)0) << (DIGIT_BIT-leftover); @@ -2114,7 +2114,7 @@ Tcl_AppendFormatToObj( numDigits--; mask >>= numBits; } - } else { + } else if (!useBig) { unsigned long int ul = (unsigned long int) l; bits = (Tcl_WideUInt) ul; @@ -2138,7 +2138,7 @@ Tcl_AppendFormatToObj( while (numDigits--) { int digitOffset; - if (useBig) { + if (useBig && big.used) { if ((size_t) shift < CHAR_BIT*sizeof(Tcl_WideUInt) - DIGIT_BIT) { bits |= (((Tcl_WideUInt)big.dp[index++]) <<shift); |