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 | 67c2088e87cd31193d5f8844338e2a25747a31b1 (patch) | |
| tree | b59bde5e2f6dec3e449aaba9e67fcc0e692292d9 /generic/tclStringObj.c | |
| parent | 8638a9a7028eb75fafa0cdadb61607c938d6f9d7 (diff) | |
| parent | 36aff985a283c4224d557897982d7c540c881558 (diff) | |
| download | tcl-67c2088e87cd31193d5f8844338e2a25747a31b1.zip tcl-67c2088e87cd31193d5f8844338e2a25747a31b1.tar.gz tcl-67c2088e87cd31193d5f8844338e2a25747a31b1.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 |
