Fix to icompute.c: always had one digit too much
authorceriel <none@none>
Thu, 26 Aug 1993 10:08:37 +0000 (10:08 +0000)
committerceriel <none@none>
Thu, 26 Aug 1993 10:08:37 +0000 (10:08 +0000)
lang/cem/libcc.ansi/stdio/doprnt.c
lang/cem/libcc.ansi/stdio/icompute.c

index b520dcf..3095059 100644 (file)
@@ -100,7 +100,7 @@ o_print(va_list *ap, int flags, char *s, char c, int precision, int is_signed)
        case 'p':       base = 16;      break;
        }
 
-       s = _i_compute(unsigned_val, base, s, precision - 1);
+       s = _i_compute(unsigned_val, base, s, precision);
 
        if (c == 'X')
                while (old_s != s) {
index 3787772..5e7fa80 100644 (file)
@@ -14,7 +14,7 @@ _i_compute(unsigned long val, int base, char *s, int nrdigits)
 
        c= val % base ;
        val /= base ;
-       if (val || nrdigits > 0)
+       if (val || nrdigits > 1)
                s = _i_compute(val, base, s, nrdigits - 1);
        *s++ = (c>9 ? c-10+'a' : c+'0');
        return s;