diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2018-12-26 15:04:16 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2018-12-26 15:04:16 (GMT) |
commit | 59eeb967a221a65eafeceea7460f438892396ef7 (patch) | |
tree | 4f2796040b1c60486b26aa2ac3853f95d971c685 /generic/tclStringObj.c | |
parent | 50b5581156fef0c05550efc25526d3ffeac13523 (diff) | |
download | tcl-59eeb967a221a65eafeceea7460f438892396ef7.zip tcl-59eeb967a221a65eafeceea7460f438892396ef7.tar.gz tcl-59eeb967a221a65eafeceea7460f438892396ef7.tar.bz2 |
Many internal int -> size_t increases, so string lengths > 2Gb can be handled correctly in many more places.
Diffstat (limited to 'generic/tclStringObj.c')
-rw-r--r-- | generic/tclStringObj.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 4ca7b62..715dbc1 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2078,7 +2078,7 @@ Tcl_AppendFormatToObj( switch (ch) { case 'd': { - int length; + size_t length; Tcl_Obj *pure; const char *bytes; @@ -2113,10 +2113,10 @@ Tcl_AppendFormatToObj( */ if (gotPrecision) { - if (length < precision) { + if (length < (size_t)precision) { segmentLimit -= precision - length; } - while (length < precision) { + while (length < (size_t)precision) { Tcl_AppendToObj(segment, "0", 1); length++; } @@ -2124,10 +2124,10 @@ Tcl_AppendFormatToObj( } if (gotZero) { length += Tcl_GetCharLength(segment); - if (length < width) { + if (length < (size_t)width) { segmentLimit -= width - length; } - while (length < width) { + while (length < (size_t)width) { Tcl_AppendToObj(segment, "0", 1); length++; } @@ -2150,7 +2150,8 @@ Tcl_AppendFormatToObj( case 'b': { Tcl_WideUInt bits = 0; Tcl_WideInt numDigits = 0; - int length, numBits = 4, base = 16, index = 0, shift = 0; + int numBits = 4, base = 16, index = 0, shift = 0; + size_t length; Tcl_Obj *pure; char *bytes; @@ -2244,10 +2245,10 @@ Tcl_AppendFormatToObj( mp_clear(&big); } if (gotPrecision) { - if (length < precision) { + if (length < (size_t)precision) { segmentLimit -= precision - length; } - while (length < precision) { + while (length < (size_t)precision) { Tcl_AppendToObj(segment, "0", 1); length++; } @@ -2255,10 +2256,10 @@ Tcl_AppendFormatToObj( } if (gotZero) { length += Tcl_GetCharLength(segment); - if (length < width) { + if (length < (size_t)width) { segmentLimit -= width - length; } - while (length < width) { + while (length < (size_t)width) { Tcl_AppendToObj(segment, "0", 1); length++; } |