libc/libvsprintf:fix vsnprintf bug with "%#.0f"

With double value=3.141593 initialized in va_list ap,
such code:
   vsnprintf(buffer, sizeof(buffer), "%#.0f", ap);
expected output string: "3."
but real output string: ".3"

Signed-off-by: Sunny <zxcvbnm37425@gmail.com>
This commit is contained in:
Sunny 2023-07-04 09:37:42 +00:00 committed by Alan Carvalho de Assis
parent 6b11672310
commit abfdffd879
1 changed files with 5 additions and 5 deletions

View File

@ -816,11 +816,6 @@ flt_oper:
if (--n < -prec)
{
if ((flags & FL_ALT) != 0 && n == -1)
{
stream_putc('.', stream);
}
break;
}
@ -835,6 +830,11 @@ flt_oper:
}
stream_putc(out, stream);
if ((flags & FL_ALT) != 0 && n == -1)
{
stream_putc('.', stream);
}
}
else
{