From c1ca08db8c81d3993594cb75b7ff33a35a9bd321 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 10 Jan 2008 16:09:22 +0000 Subject: * 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]. --- ChangeLog | 6 ++++++ generic/tclStringObj.c | 8 ++++---- tests/format.test | 6 +++++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 61eb727..532cd00 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-01-10 Don Porter + + * 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]. + 2008-01-09 George Peter Staplin * doc/vwait.n: add a missing be to fix a typo. 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++]) <