summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2003-02-21 21:54:09 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2003-02-21 21:54:09 (GMT)
commitd1d1ade757f71ccd5e5be666a7778ae905b351eb (patch)
tree2b1952a79ca322fc842bedef915b3821fb6ffbf8 /generic
parent73126af737ee9804ffed26a31c476a9fd50074c2 (diff)
downloadtcl-d1d1ade757f71ccd5e5be666a7778ae905b351eb.zip
tcl-d1d1ade757f71ccd5e5be666a7778ae905b351eb.tar.gz
tcl-d1d1ade757f71ccd5e5be666a7778ae905b351eb.tar.bz2
Stopped sign-bit propagation in [binary scan] of wide values. [Bug #690774]
Diffstat (limited to 'generic')
-rw-r--r--generic/tclBinary.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/generic/tclBinary.c b/generic/tclBinary.c
index c8ff568..4dfb505 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.12 2002/02/15 14:28:48 dkf Exp $
+ * RCS: @(#) $Id: tclBinary.c,v 1.13 2003/02/21 21:54:11 dkf Exp $
*/
#include "tclInt.h"
@@ -1588,7 +1588,7 @@ ScanNumber(buffer, type, numberCachePtrPtr)
* different numbers have been scanned. */
{
long value;
- Tcl_WideInt wvalue;
+ Tcl_WideUInt uwvalue;
/*
* We cannot rely on the compiler to properly sign extend integer values
@@ -1678,25 +1678,25 @@ ScanNumber(buffer, type, numberCachePtrPtr)
}
}
case 'w':
- value = (long) (buffer[4]
- | (buffer[5] << 8)
- | (buffer[6] << 16)
- | (buffer[7] << 24));
- wvalue = ((Tcl_WideInt) value) << 32 | (buffer[0]
- | (buffer[1] << 8)
- | (buffer[2] << 16)
- | (buffer[3] << 24));
- return Tcl_NewWideIntObj(wvalue);
+ uwvalue = ((Tcl_WideUInt) buffer[0])
+ | (((Tcl_WideUInt) buffer[1]) << 8)
+ | (((Tcl_WideUInt) buffer[2]) << 16)
+ | (((Tcl_WideUInt) buffer[3]) << 24)
+ | (((Tcl_WideUInt) buffer[4]) << 32)
+ | (((Tcl_WideUInt) buffer[5]) << 40)
+ | (((Tcl_WideUInt) buffer[6]) << 48)
+ | (((Tcl_WideUInt) buffer[7]) << 56);
+ return Tcl_NewWideIntObj((Tcl_WideInt) uwvalue);
case 'W':
- value = (long) (buffer[3]
- | (buffer[2] << 8)
- | (buffer[1] << 16)
- | (buffer[0] << 24));
- wvalue = ((Tcl_WideInt) value) << 32 | (buffer[7]
- | (buffer[6] << 8)
- | (buffer[5] << 16)
- | (buffer[4] << 24));
- return Tcl_NewWideIntObj(wvalue);
+ uwvalue = ((Tcl_WideUInt) buffer[7])
+ | (((Tcl_WideUInt) buffer[6]) << 8)
+ | (((Tcl_WideUInt) buffer[5]) << 16)
+ | (((Tcl_WideUInt) buffer[4]) << 24)
+ | (((Tcl_WideUInt) buffer[3]) << 32)
+ | (((Tcl_WideUInt) buffer[2]) << 40)
+ | (((Tcl_WideUInt) buffer[1]) << 48)
+ | (((Tcl_WideUInt) buffer[0]) << 56);
+ return Tcl_NewWideIntObj((Tcl_WideInt) uwvalue);
case 'f': {
float fvalue;
memcpy((VOID *) &fvalue, (VOID *) buffer, sizeof(float));