4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-18 12:29:32 +08:00

2004-10-04 Jeff Johnston <jjohnstn@redhat.com>

* libc/stdio/vfscanf.c (__svfscanf_r): For int conversions,
        count skipped zero characters as part of the nread count for %n.
        * libc/machine/powerpc/vfscanf.c: Ditto.
This commit is contained in:
Jeff Johnston 2004-10-04 17:51:50 +00:00
parent 298cac75d5
commit 3ea9de7644
3 changed files with 12 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2004-10-04 Jeff Johnston <jjohnstn@redhat.com>
* libc/stdio/vfscanf.c (__svfscanf_r): For int conversions,
count skipped zero characters as part of the nread count for %n.
* libc/machine/powerpc/vfscanf.c: Ditto.
2004-09-24 Jeff Johnston <jjohnstn@redhat.com> 2004-09-24 Jeff Johnston <jjohnstn@redhat.com>
* libc/stdio/local.h: Include <stdlib.h>. * libc/stdio/local.h: Include <stdlib.h>.

View File

@ -803,6 +803,7 @@ __svfscanf_r (rptr, fp, fmt0, ap)
case CT_INT: case CT_INT:
{ {
unsigned int_width_left = 0; unsigned int_width_left = 0;
int skips = 0;
int_width = width; int_width = width;
#ifdef hardway #ifdef hardway
if (int_width == 0 || int_width > sizeof (buf) - 1) if (int_width == 0 || int_width > sizeof (buf) - 1)
@ -852,6 +853,7 @@ __svfscanf_r (rptr, fp, fmt0, ap)
int_width_left--; int_width_left--;
int_width++; int_width++;
} }
++skips;
goto skip; goto skip;
/* 1 through 7 always legal */ /* 1 through 7 always legal */
@ -1009,7 +1011,7 @@ __svfscanf_r (rptr, fp, fmt0, ap)
if (!(flags & VECTOR)) if (!(flags & VECTOR))
nassigned++; nassigned++;
} }
nread += p - buf; nread += p - buf + skips;
break; break;
} }

View File

@ -765,6 +765,7 @@ _DEFUN(__svfscanf_r, (rptr, fp, fmt0, ap),
{ {
/* scan an integer as if by strtol/strtoul */ /* scan an integer as if by strtol/strtoul */
unsigned width_left = 0; unsigned width_left = 0;
int skips = 0;
#ifdef hardway #ifdef hardway
if (width == 0 || width > sizeof (buf) - 1) if (width == 0 || width > sizeof (buf) - 1)
#else #else
@ -813,6 +814,7 @@ _DEFUN(__svfscanf_r, (rptr, fp, fmt0, ap),
width_left--; width_left--;
width++; width++;
} }
++skips;
goto skip; goto skip;
/* 1 through 7 always legal */ /* 1 through 7 always legal */
@ -957,7 +959,7 @@ _DEFUN(__svfscanf_r, (rptr, fp, fmt0, ap),
} }
nassigned++; nassigned++;
} }
nread += p - buf; nread += p - buf + skips;
break; break;
} }
#ifdef FLOATING_POINT #ifdef FLOATING_POINT