diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-01-15 10:32:12 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-01-15 10:32:12 -0800 |
commit | 3753753c60a0b2ecb7ebd0475408c02cfff4ec91 (patch) | |
tree | f4e5935a4c0c07b0afbe5f7dfbe52852cb953e7a /system/lib | |
parent | e808b59eb686e48f590e3d8ca2ab2671498f22b4 (diff) |
remove musl use of fwritex1.8.13
Diffstat (limited to 'system/lib')
-rw-r--r-- | system/lib/libc/musl/src/stdio/fputwc.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/system/lib/libc/musl/src/stdio/fputwc.c b/system/lib/libc/musl/src/stdio/fputwc.c index e87e47d4..603fa615 100644 --- a/system/lib/libc/musl/src/stdio/fputwc.c +++ b/system/lib/libc/musl/src/stdio/fputwc.c @@ -17,15 +17,28 @@ wint_t __fputwc_unlocked(wchar_t c, FILE *f) l = wctomb((void *)f->wpos, c); if (l < 0) c = WEOF; else f->wpos += l; -#else - if (isascii(c)) { - c = fputc(c, f); -#endif } else { l = wctomb(mbc, c); if (l < 0 || __fwritex((void *)mbc, l, f) < l) c = WEOF; } return c; +#else + if (isascii(c)) { + c = fputc(c, f); + } else { + l = wctomb(mbc, c); + if (l < 0) c = WEOF; + else { + for (int i = 0; i < l; i++) { + if (fputc(mbc[i], f) == EOF) { + c = WEOF; + break; + } + } + } + } +#endif + return c; } wint_t fputwc(wchar_t c, FILE *f) |