From 0fbb1412198acf1954c9e8dad34358b3fff36aa4 Mon Sep 17 00:00:00 2001 Message-Id: <0fbb1412198acf1954c9e8dad34358b3fff36aa4.1713505156.git.mdw@distorted.org.uk> From: Mark Wooding Date: Tue, 1 Jun 1999 09:47:52 +0000 Subject: [PATCH] Fix nasty bugs in `dstr_vputf'. Organization: Straylight/Edgeware From: mdw --- dstr.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/dstr.c b/dstr.c index fe65ebe..86cde6e 100644 --- a/dstr.c +++ b/dstr.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: dstr.c,v 1.7 1999/05/21 22:14:30 mdw Exp $ + * $Id: dstr.c,v 1.8 1999/06/01 09:47:52 mdw Exp $ * * Handle dynamically growing strings * @@ -30,6 +30,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: dstr.c,v $ + * Revision 1.8 1999/06/01 09:47:52 mdw + * Fix nasty bugs in `dstr_vputf'. + * * Revision 1.7 1999/05/21 22:14:30 mdw * Take advantage of the new dynamic string macros. * @@ -278,7 +281,7 @@ int dstr_vputf(dstr *d, const char *p, va_list ap) goto getnum; default: if (isdigit((unsigned char)*p)) { - f |= f_prec; + f |= f_wd; ip = &wd; goto getnum; } @@ -291,12 +294,12 @@ int dstr_vputf(dstr *d, const char *p, va_list ap) DENSURE(&dd, DSTR_PUTFSTEP); dd.len += sprintf(dd.buf + dd.len, "%i", *ip); } else { - *ip = *p + '0'; + *ip = *p - '0'; DPUTC(&dd, *p); p++; while (isdigit((unsigned char)*p)) { DPUTC(&dd, *p); - *ip = 10 * *ip + *p++ + '0'; + *ip = 10 * *ip + *p++ - '0'; } } break; -- [mdw]