diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-04-05 09:09:20 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-04-05 09:09:20 (GMT) |
commit | 19719bf57ffd63ee7e01c539197f59c3e40c3e55 (patch) | |
tree | bc483abe6a64177bc46c4a717b7a698fa285ebd2 /generic/tclStringObj.c | |
parent | 85397cf8937ee6f25ceee8ab9e8d65d79bda8894 (diff) | |
parent | ea8cb9b7bbc9be827be479c3aad3700cbe5774a4 (diff) | |
download | tcl-19719bf57ffd63ee7e01c539197f59c3e40c3e55.zip tcl-19719bf57ffd63ee7e01c539197f59c3e40c3e55.tar.gz tcl-19719bf57ffd63ee7e01c539197f59c3e40c3e55.tar.bz2 |
Fix [4b12ccb3363e81b132e8dbe12aeec596102be1a8|4b12ccb336]: format/scan %llu doesn't work. Also added new test-cases showing the expected behavior.
Diffstat (limited to 'generic/tclStringObj.c')
-rw-r--r-- | generic/tclStringObj.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 560c169..e51b98a 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -1939,11 +1939,6 @@ Tcl_AppendFormatToObj( } case 'u': - if (useBig) { - msg = "unsigned bignum format is invalid"; - errCode = "BADUNSIGNED"; - goto errorMsg; - } case 'd': case 'o': case 'p': @@ -1967,6 +1962,15 @@ 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) { |