Mercurial > hg > th-libs
diff th_printf.c @ 548:41efdd004c3a
A somewhat kludgy fix for the octal format issues, now all current
integer format string tests pass completely. Hopefully this can improved to
be more elegant later ..
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 31 Dec 2019 05:24:15 +0200 |
parents | c21051972015 |
children | 3a852e9f70a6 |
line wrap: on
line diff
--- a/th_printf.c Tue Dec 31 05:22:15 2019 +0200 +++ b/th_printf.c Tue Dec 31 05:24:15 2019 +0200 @@ -120,7 +120,16 @@ (void) flags; (void) prec; - return (buf[len - 1] != '0') ? "0" : NULL; + // This is not very nice + if (buf[len - 1] != '0') + { + if (*prec > 0) + (*prec)--; + + return "0"; + } + else + return NULL; }