author | Rich Felker <dalias@aerifal.cx> | 2015年06月16日 04:44:17 +0000 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2015年06月16日 05:28:48 +0000 |
commit | 1507ebf837334e9e07cfab1ca1c2e88449069a80 (patch) | |
tree | 92bad1f861e442f7e2d2fa4e178f471f4371509a /src/multibyte/btowc.c | |
parent | 38e2f727237230300fea6aff68802db04625fd23 (diff) | |
download | musl-1507ebf837334e9e07cfab1ca1c2e88449069a80.tar.gz |
-rw-r--r-- | src/multibyte/btowc.c | 6 |
diff --git a/src/multibyte/btowc.c b/src/multibyte/btowc.c index 29cb798d..8acd0a2c 100644 --- a/src/multibyte/btowc.c +++ b/src/multibyte/btowc.c @@ -1,8 +1,10 @@ #include <stdio.h> #include <wchar.h> +#include <stdlib.h> +#include "internal.h" wint_t btowc(int c) { - c = (unsigned char)c; - return c<128U ? c : EOF; + int b = (unsigned char)c; + return b<128U ? b : (MB_CUR_MAX==1 && c!=EOF) ? CODEUNIT(c) : WEOF; } |