[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: *printf-posix: ISO C 23: Support size specifiers 'wN' and 'wfN'
From: |
Bruno Haible |
Subject: |
Re: *printf-posix: ISO C 23: Support size specifiers 'wN' and 'wfN' |
Date: |
Mon, 03 Apr 2023 14:45:41 +0200 |
Oops, there was a mistake here. Fortunately a harmless one.
> @@ -1633,24 +1633,155 @@ MAX_ROOM_NEEDED (const arguments *ap, size_t
> arg_index, FCHAR_T conversion,
> switch (conversion)
> {
> case 'd': case 'i': case 'u':
> - if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
> - tmp_length =
> - (unsigned int) (sizeof (unsigned long long) * CHAR_BIT
> - * 0.30103 /* binary -> decimal */
> - )
> - + 1; /* turn floor into ceil */
> - else if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
> - tmp_length =
> - (unsigned int) (sizeof (unsigned long) * CHAR_BIT
> - * 0.30103 /* binary -> decimal */
> - )
> - + 1; /* turn floor into ceil */
> - else
> - tmp_length =
> - (unsigned int) (sizeof (unsigned int) * CHAR_BIT
> - * 0.30103 /* binary -> decimal */
> - )
> - + 1; /* turn floor into ceil */
> + switch (type)
> + {
> + default:
> + tmp_length =
> + (unsigned int) (sizeof (unsigned int) * CHAR_BIT
> + * 0.30103 /* binary -> decimal */
> + )
> + + 1; /* turn floor into ceil */
> + case TYPE_LONGINT:
> + tmp_length =
> + (unsigned int) (sizeof (long int) * CHAR_BIT
> + * 0.30103 /* binary -> decimal */
> + )
> + + 1; /* turn floor into ceil */
> + break;
2023-04-03 Bruno Haible <bruno@clisp.org>
vasnprintf-posix: Fix harmless mistake (regression 2023-03-24).
Found by Coverity.
* lib/vasnprintf.c (MAX_ROOM_NEEDED): Insert 'break;' statement.
diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c
index 111d898a94..6eb056d0e9 100644
--- a/lib/vasnprintf.c
+++ b/lib/vasnprintf.c
@@ -1641,6 +1641,7 @@ MAX_ROOM_NEEDED (const arguments *ap, size_t arg_index,
FCHAR_T conversion,
* 0.30103 /* binary -> decimal */
)
+ 1; /* turn floor into ceil */
+ break;
case TYPE_LONGINT:
tmp_length =
(unsigned int) (sizeof (long int) * CHAR_BIT
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: *printf-posix: ISO C 23: Support size specifiers 'wN' and 'wfN',
Bruno Haible <=