summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--generic/tclExecute.c22
-rw-r--r--tests/expr-old.test4
3 files changed, 19 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 9824064..67d49bd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-05-04 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tclExecute.c (ExprSrandFunc): Restore acceptance of wide
+ * tests/expr-old.test: integer values by srand() [Bug 1480509].
+
2006-04-12 Don Porter <dgp@users.sourceforge.net>
*** 8.4.13 TAGGED FOR RELEASE ***
@@ -1365,7 +1370,7 @@
* generic/tclUtil.c (TclGetIntForIndex): intreps of numeric types
with simpler calls of Tcl_GetIntFromObj and Tcl_GetLongFromObj,
now that those routines are better behaved wrt shimmering.
- [Patch 1177219]
+ [Patch 1177129]
2005-03-29 Jeff Hobbs <jeffh@ActiveState.com>
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);
}
/*
diff --git a/tests/expr-old.test b/tests/expr-old.test
index 684ec01..85e346a 100644
--- a/tests/expr-old.test
+++ b/tests/expr-old.test
@@ -13,7 +13,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: expr-old.test,v 1.16.2.4 2005/11/01 16:18:16 dgp Exp $
+# RCS: @(#) $Id: expr-old.test,v 1.16.2.5 2006/05/04 12:34:39 dgp Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2.1
@@ -811,7 +811,7 @@ test expr-old-32.47 {math functions in expressions} {
} {1 {too few arguments for math function}}
test expr-old-32.48 {math functions in expressions} {
list [catch {expr srand(3.79)} msg] $msg
-} {1 {can't use floating-point value as argument to srand}}
+} {1 {expected integer but got "3.79"}}
test expr-old-32.49 {math functions in expressions} {
list [catch {expr srand("")} msg] $msg
} {1 {argument to math function didn't have numeric value}}