diff options
| author | Bill Fenner <fenner@FreeBSD.org> | 1996-03-20 18:28:48 +0000 | 
|---|---|---|
| committer | Bill Fenner <fenner@FreeBSD.org> | 1996-03-20 18:28:48 +0000 | 
| commit | 261a532a8b1883a6e58db66d10c9e339f180783c (patch) | |
| tree | 5441fcc318b1b89d2618505a60e086c3ed4a0731 | |
| parent | 06cff5d2808f5dd531ebde29d24f78785d461c02 (diff) | |
Notes
| -rw-r--r-- | lib/libc/stdio/vfprintf.c | 14 | 
1 files changed, 6 insertions, 8 deletions
| diff --git a/lib/libc/stdio/vfprintf.c b/lib/libc/stdio/vfprintf.c index 3c3d4d3d718e..0f241deebe10 100644 --- a/lib/libc/stdio/vfprintf.c +++ b/lib/libc/stdio/vfprintf.c @@ -306,8 +306,7 @@ vfprintf(fp, fmt0, ap)  	u_quad_t uqval;		/* %q integers */  	int base;		/* base for [diouxX] conversion */  	int dprec;		/* a copy of prec if [diouxX], 0 otherwise */ -	int fieldsz;		/* field size expanded by sign, etc */ -	int realsz;		/* field size expanded by dprec */ +	int realsz;		/* field size expanded by dprec, sign, etc */  	int size;		/* size of converted field or string */  	char *xdigs;		/* digits for [xX] conversion */  #define NIOV 8 @@ -708,14 +707,13 @@ number:			if ((dprec = prec) >= 0)  		 * floating precision; finally, if LADJUST, pad with blanks.  		 *  		 * Compute actual size, so we know how much to pad. -		 * fieldsz excludes decimal prec; realsz includes it. +		 * size excludes decimal prec; realsz includes it.  		 */ -		fieldsz = size; +		realsz = dprec > size ? dprec : size;  		if (sign) -			fieldsz++; +			realsz++;  		else if (flags & HEXPREFIX) -			fieldsz += 2; -		realsz = dprec > fieldsz ? dprec : fieldsz; +			realsz += 2;  		/* right-adjusting blank padding */  		if ((flags & (LADJUST|ZEROPAD)) == 0) @@ -735,7 +733,7 @@ number:			if ((dprec = prec) >= 0)  			PAD(width - realsz, zeroes);  		/* leading zeroes from decimal precision */ -		PAD(dprec - fieldsz, zeroes); +		PAD(dprec - size, zeroes);  		/* the string or number proper */  #ifdef FLOATING_POINT | 
