diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-05-30 22:02:14 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-05-30 22:02:14 (GMT) |
| commit | f917b2aa03530ea23859a0749a8fef959066c96f (patch) | |
| tree | b59bde5e2f6dec3e449aaba9e67fcc0e692292d9 /generic/tclStringObj.c | |
| parent | d4a61adbe45cca90aa1491d7b31452a6c9938d6c (diff) | |
| parent | a61d95045e2a65e0c2d418576016e24d29906994 (diff) | |
| download | tcl-f917b2aa03530ea23859a0749a8fef959066c96f.zip tcl-f917b2aa03530ea23859a0749a8fef959066c96f.tar.gz tcl-f917b2aa03530ea23859a0749a8fef959066c96f.tar.bz2 | |
Fix [9c258a841a]: document %t/%z/%j/%q size field specifiers. Fix %j/%z/%t matching the C printf
Diffstat (limited to 'generic/tclStringObj.c')
| -rw-r--r-- | generic/tclStringObj.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 6d16be5..827c227 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2101,8 +2101,21 @@ Tcl_AppendFormatToObj( format += step; step = TclUtfToUniChar(format, &ch); } - } else if ((ch == 't') || (ch == 'z') || (ch == 'q') || (ch == 'j') - || (ch == 'L')) { + } 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); useBig = 1; @@ -2174,7 +2187,7 @@ Tcl_AppendFormatToObj( Tcl_Size toAppend; #ifndef TCL_WIDE_INT_IS_LONG - if (ch == 'p') { + if ((ch == 'p') && (sizeof(void *) > sizeof(int))) { useWide = 1; } #endif |
