X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fmultibyte%2Fbtowc.c;h=8acd0a2cf1002ccda866949f0c528bd3bdd6fa50;hb=d5e55ba3320c30310ca1d8938925d5424a652422;hp=9d2c3b16eb77a4e6df82c31bb4c56d517424a533;hpb=0b44a0315b47dd8eced9f3b7f31580cf14bbfc01;p=musl diff --git a/src/multibyte/btowc.c b/src/multibyte/btowc.c index 9d2c3b16..8acd0a2c 100644 --- a/src/multibyte/btowc.c +++ b/src/multibyte/btowc.c @@ -1,7 +1,10 @@ #include #include +#include +#include "internal.h" wint_t btowc(int c) { - return c<128U ? c : EOF; + int b = (unsigned char)c; + return b<128U ? b : (MB_CUR_MAX==1 && c!=EOF) ? CODEUNIT(c) : WEOF; }