diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-05-31 14:39:39 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-05-31 14:39:39 (GMT) |
| commit | 5c6b7dbf18cbb7a2ecb9a064790d175411e9b066 (patch) | |
| tree | 49515209775f5b48d1ad8fe776b09f4b5d5dc65d /generic/tclStringObj.c | |
| parent | d583a8f017ac344a3885545b94db1bdaf2f89913 (diff) | |
| parent | 9a09623d6c548e978f082f7c44503299747680c1 (diff) | |
| download | tcl-5c6b7dbf18cbb7a2ecb9a064790d175411e9b066.zip tcl-5c6b7dbf18cbb7a2ecb9a064790d175411e9b066.tar.gz tcl-5c6b7dbf18cbb7a2ecb9a064790d175411e9b066.tar.bz2 | |
Rebase to 9.0
Diffstat (limited to 'generic/tclStringObj.c')
| -rw-r--r-- | generic/tclStringObj.c | 34 |
1 files changed, 8 insertions, 26 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 827c227..c29d964 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -1875,9 +1875,7 @@ Tcl_AppendFormatToObj( int gotMinus = 0, gotHash = 0, gotZero = 0, gotSpace = 0, gotPlus = 0; int gotPrecision, sawFlag, useShort = 0, useBig = 0; Tcl_WideInt width, precision; -#ifndef TCL_WIDE_INT_IS_LONG int useWide = 0; -#endif int newXpg, allocSegment = 0; Tcl_Size numChars, segmentLimit, segmentNumBytes; Tcl_Obj *segment; @@ -2082,18 +2080,14 @@ Tcl_AppendFormatToObj( useBig = 1; format += step; step = TclUtfToUniChar(format, &ch); -#ifndef TCL_WIDE_INT_IS_LONG } else { useWide = 1; -#endif } } else if (ch == 'I') { if ((format[1] == '6') && (format[2] == '4')) { format += (step + 2); step = TclUtfToUniChar(format, &ch); -#ifndef TCL_WIDE_INT_IS_LONG useWide = 1; -#endif } else if ((format[1] == '3') && (format[2] == '2')) { format += (step + 2); step = TclUtfToUniChar(format, &ch); @@ -2104,17 +2098,13 @@ Tcl_AppendFormatToObj( } else if ((ch == 'q') || (ch == 'j')) { format += step; step = TclUtfToUniChar(format, &ch); -#ifndef TCL_WIDE_INT_IS_LONG useWide = 1; -#endif } else if ((ch == 't') || (ch == 'z')) { format += step; step = TclUtfToUniChar(format, &ch); -#ifndef TCL_WIDE_INT_IS_LONG if (sizeof(void *) > sizeof(int)) { useWide = 1; } -#endif } else if (ch == 'L') { format += step; step = TclUtfToUniChar(format, &ch); @@ -2180,17 +2170,15 @@ Tcl_AppendFormatToObj( case 'b': { short s = 0; /* Silence compiler warning; only defined and * used when useShort is true. */ - long l; + int l; Tcl_WideInt w; mp_int big; int isNegative = 0; Tcl_Size toAppend; -#ifndef TCL_WIDE_INT_IS_LONG if ((ch == 'p') && (sizeof(void *) > sizeof(int))) { useWide = 1; } -#endif if (useBig) { int cmpResult; if (Tcl_GetBignumFromObj(interp, segment, &big) != TCL_OK) { @@ -2211,7 +2199,6 @@ Tcl_AppendFormatToObj( ch = 'd'; } } -#ifndef TCL_WIDE_INT_IS_LONG } else if (useWide) { if (TclGetWideBitsFromObj(interp, segment, &w) != TCL_OK) { goto error; @@ -2220,12 +2207,11 @@ Tcl_AppendFormatToObj( if (w == (Tcl_WideInt) 0) { gotHash = 0; } -#endif - } else if (TclGetLongFromObj(NULL, segment, &l) != TCL_OK) { + } else if (TclGetIntFromObj(NULL, segment, &l) != TCL_OK) { if (TclGetWideBitsFromObj(interp, segment, &w) != TCL_OK) { goto error; } else { - l = (long) w; + l = (int) w; } if (useShort) { s = (short) l; @@ -2234,8 +2220,8 @@ Tcl_AppendFormatToObj( gotHash = 0; } } else { - isNegative = (l < (long) 0); - if (l == (long) 0) { + isNegative = (l < (int) 0); + if (l == (int) 0) { gotHash = 0; } } @@ -2246,8 +2232,8 @@ Tcl_AppendFormatToObj( gotHash = 0; } } else { - isNegative = (l < (long) 0); - if (l == (long) 0) { + isNegative = (l < (int) 0); + if (l == (int) 0) { gotHash = 0; } } @@ -2294,10 +2280,8 @@ Tcl_AppendFormatToObj( if (useShort) { TclNewIntObj(pure, s); -#ifndef TCL_WIDE_INT_IS_LONG } else if (useWide) { TclNewIntObj(pure, w); -#endif } else if (useBig) { pure = Tcl_NewBignumObj(&big); } else { @@ -2382,7 +2366,6 @@ Tcl_AppendFormatToObj( numDigits++; us /= base; } -#ifndef TCL_WIDE_INT_IS_LONG } else if (useWide) { Tcl_WideUInt uw = (Tcl_WideUInt) w; @@ -2391,7 +2374,6 @@ Tcl_AppendFormatToObj( numDigits++; uw /= base; } -#endif } else if (useBig && !mp_iszero(&big)) { int leftover = (big.used * MP_DIGIT_BIT) % numBits; mp_digit mask = (~(mp_digit)0) << (MP_DIGIT_BIT-leftover); @@ -2408,7 +2390,7 @@ Tcl_AppendFormatToObj( goto errorMsg; } } else if (!useBig) { - unsigned long ul = (unsigned long) l; + unsigned ul = (unsigned) l; bits = (Tcl_WideUInt) ul; while (ul) { |
