Add mbtowc and fix mbrtowc.
Change-Id: I48786cd82587e61188d40f6fd6e11ac05e857ae9
diff --git a/libc/bionic/wchar.cpp b/libc/bionic/wchar.cpp
index f921aa0..674dc3a 100644
--- a/libc/bionic/wchar.cpp
+++ b/libc/bionic/wchar.cpp
@@ -164,16 +164,12 @@
size_t mbrtowc(wchar_t* pwc, const char* s, size_t n, mbstate_t* /*ps*/) {
if (s == NULL) {
- s = "";
- pwc = NULL;
+ return 0;
}
if (n == 0) {
- if (pwc) {
- *pwc = 0;
- return 0;
- }
+ return 0;
}
- if (pwc) {
+ if (pwc != NULL) {
*pwc = *s;
}
return (*s != 0);