fix the treatment of the parameter-based precision, as in "%.*s%s" as
authorDaniel Stenberg <daniel@haxx.se>
Tue, 20 Nov 2007 10:03:33 +0000 (10:03 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 20 Nov 2007 10:03:33 +0000 (10:03 +0000)
previously the second %s would wrongly get the numerical argument that is used
for the variable precision for the first %s...

lib/mprintf.c

index b3fc339..bba1a64 100644 (file)
@@ -686,8 +686,11 @@ static int dprintf_formatf(
       width = p->width;
 
     /* pick up the specified precision */
-    if(p->flags & FLAGS_PRECPARAM)
+    if(p->flags & FLAGS_PRECPARAM) {
       prec = vto[p->precision].data.num;
+      param_num++; /* since the precision is extraced from a parameter, we
+                      must skip that to get to the next one properly */
+    }
     else if(p->flags & FLAGS_PREC)
       prec = p->precision;
     else