mirror of git://git.musl-libc.org/musl
all printf variants: fix argument type handling for %c and %lc
%c takes an argument of type int, not char, and %lc/%C takes an
argument of type wint_t (unsigned), not int.
for most cases, this makes no practical difference, but since wide
printf variants convert narrow %c format specifiers via btowc,
interpreting the promoted-to-int unsigned char value passed in as a
(signed, on most archs) char causes 255 to get collapsed to EOF and
interpreted as such by btowc.
this is only relevant in the byte-based C locale, so prior to commit
f22a9edaf8
, there was no observable
distinction in behavior. for UTF-8, all bytes which might be negative
when interpreted as char are encoding errors when used with %c/btowc.
This commit is contained in:
parent
fa4a8abd06
commit
3a23cd06b0
|
@ -52,7 +52,7 @@ static const unsigned char states[]['z'-'A'+1] = {
|
|||
S('o') = UINT, S('u') = UINT, S('x') = UINT, S('X') = UINT,
|
||||
S('e') = DBL, S('f') = DBL, S('g') = DBL, S('a') = DBL,
|
||||
S('E') = DBL, S('F') = DBL, S('G') = DBL, S('A') = DBL,
|
||||
S('c') = CHAR, S('C') = INT,
|
||||
S('c') = INT, S('C') = UINT,
|
||||
S('s') = PTR, S('S') = PTR, S('p') = UIPTR, S('n') = PTR,
|
||||
S('m') = NOARG,
|
||||
S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE,
|
||||
|
@ -62,7 +62,7 @@ static const unsigned char states[]['z'-'A'+1] = {
|
|||
S('o') = ULONG, S('u') = ULONG, S('x') = ULONG, S('X') = ULONG,
|
||||
S('e') = DBL, S('f') = DBL, S('g') = DBL, S('a') = DBL,
|
||||
S('E') = DBL, S('F') = DBL, S('G') = DBL, S('A') = DBL,
|
||||
S('c') = INT, S('s') = PTR, S('n') = PTR,
|
||||
S('c') = UINT, S('s') = PTR, S('n') = PTR,
|
||||
S('l') = LLPRE,
|
||||
}, { /* 2: ll-prefixed */
|
||||
S('d') = LLONG, S('i') = LLONG,
|
||||
|
|
|
@ -45,7 +45,7 @@ static const unsigned char states[]['z'-'A'+1] = {
|
|||
S('o') = UINT, S('u') = UINT, S('x') = UINT, S('X') = UINT,
|
||||
S('e') = DBL, S('f') = DBL, S('g') = DBL, S('a') = DBL,
|
||||
S('E') = DBL, S('F') = DBL, S('G') = DBL, S('A') = DBL,
|
||||
S('c') = CHAR, S('C') = INT,
|
||||
S('c') = INT, S('C') = UINT,
|
||||
S('s') = PTR, S('S') = PTR, S('p') = UIPTR, S('n') = PTR,
|
||||
S('m') = NOARG,
|
||||
S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE,
|
||||
|
@ -55,7 +55,7 @@ static const unsigned char states[]['z'-'A'+1] = {
|
|||
S('o') = ULONG, S('u') = ULONG, S('x') = ULONG, S('X') = ULONG,
|
||||
S('e') = DBL, S('f') = DBL, S('g') = DBL, S('a') = DBL,
|
||||
S('E') = DBL, S('F') = DBL, S('G') = DBL, S('A') = DBL,
|
||||
S('c') = INT, S('s') = PTR, S('n') = PTR,
|
||||
S('c') = UINT, S('s') = PTR, S('n') = PTR,
|
||||
S('l') = LLPRE,
|
||||
}, { /* 2: ll-prefixed */
|
||||
S('d') = LLONG, S('i') = LLONG,
|
||||
|
|
Loading…
Reference in New Issue