Commit c82f76e1 authored by Bruce Momjian's avatar Bruce Momjian

Fix snprintf() to properly handle precision specification for %f.

parent a214e9c9
......@@ -65,7 +65,7 @@
* causing nasty effects.
**************************************************************/
/*static char _id[] = "$PostgreSQL: pgsql/src/port/snprintf.c,v 1.18 2005/03/11 19:13:43 momjian Exp $";*/
/*static char _id[] = "$PostgreSQL: pgsql/src/port/snprintf.c,v 1.19 2005/03/12 04:00:56 momjian Exp $";*/
int pg_snprintf(char *str, size_t count, const char *fmt,...);
int pg_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
......@@ -252,6 +252,7 @@ dopr(char *buffer, const char *format, va_list args, char *end)
case '8':
case '9':
if (pointflag)
/* could also be precision */
maxwidth = maxwidth * 10 + ch - '0';
else
{
......@@ -455,6 +456,7 @@ dopr(char *buffer, const char *format, va_list args, char *end)
fmtpar[fmtpos].ljust = ljust;
fmtpar[fmtpos].len = len;
fmtpar[fmtpos].maxwidth = maxwidth;
fmtpar[fmtpos].precision = position;
fmtpar[fmtpos].pointflag = pointflag;
fmtpar[fmtpos].func = FMTFLOAT;
fmtpar[fmtpos].realpos = realpos?realpos:fmtpos;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment