diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-12-13 09:59:57 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-12-13 09:59:57 (GMT) |
| commit | c3d210ed20be2da2eb3ac6b0e006acff4ce48532 (patch) | |
| tree | 7c6d80f69aa8882b7a2b0437fcb3f98c5481d810 /generic/tclScan.c | |
| parent | 473c1fce0fc67a381ac75b763c90c95c01933696 (diff) | |
| parent | a11c69a1e2331c86bb8e9e1e9b4eb5f7fb2fc459 (diff) | |
| download | tcl-c3d210ed20be2da2eb3ac6b0e006acff4ce48532.zip tcl-c3d210ed20be2da2eb3ac6b0e006acff4ce48532.tar.gz tcl-c3d210ed20be2da2eb3ac6b0e006acff4ce48532.tar.bz2 | |
Fix [c4f365470e]: Size modifiers j, q, z, t not implemented
Diffstat (limited to 'generic/tclScan.c')
| -rw-r--r-- | generic/tclScan.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/generic/tclScan.c b/generic/tclScan.c index e852d63..ba85c47 100644 --- a/generic/tclScan.c +++ b/generic/tclScan.c @@ -15,14 +15,15 @@ /* * Flag values used by Tcl_ScanObjCmd. */ +enum ScanFlags { + SCAN_NOSKIP = 0x1, /* Don't skip blanks. */ + SCAN_SUPPRESS = 0x2, /* Suppress assignment. */ + SCAN_UNSIGNED = 0x4, /* Read an unsigned value. */ + SCAN_WIDTH = 0x8, /* A width value was supplied. */ -#define SCAN_NOSKIP 0x1 /* Don't skip blanks. */ -#define SCAN_SUPPRESS 0x2 /* Suppress assignment. */ -#define SCAN_UNSIGNED 0x4 /* Read an unsigned value. */ -#define SCAN_WIDTH 0x8 /* A width value was supplied. */ - -#define SCAN_LONGER 0x400 /* Asked for a wide value. */ -#define SCAN_BIG 0x800 /* Asked for a bignum value. */ + SCAN_LONGER = 0x400, /* Asked for a wide value. */ + SCAN_BIG = 0x800 /* Asked for a bignum value. */ +}; /* * The following structure contains the information associated with a @@ -683,6 +684,7 @@ Tcl_ScanObjCmd( format += TclUtfToUniChar(format, &ch); } else if ((ch < 0x80) && isdigit(UCHAR(ch))) { /* INTL: "C" locale. */ char *formatEnd; + /* Note currently XPG3 range limited to INT_MAX to match type of objc */ value = strtoul(format-1, &formatEnd, 10);/* INTL: "C" locale. */ if (*formatEnd == '$') { format = formatEnd+1; @@ -707,6 +709,13 @@ Tcl_ScanObjCmd( */ switch (ch) { + case 'z': + case 't': + if (sizeof(void *) > sizeof(int)) { + flags |= SCAN_LONGER; + } + format += TclUtfToUniChar(format, &ch); + break; case 'l': if (*format == 'l') { flags |= SCAN_BIG; @@ -716,6 +725,8 @@ Tcl_ScanObjCmd( } /* FALLTHRU */ case 'L': + case 'j': + case 'q': flags |= SCAN_LONGER; /* FALLTHRU */ case 'h': |
