LibC: Implement a very naive mbtowc()

This just copies the short char into the wide char without any decoding
whatsoever. A proper implementation should look at the current LC_CTYPE
and implement multi-byte decoding.
This commit is contained in:
Andreas Kling 2019-11-10 13:16:49 +01:00
commit 4f27745136
Notes: sideshowbarker 2024-07-19 11:17:02 +09:00

View file

@ -447,9 +447,21 @@ size_t mbstowcs(wchar_t*, const char*, size_t)
ASSERT_NOT_REACHED();
}
size_t mbtowc(wchar_t*, const char*, size_t)
size_t mbtowc(wchar_t* wch, const char* data, size_t data_size)
{
ASSERT_NOT_REACHED();
// FIXME: This needs a real implementation.
UNUSED_PARAM(data_size);
if (wch && data) {
*wch = *data;
return 1;
}
if (!wch && data) {
return 1;
}
return 0;
}
int wctomb(char*, wchar_t)