Nicolai Tufar wrote:
> On Wed, 16 Mar 2005 01:00:21 -0500 (EST), Bruce Momjian
> <pgman@candle.pha.pa.us> wrote:
> >
> > I have applied a modified version of your patch, attached.
>
Here is a patch that fixes the %*$ case.
FYI, I am going to pgindent snprintf.c to make it consistent so please
us CVS for your next patch.
I will work on your Win32 compile problem next.
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Index: src/port/snprintf.c
===================================================================
RCS file: /cvsroot/pgsql/src/port/snprintf.c,v
retrieving revision 1.20
diff -c -c -r1.20 snprintf.c
*** src/port/snprintf.c 16 Mar 2005 06:00:58 -0000 1.20
--- src/port/snprintf.c 16 Mar 2005 14:59:00 -0000
***************
*** 467,481 ****
fmtparptr[i]->charvalue = va_arg(args, int);
break;
case FMTLEN:
! if (i + 1 < fmtpos && fmtpar[i + 1].func != FMTWIDTH)
! fmtpar[i + 1].len = va_arg(args, int);
/* For "%*.*f", use the second arg */
! if (i + 2 < fmtpos && fmtpar[i + 1].func == FMTWIDTH)
! fmtpar[i + 2].len = va_arg(args, int);
break;
case FMTWIDTH:
if (i + 1 < fmtpos)
! fmtpar[i + 1].maxwidth = fmtpar[i + 1].precision =
va_arg(args, int);
break;
}
--- 467,481 ----
fmtparptr[i]->charvalue = va_arg(args, int);
break;
case FMTLEN:
! if (i + 1 < fmtpos && fmtparptr[i + 1]->func != FMTWIDTH)
! fmtparptr[i + 1]->len = va_arg(args, int);
/* For "%*.*f", use the second arg */
! if (i + 2 < fmtpos && fmtparptr[i + 1]->func == FMTWIDTH)
! fmtparptr[i + 2]->len = va_arg(args, int);
break;
case FMTWIDTH:
if (i + 1 < fmtpos)
! fmtparptr[i + 1]->maxwidth = fmtparptr[i + 1]->precision =
va_arg(args, int);
break;
}