From d3e90b58e7a5cbb1b74da98aed9dd4ec18c84d77 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Mon, 22 Nov 2021 09:47:19 +0100 Subject: lib: wchar: add wctomb and mbtowc We currently convert wchar_t to char by truncating to 8-bit. In future, we may want to do UTF-16 to UTF-8 conversion. Prepare for this by wrapping each conversion direction in a function. Signed-off-by: Ahmad Fatoum Link: https://lore.barebox.org/20211122084732.2597109-18-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer --- include/wchar.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/wchar.h b/include/wchar.h index b601cc6207..fb9b127a8c 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -17,4 +17,9 @@ char *strdup_wchar_to_char(const wchar_t *src); size_t wcslen(const wchar_t *s); +#define MB_CUR_MAX 4 + +int mbtowc(wchar_t *pwc, const char *s, size_t n); +int wctomb(char *s, wchar_t wc); + #endif /* __WCHAR_H */ -- cgit v1.2.3