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 | b7704f4643daab2ba9d0a5a4aa3b904720ded05a (patch) | |
tree | 924a385f237f2295aa51d8335ca9f18e50e50e33 /generic/tclExecute.c | |
parent | 1b572d3904ba2a6e52219627f7e2f6c1c1486552 (diff) | |
download | tcl-b7704f4643daab2ba9d0a5a4aa3b904720ded05a.zip tcl-b7704f4643daab2ba9d0a5a4aa3b904720ded05a.tar.gz tcl-b7704f4643daab2ba9d0a5a4aa3b904720ded05a.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); } /* |