diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2000-03-17 20:40:20 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2000-03-17 20:40:20 +0000 |
commit | fae4c299f14fc23e2829c8656992eba21f79242a (patch) | |
tree | ff8f3e806131f03f673bf83832fedeeba820f098 /newlib | |
parent | 2be36bd9c4bd7fa7e73821fe902f036f86ab0d0f (diff) | |
download | newlib-fae4c299f14fc23e2829c8656992eba21f79242a.zip newlib-fae4c299f14fc23e2829c8656992eba21f79242a.tar.gz newlib-fae4c299f14fc23e2829c8656992eba21f79242a.tar.bz2 |
Fri Mar 17 15:37:00 2000 Jeff Johnston <jjohnstn@cygnus.com>
* libc/stdio/vfscanf.c (__svfscanf): Fixed floating point
code to update nread as each character is processed instead
of using buffer contents which throw away leading zeroes.
Diffstat (limited to 'newlib')
-rw-r--r-- | newlib/ChangeLog | 6 | ||||
-rw-r--r-- | newlib/libc/stdio/vfscanf.c | 9 |
2 files changed, 13 insertions, 2 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 955bb62..77bceab 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,9 @@ +Fri Mar 17 15:37:00 2000 Jeff Johnston <jjohnstn@cygnus.com> + + * libc/stdio/vfscanf.c (__svfscanf): Fixed floating point + code to update nread as each character is processed instead + of using buffer contents which throw away leading zeroes. + Mon Mar 13 15:22:00 2000 Sergei Organov <osv@javad.ru> * libm/mathfp/sf_sqrt.c: Change _DOUBLE_IS_32BITS sqrt call to sqrtf. diff --git a/newlib/libc/stdio/vfscanf.c b/newlib/libc/stdio/vfscanf.c index 00fd98d..f1d328a 100644 --- a/newlib/libc/stdio/vfscanf.c +++ b/newlib/libc/stdio/vfscanf.c @@ -765,6 +765,7 @@ __svfscanf (fp, fmt0, ap) *p++ = c; width--; fskip: + ++nread; if (--fp->_r > 0) fp->_p++; else @@ -786,15 +787,20 @@ __svfscanf (fp, fmt0, ap) { /* no digits at all */ while (p > buf) - ungetc (*(u_char *)-- p, fp); + { + ungetc (*(u_char *)-- p, fp); + --nread; + } goto match_failure; } /* just a bad exponent (e and maybe sign) */ c = *(u_char *)-- p; + --nread; if (c != 'e' && c != 'E') { _CAST_VOID ungetc (c, fp); /* sign */ c = *(u_char *)-- p; + --nread; } _CAST_VOID ungetc (c, fp); } @@ -839,7 +845,6 @@ __svfscanf (fp, fmt0, ap) } nassigned++; } - nread += p - buf; break; } #endif /* FLOATING_POINT */ |