Kevin Puetz : include: Introduce WINE_UNICODE_CHAR16 that allows using char16_t as Windows WCHAR.
Module: wine Branch: master Commit: c2679945dd1ffddbc8e8a43dc7263be7738d4a4e URL: https://source.winehq.org/git/wine.git/?a=commit;h=c2679945dd1ffddbc8e8a43dc... Author: Kevin Puetz <PuetzKevinA(a)JohnDeere.com> Date: Tue Feb 11 19:52:22 2020 +0100 include: Introduce WINE_UNICODE_CHAR16 that allows using char16_t as Windows WCHAR. This is useful for winelib applications that don't use -fshort-wchar. They may use u"" for string literals and u16string. However, C++ has builtin char16_t type, so we need WCHAR to be compatible with that. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- include/sqltypes.h | 4 +++- include/tchar.h | 4 +++- include/winnt.h | 9 ++++++--- include/winnt.rh | 6 ++++-- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/include/sqltypes.h b/include/sqltypes.h index 4f3f8fe9f1..0923f6b362 100644 --- a/include/sqltypes.h +++ b/include/sqltypes.h @@ -28,8 +28,10 @@ extern "C" { #endif typedef unsigned char SQLCHAR; -#ifdef WINE_UNICODE_NATIVE +#if defined(WINE_UNICODE_NATIVE) typedef wchar_t SQLWCHAR; +#elif defined(WINE_UNICODE_CHAR16) +typedef char16_t SQLWCHAR; #else typedef unsigned short SQLWCHAR; #endif diff --git a/include/tchar.h b/include/tchar.h index 5234a70bd9..d5e4983756 100644 --- a/include/tchar.h +++ b/include/tchar.h @@ -244,8 +244,10 @@ typedef unsigned short wctype_t; #endif #ifndef __TCHAR_DEFINED -#ifdef WINE_UNICODE_NATIVE +#if defined(WINE_UNICODE_NATIVE) typedef wchar_t _TCHAR; +#elif defined(WINE_UNICODE_CHAR16) +typedef char16_t _TCHAR; #else typedef unsigned short _TCHAR; #endif diff --git a/include/winnt.h b/include/winnt.h index adc5d3d686..adb7ef5669 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -463,11 +463,14 @@ typedef int LONG, *PLONG; #endif /* Some systems might have wchar_t, but we really need 16 bit characters */ -#ifdef WINE_UNICODE_NATIVE -typedef wchar_t WCHAR, *PWCHAR; +#if defined(WINE_UNICODE_NATIVE) +typedef wchar_t WCHAR; +#elif defined(WINE_UNICODE_CHAR16) +typedef char16_t WCHAR; #else -typedef unsigned short WCHAR, *PWCHAR; +typedef unsigned short WCHAR; #endif +typedef WCHAR *PWCHAR; typedef ULONG UCSCHAR; #define MIN_UCSCHAR (0) diff --git a/include/winnt.rh b/include/winnt.rh index 59791bc996..786a38f326 100644 --- a/include/winnt.rh +++ b/include/winnt.rh @@ -24,10 +24,12 @@ * macro which only exists in the user's code. */ #ifndef WINE_NO_UNICODE_MACROS -# ifdef UNICODE +# ifndef UNICODE +# define __TEXT(string) string +# elif defined(WINE_UNICODE_NATIVE) # define __TEXT(string) L##string # else -# define __TEXT(string) string +# define __TEXT(string) u##string # endif # define TEXT(string) __TEXT(string) #endif
participants (1)
-
Alexandre Julliard