fix undefined left-shift of negative values in utf-8 state table
[musl] / src / multibyte / wctob.c
index d6353ee..4aeda6a 100644 (file)
@@ -1,8 +1,10 @@
-#include <stdio.h>
 #include <wchar.h>
+#include <stdlib.h>
+#include "internal.h"
 
 int wctob(wint_t c)
 {
        if (c < 128U) return c;
+       if (MB_CUR_MAX==1 && IS_CODEUNIT(c)) return (unsigned char)c;
        return EOF;
 }