mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-18 12:29:32 +08:00
* libc/stdlib/btowc.c (btowc): Reorganize EOF check. Fix incorrect
return value if input byte is ASCII NUL.
This commit is contained in:
parent
44ac55bcb6
commit
65ee447a02
@ -1,3 +1,8 @@
|
|||||||
|
2010-04-06 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* libc/stdlib/btowc.c (btowc): Reorganize EOF check. Fix incorrect
|
||||||
|
return value if input byte is ASCII NUL.
|
||||||
|
|
||||||
2010-04-01 Joel Sherrill <joel.sherrill@oarcorp.com>
|
2010-04-01 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||||
|
|
||||||
* libc/include/sched.h: Include prototypes for
|
* libc/include/sched.h: Include prototypes for
|
||||||
|
@ -13,6 +13,9 @@ btowc (int c)
|
|||||||
wchar_t pwc;
|
wchar_t pwc;
|
||||||
unsigned char b;
|
unsigned char b;
|
||||||
|
|
||||||
|
if (c == EOF)
|
||||||
|
return WEOF;
|
||||||
|
|
||||||
b = (unsigned char)c;
|
b = (unsigned char)c;
|
||||||
|
|
||||||
/* Put mbs in initial state. */
|
/* Put mbs in initial state. */
|
||||||
@ -22,8 +25,8 @@ btowc (int c)
|
|||||||
|
|
||||||
retval = __mbtowc (_REENT, &pwc, &b, 1, __locale_charset (), &mbs);
|
retval = __mbtowc (_REENT, &pwc, &b, 1, __locale_charset (), &mbs);
|
||||||
|
|
||||||
if (c == EOF || retval != 1)
|
if (retval != 0 && retval != 1)
|
||||||
return WEOF;
|
return WEOF;
|
||||||
else
|
|
||||||
return (wint_t)pwc;
|
return (wint_t)pwc;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user