make ANSI/UNICODE versions of WIN??UTF8 macros individually available.

This commit is contained in:
Ozkan Sezer 2021-01-04 10:00:10 +03:00
parent f2bd861cd7
commit 5b14bbff5f

View file

@ -38,18 +38,18 @@
#include <basetyps.h> /* for REFIID with broken mingw.org headers */ #include <basetyps.h> /* for REFIID with broken mingw.org headers */
/* Routines to convert from UTF8 to native Windows text */ /* Routines to convert from UTF8 to native Windows text */
#if UNICODE #define WIN_StringToUTF8W(S) SDL_iconv_string("UTF-8", "UTF-16LE", (char *)(S), (SDL_wcslen(S)+1)*sizeof(WCHAR))
#define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "UTF-16LE", (char *)(S), (SDL_wcslen(S)+1)*sizeof(WCHAR)) #define WIN_UTF8ToStringW(S) (WCHAR *)SDL_iconv_string("UTF-16LE", "UTF-8", (char *)(S), SDL_strlen(S)+1)
#define WIN_UTF8ToString(S) (WCHAR *)SDL_iconv_string("UTF-16LE", "UTF-8", (char *)(S), SDL_strlen(S)+1)
#else
/* !!! FIXME: UTF8ToString() can just be a SDL_strdup() here. */ /* !!! FIXME: UTF8ToString() can just be a SDL_strdup() here. */
#define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "ASCII", (char *)(S), (SDL_strlen(S)+1)) #define WIN_StringToUTF8A(S) SDL_iconv_string("UTF-8", "ASCII", (char *)(S), (SDL_strlen(S)+1))
#define WIN_UTF8ToString(S) SDL_iconv_string("ASCII", "UTF-8", (char *)(S), SDL_strlen(S)+1) #define WIN_UTF8ToStringA(S) SDL_iconv_string("ASCII", "UTF-8", (char *)(S), SDL_strlen(S)+1)
#endif #if UNICODE
#define WIN_StringToUTF8 WIN_StringToUTF8W
#ifdef UNICODE #define WIN_UTF8ToString WIN_UTF8ToStringW
#define SDL_tcsstr SDL_wcsstr #define SDL_tcsstr SDL_wcsstr
#else #else
#define WIN_StringToUTF8 WIN_StringToUTF8A
#define WIN_UTF8ToString WIN_UTF8ToStringA
#define SDL_tcsstr SDL_strstr #define SDL_tcsstr SDL_strstr
#endif #endif