diff options
author | dgp <dgp@users.sourceforge.net> | 2006-05-04 12:34:37 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2006-05-04 12:34:37 (GMT) |
commit | d198e23f3d8b550060d865bfa1ac3972a070feec (patch) | |
tree | 924a385f237f2295aa51d8335ca9f18e50e50e33 /generic/tclExecute.c | |
parent | 62b016f354b81b1456905562d2c320154764d540 (diff) | |
download | tcl-d198e23f3d8b550060d865bfa1ac3972a070feec.zip tcl-d198e23f3d8b550060d865bfa1ac3972a070feec.tar.gz tcl-d198e23f3d8b550060d865bfa1ac3972a070feec.tar.bz2 |
* generic/tclExecute.c (ExprSrandFunc): Restore acceptance of wide
* tests/expr-old.test: integer values by srand() [Bug 1480509].
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r-- | generic/tclExecute.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 34e4ec1..4717ae2 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.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: tclExecute.c,v 1.94.2.18 2005/12/12 11:28:22 rmax Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.94.2.19 2006/05/04 12:34:38 dgp Exp $ */ #include "tclInt.h" @@ -5578,17 +5578,17 @@ ExprSrandFunc(interp, eePtr, clientData) } if (Tcl_GetLongFromObj(NULL, valuePtr, &i) != TCL_OK) { - /* - * At this point, the only other possible type is double - */ - Tcl_ResetResult(interp); - Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), - "can't use floating-point value as argument to srand", - (char *) NULL); + Tcl_WideInt w; + + if (Tcl_GetWideIntFromObj(interp, valuePtr, &w) != TCL_OK) { badValue: - TclDecrRefCount(valuePtr); - DECACHE_STACK_INFO(); - return TCL_ERROR; + Tcl_AddErrorInfo(interp, "\n (argument to \"srand()\")"); + TclDecrRefCount(valuePtr); + DECACHE_STACK_INFO(); + return TCL_ERROR; + } + + i = Tcl_WideAsLong(w); } /* |