diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-04-05 08:41:48 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-04-05 08:41:48 (GMT) |
commit | 224849c744f0f6ceb853162afd318b858835850c (patch) | |
tree | 679b353959d9797b0c59459c42491f6326c65a9d /generic/tclStringObj.c | |
parent | fa5016d63742a4a0c36eaa0dd9f17fd818123cf5 (diff) | |
download | tcl-224849c744f0f6ceb853162afd318b858835850c.zip tcl-224849c744f0f6ceb853162afd318b858835850c.tar.gz tcl-224849c744f0f6ceb853162afd318b858835850c.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 4e19750..6cce073 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -1943,11 +1943,6 @@ Tcl_AppendFormatToObj( } case 'u': - if (useBig) { - msg = "unsigned bignum format is invalid"; - errCode = "BADUNSIGNED"; - goto errorMsg; - } case 'd': case 'o': case 'x': @@ -1965,6 +1960,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) { |