mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 14:53:47 +08:00
libs/libc/stdio/lib_libvsprintf.c: No precision specifier resulted in precision 0 but should be precision 6.
This commit is contained in:
@@ -118,6 +118,10 @@
|
||||
# define FMT_PREV src-- /* Backup to the previous character */
|
||||
#endif
|
||||
|
||||
/* Default precision to use with %f format if no precision is specified. */
|
||||
|
||||
#define FLOAT_PRECISION_DEFAULT 6
|
||||
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
****************************************************************************/
|
||||
@@ -1555,6 +1559,13 @@ int lib_vsprintf(FAR struct lib_outstream_s *obj, FAR const IPTR char *src,
|
||||
double dblval = va_arg(ap, double);
|
||||
int dblsize;
|
||||
|
||||
/* Set to default precision if none specified */
|
||||
|
||||
if (!IS_HASDOT(flags) && trunc == 0)
|
||||
{
|
||||
trunc = FLOAT_PRECISION_DEFAULT;
|
||||
}
|
||||
|
||||
/* Get the width of the output */
|
||||
|
||||
dblsize = getdblsize(FMT_CHAR, trunc, flags, dblval);
|
||||
|
||||
Reference in New Issue
Block a user