diff options
author | dgp <dgp@users.sourceforge.net> | 2004-09-10 22:43:52 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2004-09-10 22:43:52 (GMT) |
commit | 2bf5c9afb7a6d5c46fa6cd07daee643a5cace78e (patch) | |
tree | ef24c31e1adaed741b65c3c827e8a23c1e4e23d2 /generic/tclObj.c | |
parent | 212dd67a70fdd160d083c931fa372186d45319ce (diff) | |
download | tcl-2bf5c9afb7a6d5c46fa6cd07daee643a5cace78e.zip tcl-2bf5c9afb7a6d5c46fa6cd07daee643a5cace78e.tar.gz tcl-2bf5c9afb7a6d5c46fa6cd07daee643a5cace78e.tar.bz2 |
Minor mods to latest commit to correct bugs and compiler warnings on
TCL_WIDE_INT_IS_LONG platforms.
Diffstat (limited to 'generic/tclObj.c')
-rw-r--r-- | generic/tclObj.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/generic/tclObj.c b/generic/tclObj.c index 1c23c8b..7c9fb47 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclObj.c,v 1.64 2004/09/10 21:29:42 dkf Exp $ + * RCS: @(#) $Id: tclObj.c,v 1.65 2004/09/10 22:43:52 dgp Exp $ */ #include "tclInt.h" @@ -1911,8 +1911,7 @@ Tcl_GetIntFromObj(interp, objPtr, intPtr) register Tcl_Obj *objPtr; /* The object from which to get a int. */ register int *intPtr; /* Place to store resulting int. */ { - register long l; - Tcl_WideInt w; + register long l = 0; int result; /* If the object isn't already an integer of any width, try to @@ -1931,11 +1930,10 @@ Tcl_GetIntFromObj(interp, objPtr, intPtr) if ( objPtr->typePtr == &tclIntType ) { l = objPtr->internalRep.longValue; + } else if ( objPtr->typePtr == &tclWideIntType ) { #ifndef TCL_WIDE_INT_IS_LONG - } else if ( objPtr->typePtr == &tclWideIntType ) { - /* * If the object is already a wide integer, don't convert it. * This code allows for any integer in the range -ULONG_MAX to @@ -1944,7 +1942,7 @@ Tcl_GetIntFromObj(interp, objPtr, intPtr) * integers on input, but avoids inadvertent demotion of * wide integers to 32-bit ones in the internal rep. */ - w = objPtr->internalRep.wideValue; + Tcl_WideInt w = objPtr->internalRep.wideValue; if ( w >= -(Tcl_WideInt)(ULONG_MAX) && w <= (Tcl_WideInt)(ULONG_MAX) ) { l = Tcl_WideAsLong( w ); @@ -1952,6 +1950,10 @@ Tcl_GetIntFromObj(interp, objPtr, intPtr) goto tooBig; } +#else + + l = objPtr->internalRep.longValue; + #endif } else { @@ -1962,7 +1964,9 @@ Tcl_GetIntFromObj(interp, objPtr, intPtr) *intPtr = (int)objPtr->internalRep.longValue; return TCL_OK; } +#ifndef TCL_WIDE_INT_IS_LONG tooBig: +#endif if (interp != NULL) { Tcl_ResetResult(interp); Tcl_AppendToObj(Tcl_GetObjResult(interp), @@ -2368,7 +2372,6 @@ Tcl_GetLongFromObj(interp, objPtr, longPtr) register long *longPtr; /* Place to store resulting long. */ { register int result; - Tcl_WideInt w; if ( objPtr->typePtr != &tclIntType && objPtr->typePtr != &tclWideIntType ) { @@ -2389,7 +2392,7 @@ Tcl_GetLongFromObj(interp, objPtr, longPtr) * integers on input, but avoids inadvertent demotion of * wide integers to 32-bit ones in the internal rep. */ - w = objPtr->internalRep.wideValue; + Tcl_WideInt w = objPtr->internalRep.wideValue; if ( w >= -(Tcl_WideInt)(ULONG_MAX) && w <= (Tcl_WideInt)(ULONG_MAX) ) { *longPtr = Tcl_WideAsLong( w ); |