summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2006-05-04 12:55:49 (GMT)
committerdgp <dgp@users.sourceforge.net>2006-05-04 12:55:49 (GMT)
commit71536416ed0e6ce72d256d64c61ac0ecf23df29e (patch)
treecba1f9b31b18f6794aa9c4098ddb6bd320e4d2d6 /generic
parent2840d97d6aed2d51eb86b9f7ebde9e0f328de61d (diff)
downloadtcl-71536416ed0e6ce72d256d64c61ac0ecf23df29e.zip
tcl-71536416ed0e6ce72d256d64c61ac0ecf23df29e.tar.gz
tcl-71536416ed0e6ce72d256d64c61ac0ecf23df29e.tar.bz2
* generic/tclBasic.c (ExprSrandFunc): Restore acceptance of wide/big
* doc/mathfunc.n: integer values by srand() [Bug 1480509].
Diffstat (limited to 'generic')
-rw-r--r--generic/tclBasic.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 511258f..caffa5f 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -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: tclBasic.c,v 1.193 2006/03/06 21:56:34 dgp Exp $
+ * RCS: @(#) $Id: tclBasic.c,v 1.194 2006/05/04 12:55:49 dgp Exp $
*/
#include "tclInt.h"
@@ -5677,9 +5677,20 @@ ExprSrandFunc(
return TCL_ERROR;
}
- if (Tcl_GetLongFromObj(interp, objv[1], &i) != TCL_OK) {
- /* TODO: more ::errorInfo here? or in caller? */
- return TCL_ERROR;
+ if (Tcl_GetLongFromObj(NULL, objv[1], &i) != TCL_OK) {
+ Tcl_Obj *objPtr;
+ mp_int big;
+
+ if (Tcl_GetBignumFromObj(interp, objv[1], &big) != TCL_OK) {
+ /* TODO: more ::errorInfo here? or in caller? */
+ return TCL_ERROR;
+ }
+
+ mp_mod_2d(&big, (int) CHAR_BIT * sizeof(long), &big);
+ objPtr = Tcl_NewBignumObj(&big);
+ Tcl_IncrRefCount(objPtr);
+ Tcl_GetLongFromObj(NULL, objPtr, &i);
+ Tcl_DecrRefCount(objPtr);
}
/*