|
Message-Id: <20180531215655.6662-1-avagin@virtuozzo.com> Date: Fri, 1 Jun 2018 00:56:55 +0300 From: Andrei Vagin <avagin@...tuozzo.com> To: musl@...ts.openwall.com Cc: Andrei Vagin <avagin@...tuozzo.com> Subject: [PATCH] printf: handle the L modifier for integers The L modifier is usually used for floating-point numbers, but glibc allows to use this modifier for integers too. I think here is nothing wrong if we will be compatible with glibc here. It is not often when a error code of printf is checked, so we may have a situation when a code works with glibc and doesn't work with musl. Signed-off-by: Andrei Vagin <avagin@...tuozzo.com> --- src/stdio/vfprintf.c | 3 +++ src/stdio/vfwprintf.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/stdio/vfprintf.c b/src/stdio/vfprintf.c index 50fb55c1..7f6c4f39 100644 --- a/src/stdio/vfprintf.c +++ b/src/stdio/vfprintf.c @@ -82,6 +82,9 @@ static const unsigned char states[]['z'-'A'+1] = { }, { /* 5: L-prefixed */ S('e') = LDBL, S('f') = LDBL, S('g') = LDBL, S('a') = LDBL, S('E') = LDBL, S('F') = LDBL, S('G') = LDBL, S('A') = LDBL, + S('d') = LLONG, S('i') = LLONG, + S('o') = ULLONG, S('u') = ULLONG, + S('x') = ULLONG, S('X') = ULLONG, S('n') = PTR, }, { /* 6: z- or t-prefixed (assumed to be same size) */ S('d') = PDIFF, S('i') = PDIFF, diff --git a/src/stdio/vfwprintf.c b/src/stdio/vfwprintf.c index e87ad42a..c6ce82ea 100644 --- a/src/stdio/vfwprintf.c +++ b/src/stdio/vfwprintf.c @@ -73,6 +73,9 @@ static const unsigned char states[]['z'-'A'+1] = { }, { /* 5: L-prefixed */ S('e') = LDBL, S('f') = LDBL, S('g') = LDBL, S('a') = LDBL, S('E') = LDBL, S('F') = LDBL, S('G') = LDBL, S('A') = LDBL, + S('d') = LLONG, S('i') = LLONG, + S('o') = ULLONG, S('u') = ULLONG, + S('x') = ULLONG, S('X') = ULLONG, S('n') = PTR, }, { /* 6: z- or t-prefixed (assumed to be same size) */ S('d') = PDIFF, S('i') = PDIFF, -- 2.14.3
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.