summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2017-04-12 13:15:39 (GMT)
committerdgp <dgp@users.sourceforge.net>2017-04-12 13:15:39 (GMT)
commit59f0c070d62204e43e5d39d6810a444218ebebb1 (patch)
treec5a9e0ad2576f39258b4e7e9b5409ca6052b1bb0 /generic
parent50a2019b617635acbfc1c91b00f41d57f61e1fa1 (diff)
parentbc97ae8a02bb8363f85b25501b9aa125c5b344cd (diff)
downloadtcl-59f0c070d62204e43e5d39d6810a444218ebebb1.zip
tcl-59f0c070d62204e43e5d39d6810a444218ebebb1.tar.gz
tcl-59f0c070d62204e43e5d39d6810a444218ebebb1.tar.bz2
Revert recent commit. TIP 237 is clear that %llu is invalid.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclScan.c21
-rw-r--r--generic/tclStringObj.c14
2 files changed, 13 insertions, 22 deletions
diff --git a/generic/tclScan.c b/generic/tclScan.c
index 5ea7e46..3edb8be 100644
--- a/generic/tclScan.c
+++ b/generic/tclScan.c
@@ -10,7 +10,6 @@
*/
#include "tclInt.h"
-#include "tommath.h"
/*
* Flag values used by Tcl_ScanObjCmd.
@@ -416,7 +415,14 @@ 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
@@ -930,18 +936,7 @@ Tcl_ScanObjCmd(
} else {
Tcl_SetWideIntObj(objPtr, wideValue);
}
- } 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 {
+ } else if (!(flags & SCAN_BIG)) {
if (TclGetLongFromObj(NULL, objPtr, &value) != TCL_OK) {
if (TclGetString(objPtr)[0] == '-') {
value = LONG_MIN;
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index e51b98a..560c169 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -1939,6 +1939,11 @@ Tcl_AppendFormatToObj(
}
case 'u':
+ if (useBig) {
+ msg = "unsigned bignum format is invalid";
+ errCode = "BADUNSIGNED";
+ goto errorMsg;
+ }
case 'd':
case 'o':
case 'p':
@@ -1962,15 +1967,6 @@ Tcl_AppendFormatToObj(
goto error;
}
isNegative = (mp_cmp_d(&big, 0) == MP_LT);
- if (ch == 'u') {
- if (isNegative) {
- msg = "unsigned bignum format is invalid";
- errCode = "BADUNSIGNED";
- goto errorMsg;
- } else {
- ch = 'd';
- }
- }
#ifndef TCL_WIDE_INT_IS_LONG
} else if (useWide) {
if (Tcl_GetWideIntFromObj(NULL, segment, &w) != TCL_OK) {