diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2005-09-27 15:44:12 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2005-09-27 15:44:12 (GMT) |
commit | ab78f85f8a8340b911e2c6a3090c05ded30eb825 (patch) | |
tree | 5f0f89707e324dd57715ae9e0334f366372a802b /generic/tclBinary.c | |
parent | 3b758e2b4a8ff0cf42f0ac29512d0130bf17f5c3 (diff) | |
download | tcl-ab78f85f8a8340b911e2c6a3090c05ded30eb825.zip tcl-ab78f85f8a8340b911e2c6a3090c05ded30eb825.tar.gz tcl-ab78f85f8a8340b911e2c6a3090c05ded30eb825.tar.bz2 |
Fix [Bug 1116542]
Diffstat (limited to 'generic/tclBinary.c')
-rw-r--r-- | generic/tclBinary.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/generic/tclBinary.c b/generic/tclBinary.c index 546a35b..cf83b99 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.13.2.2 2003/12/17 18:38:28 das Exp $ + * RCS: @(#) $Id: tclBinary.c,v 1.13.2.3 2005/09/27 15:44:13 dkf Exp $ */ #include "tclInt.h" @@ -53,6 +53,8 @@ static void DupByteArrayInternalRep _ANSI_ARGS_((Tcl_Obj *srcPtr, Tcl_Obj *copyPtr)); static int FormatNumber _ANSI_ARGS_((Tcl_Interp *interp, int type, Tcl_Obj *src, unsigned char **cursorPtr)); +static void CopyNumber _ANSI_ARGS_((CONST VOID *from, VOID *to, + unsigned int length)); static void FreeByteArrayInternalRep _ANSI_ARGS_((Tcl_Obj *objPtr)); static int GetFormatSpec _ANSI_ARGS_((char **formatPtr, char *cmdPtr, int *countPtr)); @@ -1461,7 +1463,11 @@ FormatNumber(interp, type, src, cursorPtr) return TCL_ERROR; } if (type == 'd') { - memcpy((VOID *) *cursorPtr, (VOID *) &dvalue, sizeof(double)); + /* + * Can't just memcpy() here. [Bug 1116542] + */ + + CopyNumber(&dvalue, *cursorPtr, sizeof(double)); *cursorPtr += sizeof(double); } else { float fvalue; @@ -1538,6 +1544,16 @@ FormatNumber(interp, type, src, cursorPtr) } } +/* Ugly workaround for old and broken compiler! */ +static void +CopyNumber(from, to, length) + CONST VOID *from; + VOID *to; + unsigned int length; +{ + memcpy(to, from, length); +} + /* *---------------------------------------------------------------------- * |