summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2002-08-17 00:35:15 +0000
committerManuel Novoa III <mjn3@codepoet.org>2002-08-17 00:35:15 +0000
commit0e09a01f4492ba6c6569482842b35f6364d5c95b (patch)
treeed539b3a2001e61be57e41a9df33830e1553a7f0 /libc
parentdd518180f1dc60144f35f9016208f8fa503dff3a (diff)
Fix two problems with printf that showed up in the python 2.2.1 tests;
One involving %o and one involving %f.
Diffstat (limited to 'libc')
-rw-r--r--libc/stdio/printf.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libc/stdio/printf.c b/libc/stdio/printf.c
index 365cd41a2..e4eb0b69d 100644
--- a/libc/stdio/printf.c
+++ b/libc/stdio/printf.c
@@ -40,6 +40,10 @@
* 5-10-2002
* Remove __isdigit and use new ctype.h version.
* Add conditional setting of QUAL_CHARS for size_t and ptrdiff_t.
+ *
+ * 8-16-2002
+ * Fix two problems that showed up with the python 2.2.1 tests; one
+ * involving %o and one involving %f.
*/
@@ -1164,7 +1168,7 @@ int _do_one_spec(FILE * __restrict stream, register ppfs_t *ppfs, int *count)
if (ppfs->conv_num == CONV_X) {
prefix_num = PREFIX_UPR_X;
}
- if ((ppfs->conv_num == CONV_o) && (numfill < slen)) {
+ if ((ppfs->conv_num == CONV_o) && (numfill <= slen)) {
numfill = ((*s == '0') ? 1 : slen + 1);
}
}
@@ -1896,6 +1900,11 @@ size_t _dtostr(FILE * fp, long double x, struct printf_info *info)
if (mode == 'f') {
round += exp;
+ if (round < -1) {
+ memset(buf, '0', MAX_DIGITS);
+ exp = -1;
+ round = -1;
+ }
}
s = buf;