summaryrefslogtreecommitdiffstats
path: root/generic/tclStringObj.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclStringObj.c')
-rw-r--r--generic/tclStringObj.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index 598a2e5..8c78f2b 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -1848,7 +1848,7 @@ Tcl_AppendFormatToObj(
char *end;
int gotMinus = 0, gotHash = 0, gotZero = 0, gotSpace = 0, gotPlus = 0;
int gotPrecision, sawFlag, useShort = 0, useBig = 0;
- Tcl_Size width, precision;
+ Tcl_WideInt width, precision;
#ifndef TCL_WIDE_INT_IS_LONG
int useWide = 0;
#endif
@@ -1964,12 +1964,12 @@ Tcl_AppendFormatToObj(
unsigned long long ull;
ull = strtoull(format, &end, 10);
/* Comparison is >=, not >, to leave room for nul */
- if (ull >= TCL_SIZE_MAX) {
+ if (ull >= WIDE_MAX) {
msg = overflow;
errCode = "OVERFLOW";
goto errorMsg;
}
- width = (Tcl_Size)ull;
+ width = (Tcl_WideInt)ull;
format = end;
step = TclUtfToUniChar(format, &ch);
} else if (ch == '*') {
@@ -1978,7 +1978,7 @@ Tcl_AppendFormatToObj(
errCode = gotXpg ? "INDEXRANGE" : "FIELDVARMISMATCH";
goto errorMsg;
}
- if (TclGetSizeIntFromObj(interp, objv[objIndex], &width) != TCL_OK) {
+ if (TclGetWideIntFromObj(interp, objv[objIndex], &width) != TCL_OK) {
goto error;
}
if (width < 0) {
@@ -2010,12 +2010,12 @@ Tcl_AppendFormatToObj(
unsigned long long ull;
ull = strtoull(format, &end, 10);
/* Comparison is >=, not >, to leave room for nul */
- if (ull >= TCL_SIZE_MAX) {
+ if (ull >= WIDE_MAX) {
msg = overflow;
errCode = "OVERFLOW";
goto errorMsg;
}
- precision = (Tcl_Size)ull;
+ precision = (Tcl_WideInt)ull;
format = end;
step = TclUtfToUniChar(format, &ch);
} else if (ch == '*') {
@@ -2024,7 +2024,7 @@ Tcl_AppendFormatToObj(
errCode = gotXpg ? "INDEXRANGE" : "FIELDVARMISMATCH";
goto errorMsg;
}
- if (TclGetSizeIntFromObj(interp, objv[objIndex], &precision)
+ if (TclGetWideIntFromObj(interp, objv[objIndex], &precision)
!= TCL_OK) {
goto error;
}
@@ -2471,16 +2471,14 @@ Tcl_AppendFormatToObj(
*p++ = '+';
}
if (width) {
- p += snprintf(
- p, TCL_INTEGER_SPACE, "%" TCL_SIZE_MODIFIER "d", width);
+ p += snprintf(p, TCL_INTEGER_SPACE, "%" TCL_LL_MODIFIER "d", width);
if (width > length) {
length = width;
}
}
if (gotPrecision) {
*p++ = '.';
- p += snprintf(
- p, TCL_INTEGER_SPACE, "%" TCL_SIZE_MODIFIER "d", precision);
+ p += snprintf(p, TCL_INTEGER_SPACE, "%" TCL_LL_MODIFIER "d", precision);
if (precision > TCL_SIZE_MAX - length) {
msg = overflow;
errCode = "OVERFLOW";