diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-12-19 22:26:37 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-12-19 22:26:37 (GMT) |
commit | 14a974e2d0b4cef691c867645ea568f9c5add82d (patch) | |
tree | 48ea2eddf1c1b596c6f2fd2c708084a308b8381e | |
parent | 88e4842dfe272fa62dafad30ca1f11b396f06d71 (diff) | |
parent | 2a08be49c26032c93030a80bab9dd1fcd993bab8 (diff) | |
download | tcl-14a974e2d0b4cef691c867645ea568f9c5add82d.zip tcl-14a974e2d0b4cef691c867645ea568f9c5add82d.tar.gz tcl-14a974e2d0b4cef691c867645ea568f9c5add82d.tar.bz2 |
Merge 8.7. Exclude 4 test-cases in TCL_NO_DEPRECATED mode, because they are not supposed to work then
-rw-r--r-- | generic/tclUtil.c | 19 | ||||
-rw-r--r-- | tests/stringObj.test | 9 |
2 files changed, 9 insertions, 19 deletions
diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 659796e..7154898 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -3615,10 +3615,10 @@ TclFormatInt( * formatted characters are written. */ Tcl_WideInt n) /* The integer to format. */ { - Tcl_WideInt intVal; + Tcl_WideUInt intVal; int i; int numFormatted, j; - const char *digits = "0123456789"; + static const char digits[] = "0123456789"; /* * Check first whether "n" is zero. @@ -3631,27 +3631,16 @@ TclFormatInt( } /* - * Check whether "n" is the maximum negative value. This is -2^(m-1) for - * an m-bit word, and has no positive equivalent; negating it produces the - * same value. - */ - - intVal = -n; /* [Bug 3390638] Workaround for*/ - if (n == -n || intVal == n) { /* broken compiler optimizers. */ - return sprintf(buffer, "%" TCL_LL_MODIFIER "d", n); - } - - /* * Generate the characters of the result backwards in the buffer. */ - intVal = (n < 0? -n : n); + intVal = (n < 0 ? -(Tcl_WideUInt)n : (Tcl_WideUInt)n); i = 0; buffer[0] = '\0'; do { i++; buffer[i] = digits[intVal % 10]; - intVal = intVal/10; + intVal = intVal / 10; } while (intVal > 0); if (n < 0) { i++; diff --git a/tests/stringObj.test b/tests/stringObj.test index 8b10897..3779bca 100644 --- a/tests/stringObj.test +++ b/tests/stringObj.test @@ -24,6 +24,7 @@ testConstraint testobj [llength [info commands testobj]] testConstraint testbytestring [llength [info commands testbytestring]] testConstraint testdstring [llength [info commands testdstring]] testConstraint tip389 [expr {[string length \U010000] == 2}] +testConstraint nodep [info exists tcl_precision] test stringObj-1.1 {string type registration} testobj { set t [testobj types] @@ -465,19 +466,19 @@ test stringObj-15.4 {Tcl_Append*ToObj: self appends} testobj { teststringobj set 1 foo teststringobj appendself 1 3 } foo -test stringObj-15.5 {Tcl_Append*ToObj: self appends} {testobj tip389} { +test stringObj-15.5 {Tcl_Append*ToObj: self appends} {testobj tip389 nodep} { teststringobj set 1 foo teststringobj appendself2 1 0 } foofoo -test stringObj-15.6 {Tcl_Append*ToObj: self appends} {testobj tip389} { +test stringObj-15.6 {Tcl_Append*ToObj: self appends} {testobj tip389 nodep} { teststringobj set 1 foo teststringobj appendself2 1 1 } foooo -test stringObj-15.7 {Tcl_Append*ToObj: self appends} {testobj tip389} { +test stringObj-15.7 {Tcl_Append*ToObj: self appends} {testobj tip389 nodep} { teststringobj set 1 foo teststringobj appendself2 1 2 } fooo -test stringObj-15.8 {Tcl_Append*ToObj: self appends} {testobj tip389} { +test stringObj-15.8 {Tcl_Append*ToObj: self appends} {testobj tip389 nodep} { teststringobj set 1 foo teststringobj appendself2 1 3 } foo |