diff options
author | dgp <dgp@users.sourceforge.net> | 2017-04-06 11:53:51 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2017-04-06 11:53:51 (GMT) |
commit | 5c21b9c7c7e7f6442ed8b09ce672495f60df5e87 (patch) | |
tree | 86ebc9565171af2239d110260fac0c03b487a852 /generic/tclScan.c | |
parent | 2b692ce09cb4adf6313d2aefeb9fa00093996484 (diff) | |
parent | 44de3dd8dad74f8031286f0750738099156cef0c (diff) | |
download | tcl-5c21b9c7c7e7f6442ed8b09ce672495f60df5e87.zip tcl-5c21b9c7c7e7f6442ed8b09ce672495f60df5e87.tar.gz tcl-5c21b9c7c7e7f6442ed8b09ce672495f60df5e87.tar.bz2 |
merge trunk
Diffstat (limited to 'generic/tclScan.c')
-rw-r--r-- | generic/tclScan.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/generic/tclScan.c b/generic/tclScan.c index 735cd15..ed6c195 100644 --- a/generic/tclScan.c +++ b/generic/tclScan.c @@ -10,6 +10,7 @@ */ #include "tclInt.h" +#include "tommath.h" /* * Flag values used by Tcl_ScanObjCmd. @@ -415,14 +416,7 @@ ValidateFormat( case 'x': case 'X': case 'b': - break; case 'u': - if (flags & SCAN_BIG) { - Tcl_SetObjResult(interp, Tcl_NewStringObj( - "unsigned bignum scans are invalid", -1)); - Tcl_SetErrorCode(interp, "TCL", "FORMAT", "BADUNSIGNED",NULL); - goto error; - } break; /* * Bracket terms need special checking @@ -936,7 +930,18 @@ Tcl_ScanObjCmd( } else { Tcl_SetWideIntObj(objPtr, wideValue); } - } else if (!(flags & SCAN_BIG)) { + } else if (flags & SCAN_BIG) { + if (flags & SCAN_UNSIGNED) { + mp_int big; + if ((Tcl_GetBignumFromObj(interp, objPtr, &big) != TCL_OK) + || (mp_cmp_d(&big, 0) == MP_LT)) { + Tcl_SetObjResult(interp, Tcl_NewStringObj( + "unsigned bignum scans are invalid", -1)); + Tcl_SetErrorCode(interp, "TCL", "FORMAT", "BADUNSIGNED",NULL); + return TCL_ERROR; + } + } + } else { if (TclGetLongFromObj(NULL, objPtr, &value) != TCL_OK) { if (TclGetString(objPtr)[0] == '-') { value = LONG_MIN; |