From 9222d1cf0d56f0b84b3645f54e0b1422ba7f4b30 Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 23 Aug 2001 14:22:49 +0000 Subject: Fixed annoying fault in [binary format] on 64-bit architectures. --- ChangeLog | 5 +++++ generic/tclBinary.c | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2b0bb9a..b44769a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2001-08-23 Donal K. Fellows + * generic/tclBinary.c (FormatNumber): Extract a long from the + object and not an int, to stop [binary format] from being unable + to format some input numbers on architectures where sizeof(int) is + less than sizeof(long) (particularly Alpha.) [Bug #441861] + * tests/format.test: Converted conditional execution of tests into a test constraint. diff --git a/generic/tclBinary.c b/generic/tclBinary.c index e0facb5..9fd9f4d 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclBinary.c,v 1.7 2001/04/04 16:07:20 kennykb Exp $ + * RCS: @(#) $Id: tclBinary.c,v 1.8 2001/08/23 14:22:49 dkf Exp $ */ #include @@ -1393,7 +1393,7 @@ FormatNumber(interp, type, src, cursorPtr) Tcl_Obj *src; /* Number to format. */ unsigned char **cursorPtr; /* Pointer to index into destination buffer. */ { - int value; + long value; double dvalue; if ((type == 'd') || (type == 'f')) { @@ -1426,7 +1426,7 @@ FormatNumber(interp, type, src, cursorPtr) *cursorPtr += sizeof(float); } } else { - if (Tcl_GetIntFromObj(interp, src, &value) != TCL_OK) { + if (Tcl_GetLongFromObj(interp, src, &value) != TCL_OK) { return TCL_ERROR; } if (type == 'c') { -- cgit v0.12