Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2004-10-04 21:51:50 +0400
committerJeff Johnston <jjohnstn@redhat.com>2004-10-04 21:51:50 +0400
commit3ea9de7644c3110f6f8394501cd26a38852c95e9 (patch)
tree727eabbfae37c3aa5325e6e81136653f1037acfd
parent298cac75d584b02beb1313b0f60f72a54064b6e5 (diff)
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.
-rw-r--r--newlib/ChangeLog6
-rw-r--r--newlib/libc/machine/powerpc/vfscanf.c4
-rw-r--r--newlib/libc/stdio/vfscanf.c4
3 files changed, 12 insertions, 2 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index b4de087e8..aedd565c8 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -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>
* libc/stdio/local.h: Include <stdlib.h>.
diff --git a/newlib/libc/machine/powerpc/vfscanf.c b/newlib/libc/machine/powerpc/vfscanf.c
index 602fd7735..63855edcd 100644
--- a/newlib/libc/machine/powerpc/vfscanf.c
+++ b/newlib/libc/machine/powerpc/vfscanf.c
@@ -803,6 +803,7 @@ __svfscanf_r (rptr, fp, fmt0, ap)
case CT_INT:
{
unsigned int_width_left = 0;
+ int skips = 0;
int_width = width;
#ifdef hardway
if (int_width == 0 || int_width > sizeof (buf) - 1)
@@ -852,6 +853,7 @@ __svfscanf_r (rptr, fp, fmt0, ap)
int_width_left--;
int_width++;
}
+ ++skips;
goto skip;
/* 1 through 7 always legal */
@@ -1009,7 +1011,7 @@ __svfscanf_r (rptr, fp, fmt0, ap)
if (!(flags & VECTOR))
nassigned++;
}
- nread += p - buf;
+ nread += p - buf + skips;
break;
}
diff --git a/newlib/libc/stdio/vfscanf.c b/newlib/libc/stdio/vfscanf.c
index 76561fe4a..f13181af7 100644
--- a/newlib/libc/stdio/vfscanf.c
+++ b/newlib/libc/stdio/vfscanf.c
@@ -765,6 +765,7 @@ _DEFUN(__svfscanf_r, (rptr, fp, fmt0, ap),
{
/* scan an integer as if by strtol/strtoul */
unsigned width_left = 0;
+ int skips = 0;
#ifdef hardway
if (width == 0 || width > sizeof (buf) - 1)
#else
@@ -813,6 +814,7 @@ _DEFUN(__svfscanf_r, (rptr, fp, fmt0, ap),
width_left--;
width++;
}
+ ++skips;
goto skip;
/* 1 through 7 always legal */
@@ -957,7 +959,7 @@ _DEFUN(__svfscanf_r, (rptr, fp, fmt0, ap),
}
nassigned++;
}
- nread += p - buf;
+ nread += p - buf + skips;
break;
}
#ifdef FLOATING_POINT