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@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Kevin Puetz 2020-02-11 19:52:22 +01:00 committed by Alexandre Julliard
parent d1373e8aae
commit c2679945dd
4 changed files with 16 additions and 7 deletions

View File

@ -28,8 +28,10 @@ extern "C" {
#endif #endif
typedef unsigned char SQLCHAR; typedef unsigned char SQLCHAR;
#ifdef WINE_UNICODE_NATIVE #if defined(WINE_UNICODE_NATIVE)
typedef wchar_t SQLWCHAR; typedef wchar_t SQLWCHAR;
#elif defined(WINE_UNICODE_CHAR16)
typedef char16_t SQLWCHAR;
#else #else
typedef unsigned short SQLWCHAR; typedef unsigned short SQLWCHAR;
#endif #endif

View File

@ -244,8 +244,10 @@ typedef unsigned short wctype_t;
#endif #endif
#ifndef __TCHAR_DEFINED #ifndef __TCHAR_DEFINED
#ifdef WINE_UNICODE_NATIVE #if defined(WINE_UNICODE_NATIVE)
typedef wchar_t _TCHAR; typedef wchar_t _TCHAR;
#elif defined(WINE_UNICODE_CHAR16)
typedef char16_t _TCHAR;
#else #else
typedef unsigned short _TCHAR; typedef unsigned short _TCHAR;
#endif #endif

View File

@ -463,11 +463,14 @@ typedef int LONG, *PLONG;
#endif #endif
/* Some systems might have wchar_t, but we really need 16 bit characters */ /* Some systems might have wchar_t, but we really need 16 bit characters */
#ifdef WINE_UNICODE_NATIVE #if defined(WINE_UNICODE_NATIVE)
typedef wchar_t WCHAR, *PWCHAR; typedef wchar_t WCHAR;
#elif defined(WINE_UNICODE_CHAR16)
typedef char16_t WCHAR;
#else #else
typedef unsigned short WCHAR, *PWCHAR; typedef unsigned short WCHAR;
#endif #endif
typedef WCHAR *PWCHAR;
typedef ULONG UCSCHAR; typedef ULONG UCSCHAR;
#define MIN_UCSCHAR (0) #define MIN_UCSCHAR (0)

View File

@ -24,10 +24,12 @@
* macro which only exists in the user's code. * macro which only exists in the user's code.
*/ */
#ifndef WINE_NO_UNICODE_MACROS #ifndef WINE_NO_UNICODE_MACROS
# ifdef UNICODE # ifndef UNICODE
# define __TEXT(string) string
# elif defined(WINE_UNICODE_NATIVE)
# define __TEXT(string) L##string # define __TEXT(string) L##string
# else # else
# define __TEXT(string) string # define __TEXT(string) u##string
# endif # endif
# define TEXT(string) __TEXT(string) # define TEXT(string) __TEXT(string)
#endif #endif