projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
implement the 'm' (malloc) modifier for scanf
[musl]
/
src
/
stdio
/
fgetwc.c
diff --git
a/src/stdio/fgetwc.c
b/src/stdio/fgetwc.c
index
c990545
..
8626d54
100644
(file)
--- a/
src/stdio/fgetwc.c
+++ b/
src/stdio/fgetwc.c
@@
-1,4
+1,6
@@
#include "stdio_impl.h"
#include "stdio_impl.h"
+#include <wchar.h>
+#include <errno.h>
wint_t __fgetwc_unlocked(FILE *f)
{
wint_t __fgetwc_unlocked(FILE *f)
{
@@
-12,7
+14,7
@@
wint_t __fgetwc_unlocked(FILE *f)
/* Convert character from buffer if possible */
if (f->rpos < f->rend) {
/* Convert character from buffer if possible */
if (f->rpos < f->rend) {
- l = mbrtowc(&wc, f->rpos, f->rend - f->rpos, &st);
+ l = mbrtowc(&wc,
(void *)
f->rpos, f->rend - f->rpos, &st);
if (l+2 >= 2) {
f->rpos += l + !l; /* l==0 means 1 byte, null */
return wc;
if (l+2 >= 2) {
f->rpos += l + !l; /* l==0 means 1 byte, null */
return wc;
@@
-23,18
+25,17
@@
wint_t __fgetwc_unlocked(FILE *f)
}
} else l = -2;
}
} else l = -2;
- /* Convert character byte-by-byte
from __uflow
*/
+ /* Convert character byte-by-byte */
while (l == -2) {
while (l == -2) {
- b = c =
__uflow
(f);
+ b = c =
getc_unlocked
(f);
if (c < 0) {
if (!mbsinit(&st)) errno = EILSEQ;
return WEOF;
}
if (c < 0) {
if (!mbsinit(&st)) errno = EILSEQ;
return WEOF;
}
- l = mbrtowc(&wc, &b, 1, &st);
+ l = mbrtowc(&wc,
(void *)
&b, 1, &st);
if (l == -1) return WEOF;
}
if (l == -1) return WEOF;
}
- FUNLOCK(f);
return wc;
}
return wc;
}