mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-22 02:09:24 +00:00
LibC: Implement wctomb
This commit is contained in:
parent
52621093c7
commit
4893e3ef47
Notes:
sideshowbarker
2024-07-18 02:17:09 +09:00
Author: https://github.com/timschumi
Commit: 4893e3ef47
Pull-request: https://github.com/SerenityOS/serenity/pull/10503
1 changed files with 9 additions and 3 deletions
|
@ -29,6 +29,7 @@
|
|||
#include <sys/wait.h>
|
||||
#include <syscall.h>
|
||||
#include <unistd.h>
|
||||
#include <wchar.h>
|
||||
|
||||
static void strtons(const char* str, char** endptr)
|
||||
{
|
||||
|
@ -898,10 +899,15 @@ int mbtowc(wchar_t* wch, const char* data, [[maybe_unused]] size_t data_size)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int wctomb(char*, wchar_t)
|
||||
int wctomb(char* s, wchar_t wc)
|
||||
{
|
||||
dbgln("FIXME: Implement wctomb()");
|
||||
TODO();
|
||||
static mbstate_t _internal_state = {};
|
||||
|
||||
// nullptr asks whether we have state-dependent encodings, but we don't have any.
|
||||
if (s == nullptr)
|
||||
return 0;
|
||||
|
||||
return static_cast<int>(wcrtomb(s, wc, &_internal_state));
|
||||
}
|
||||
|
||||
size_t wcstombs(char* dest, const wchar_t* src, size_t max)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue