1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-10 07:07:36 +00:00

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
parent 680a873b76
commit 4f27745136

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)