Sorry, I move out off town and got a new job recently. still I did
try to commit my patch unfortunatly, i did have some problem with CVS
login(not quite familiar with the encryption key and CVS, i couldnt
have it working neither with turtoise nor eclipse).
I think it would be faster for now if you just include it for me(never
mind the credits) since everything here is either in a box or still at
my old place(and christmas time will not help me to get back on track
any faster).
First part of the file is the actual diff followed by some comments on
the differents.
Fred
2007/12/20, Eric Weddington <[EMAIL PROTECTED]>:
>
> Follow-up Comment #3, bug #19079 (project avr-libc):
>
> Frederic,
>
> Will you be committing the fix for this bug?
>
> Thanks,
> Eric Weddington
>
> _______________________________________________________
>
> Reply to this item at:
>
> <http://savannah.nongnu.org/bugs/?19079>
>
> _______________________________________________
> Message sent via/by Savannah
> http://savannah.nongnu.org/
>
>
### Eclipse Workspace Patch 1.0
#P avr-libc
Index: libc/stdio/vfscanf.c
===================================================================
RCS file: /sources/avr-libc/avr-libc/libc/stdio/vfscanf.c,v
retrieving revision 1.13
diff -u -r1.13 vfscanf.c
--- libc/stdio/vfscanf.c 9 Nov 2005 21:54:33 -0000 1.13
+++ libc/stdio/vfscanf.c 25 Oct 2007 23:34:44 -0000
@@ -264,18 +264,15 @@
if (!(flags & FLSTAR))
#endif /* SCANF_LEVEL > SCANF_MIN */
a.cp = va_arg(ap, char *);
- do {
- i = getc(stream);
- } while (isspace(i));
- if (i == EOF)
- goto leave;
#if SCANF_LEVEL > SCANF_MIN
- while (width-- > 0)
+ do
#else
for (;;)
#endif /* SCANF_LEVEL > SCANF_MIN */
{
+ if ((i = getc(stream)) == EOF)
+ break;
if (isspace(i)) {
ungetc(i, stream);
break;
@@ -284,10 +281,10 @@
if (!(flags & FLSTAR))
#endif /* SCANF_LEVEL > SCANF_MIN */
*a.cp++ = i;
- if ((i = getc(stream)) == EOF)
- break;
+
}
#if SCANF_LEVEL > SCANF_MIN
+ while (--width > 0);
if (!(flags & FLSTAR))
#endif /* SCANF_LEVEL > SCANF_MIN */
*a.cp = '\0';
I included a patch file.
Here are comment on the patch:
do {
i = getc(stream);
} while (isspace(i));
if (i == EOF)
goto leave;
this was remove. Reason:
Man file state: Matches a sequence of non-white-space characters...
Obviosly that part of code as the exact purpose of removing any leading
space(or white-space characters). As a second remark, we dont yet decrement
width(hit, bug is sscanf eats 1 char too much)
.
Next modif:
- while (width-- > 0)
+ do
Using a post decrement tation will end up in the following senarion. if Width
== 6, we will loop 6 time, this way we will read 6 char from the stream.
Didn't we just read 1 earlyer?
next modification: Bring
if ((i = getc(stream)) == EOF)
break;
just after the do
Since we are going to do some test condition on var i, we better have something
in it. I guess it was done later on due to the fact that it was red in the
part I removed earlyer.
final modif:
while (--width > 0);
To close the do-while, this will ensure a width reading.
I have not done much testing on it, just things that came to my mind. Comment
are welcome
Fred
_______________________________________________
AVR-libc-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-libc-dev