From 76d33ee7f22829b9e7ba94989916e502fb81a84d Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 12 Mar 2024 09:12:40 +0200 Subject: [PATCH] [CRT] Add wcrtomb (from wine) --- dll/win32/msvcrt/msvcrt.spec | 2 +- sdk/lib/crt/msvcrtex.cmake | 1 + sdk/lib/crt/wstring/wcrtomb.c | 32 +++++++++++++++++++++++++++++++ sdk/lib/crt/wstring/wstring.cmake | 1 + 4 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 sdk/lib/crt/wstring/wcrtomb.c diff --git a/dll/win32/msvcrt/msvcrt.spec b/dll/win32/msvcrt/msvcrt.spec index 52437e101fb..adbd3366137 100644 --- a/dll/win32/msvcrt/msvcrt.spec +++ b/dll/win32/msvcrt/msvcrt.spec @@ -1518,7 +1518,7 @@ @ stub -version=0x600+ vswprintf_s @ cdecl vwprintf(wstr ptr) @ stub -version=0x600+ vwprintf_s -@ stub -version=0x600+ wcrtomb +@ cdecl -version=0x600+ wcrtomb(ptr long ptr) @ stub -version=0x600+ wcrtomb_s @ cdecl wcscat(wstr wstr) @ cdecl -version=0x600+ wcscat_s(wstr long wstr) diff --git a/sdk/lib/crt/msvcrtex.cmake b/sdk/lib/crt/msvcrtex.cmake index 545cfc98409..166f5645303 100644 --- a/sdk/lib/crt/msvcrtex.cmake +++ b/sdk/lib/crt/msvcrtex.cmake @@ -15,6 +15,7 @@ if(DLL_EXPORT_VERSION LESS 0x600) misc/dbgrpt.cpp stdlib/_invalid_parameter.c stdlib/rand_s.c + wstring/wcrtomb.c ) endif() diff --git a/sdk/lib/crt/wstring/wcrtomb.c b/sdk/lib/crt/wstring/wcrtomb.c new file mode 100644 index 00000000000..574ee8e8501 --- /dev/null +++ b/sdk/lib/crt/wstring/wcrtomb.c @@ -0,0 +1,32 @@ +/* + * msvcrt.dll mbcs functions + * + * Copyright 1999 Alexandre Julliard + * Copyright 2000 Jon Griffths + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include + +/********************************************************************* + * wcrtomb (MSVCRT.@) + */ +size_t CDECL wcrtomb( char *dst, wchar_t ch, mbstate_t *s) +{ + if(s) + *s = 0; + return wctomb(dst, ch); +} diff --git a/sdk/lib/crt/wstring/wstring.cmake b/sdk/lib/crt/wstring/wstring.cmake index e636367cf11..8439a6ae181 100644 --- a/sdk/lib/crt/wstring/wstring.cmake +++ b/sdk/lib/crt/wstring/wstring.cmake @@ -11,6 +11,7 @@ list(APPEND LIBCNTPR_WSTRING_SOURCE list(APPEND CRT_WSTRING_SOURCE ${LIBCNTPR_WSTRING_SOURCE} + wstring/wcrtomb.c wstring/wcscoll.c wstring/wcstok.c wstring/wcsxfrm.c