summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2010-12-01 16:28:00 (GMT)
committerKevin B Kenny <kennykb@acm.org>2010-12-01 16:28:00 (GMT)
commit6c7ac341739cf01e0a6a385687b55339aa48e1eb (patch)
tree3250721d903de692e0288f305ca991dca2a056b2
parent627e4077fec79059bce211956e1fbbc3905fb8b6 (diff)
downloadtcl-6c7ac341739cf01e0a6a385687b55339aa48e1eb.zip
tcl-6c7ac341739cf01e0a6a385687b55339aa48e1eb.tar.gz
tcl-6c7ac341739cf01e0a6a385687b55339aa48e1eb.tar.bz2
* generic/tclStrToD.c (SetPrecisionLimits, TclDoubleDigits):
Added meaningless initialization of 'i', 'ilim' and 'ilim1' to silence warnings from the C compiler about possible use of uninitialized variables, Added a panic to the 'switch' that assigns them, to assert that the 'default' case is impossible. [Bug 3124675]
-rw-r--r--ChangeLog9
-rwxr-xr-xgeneric/tclStrToD.c15
2 files changed, 20 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 1a0f605..d864934 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-12-01 Kevin B. Kenny <kennykb@acm.org>
+
+ * generic/tclStrToD.c (SetPrecisionLimits, TclDoubleDigits):
+ Added meaningless initialization of 'i', 'ilim' and 'ilim1'
+ to silence warnings from the C compiler about possible use of
+ uninitialized variables, Added a panic to the 'switch' that
+ assigns them, to assert that the 'default' case is impossible.
+ [Bug 3124675]
+
2010-12-01 Jan Nijtmans <nijtmans@users.sf.net>
* generic/tclBasic.c: fix gcc 64-bit warnings: cast from pointer to
diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c
index 983aeec..8626962 100755
--- a/generic/tclStrToD.c
+++ b/generic/tclStrToD.c
@@ -14,7 +14,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclStrToD.c,v 1.49 2010/12/01 09:58:51 nijtmans Exp $
+ * RCS: @(#) $Id: tclStrToD.c,v 1.50 2010/12/01 16:28:00 kennykb Exp $
*
*----------------------------------------------------------------------
*/
@@ -2405,6 +2405,11 @@ SetPrecisionLimits(int convType,
*iPtr = 1;
}
break;
+ default:
+ *iPtr = -1;
+ *iLimPtr = -1;
+ *iLim1Ptr = -1;
+ Tcl_Panic("impossible conversion type in TclDoubleDigits");
}
}
@@ -3915,7 +3920,7 @@ StrictBignumConversion(Double* dPtr,
* empty precision.
*/
- /* Extract the next digit */
+ /* Extract the next group of digits */
mp_div(&b, &S, &dig, &b);
if (dig.used > 1) {
@@ -4054,9 +4059,11 @@ TclDoubleDigits(double dv, /* Number to convert */
* power of ten that k must be checked */
int b2, b5, s2, s5; /* Powers of 2 and 5 in the numerator and
* denominator of intermediate results */
- int ilim, ilim1;
+ int ilim = -1, ilim1 = -1; /* Number of digits to convert, and number
+ * to convert if log10(d) has been
+ * overestimated */
char* retval; /* Return value from this function */
- int i;
+ int i = -1;
/* Put the input number into a union for bit-whacking */