XAudio2/DirectSound: Use the usual Windows string convert (thanks, Norfanin!).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
diff --git a/src/audio/directsound/SDL_directsound.c b/src/audio/directsound/SDL_directsound.c
index 23167bf..86563a6 100644
--- a/src/audio/directsound/SDL_directsound.c
+++ b/src/audio/directsound/SDL_directsound.c
@@ -91,14 +91,6 @@ DSOUND_Load(void)
return loaded;
}
-static __inline__ char *
-utf16_to_utf8(const WCHAR *S)
-{
- /* !!! FIXME: this should be UTF-16, not UCS-2! */
- return SDL_iconv_string("UTF-8", "UCS-2", (char *)(S),
- (SDL_wcslen(S)+1)*sizeof(WCHAR));
-}
-
static int
SetDSerror(const char *function, int code)
{
@@ -158,7 +150,7 @@ FindAllDevs(LPGUID guid, LPCWSTR desc, LPCWSTR module, LPVOID data)
{
SDL_AddAudioDevice addfn = (SDL_AddAudioDevice) data;
if (guid != NULL) { /* skip default device */
- char *str = utf16_to_utf8(desc);
+ char *str = WIN_StringToUTF8(desc);
if (str != NULL) {
addfn(str);
SDL_free(str); /* addfn() makes a copy of this string. */
@@ -439,7 +431,7 @@ FindDevGUID(LPGUID guid, LPCWSTR desc, LPCWSTR module, LPVOID _data)
{
if (guid != NULL) { /* skip the default device. */
FindDevGUIDData *data = (FindDevGUIDData *) _data;
- char *str = utf16_to_utf8(desc);
+ char *str = WIN_StringToUTF8(desc);
const int match = (SDL_strcmp(str, data->devname) == 0);
SDL_free(str);
if (match) {
diff --git a/src/audio/xaudio2/SDL_xaudio2.c b/src/audio/xaudio2/SDL_xaudio2.c
index a2c45ba..5af4b30 100644
--- a/src/audio/xaudio2/SDL_xaudio2.c
+++ b/src/audio/xaudio2/SDL_xaudio2.c
@@ -60,14 +60,6 @@ struct SDL_PrivateAudioData
};
-static __inline__ char *
-utf16_to_utf8(const WCHAR *S)
-{
- /* !!! FIXME: this should be UTF-16, not UCS-2! */
- return SDL_iconv_string("UTF-8", "UCS-2", (char *)(S),
- (SDL_wcslen(S)+1)*sizeof(WCHAR));
-}
-
static void
XAUDIO2_DetectDevices(int iscapture, SDL_AddAudioDevice addfn)
{
@@ -90,7 +82,7 @@ XAUDIO2_DetectDevices(int iscapture, SDL_AddAudioDevice addfn)
for (i = 0; i < devcount; i++) {
XAUDIO2_DEVICE_DETAILS details;
if (IXAudio2_GetDeviceDetails(ixa2, i, &details) == S_OK) {
- char *str = utf16_to_utf8(details.DisplayName);
+ char *str = WIN_StringToUTF8(details.DisplayName);
if (str != NULL) {
addfn(str);
SDL_free(str); /* addfn() made a copy of the string. */
@@ -265,7 +257,7 @@ XAUDIO2_OpenDevice(_THIS, const char *devname, int iscapture)
for (i = 0; i < devcount; i++) {
XAUDIO2_DEVICE_DETAILS details;
if (IXAudio2_GetDeviceDetails(ixa2, i, &details) == S_OK) {
- char *str = utf16_to_utf8(details.DisplayName);
+ char *str = WIN_StringToUTF8(details.DisplayName);
if (str != NULL) {
const int match = (SDL_strcmp(str, devname) == 0);
SDL_free(str);