XAudio2/DirectSound: Use the usual Windows string convert (thanks, Norfanin!).
1.1 --- a/src/audio/directsound/SDL_directsound.c Thu Aug 22 13:00:05 2013 -0400
1.2 +++ b/src/audio/directsound/SDL_directsound.c Thu Aug 22 13:32:27 2013 -0400
1.3 @@ -91,14 +91,6 @@
1.4 return loaded;
1.5 }
1.6
1.7 -static __inline__ char *
1.8 -utf16_to_utf8(const WCHAR *S)
1.9 -{
1.10 - /* !!! FIXME: this should be UTF-16, not UCS-2! */
1.11 - return SDL_iconv_string("UTF-8", "UCS-2", (char *)(S),
1.12 - (SDL_wcslen(S)+1)*sizeof(WCHAR));
1.13 -}
1.14 -
1.15 static int
1.16 SetDSerror(const char *function, int code)
1.17 {
1.18 @@ -158,7 +150,7 @@
1.19 {
1.20 SDL_AddAudioDevice addfn = (SDL_AddAudioDevice) data;
1.21 if (guid != NULL) { /* skip default device */
1.22 - char *str = utf16_to_utf8(desc);
1.23 + char *str = WIN_StringToUTF8(desc);
1.24 if (str != NULL) {
1.25 addfn(str);
1.26 SDL_free(str); /* addfn() makes a copy of this string. */
1.27 @@ -439,7 +431,7 @@
1.28 {
1.29 if (guid != NULL) { /* skip the default device. */
1.30 FindDevGUIDData *data = (FindDevGUIDData *) _data;
1.31 - char *str = utf16_to_utf8(desc);
1.32 + char *str = WIN_StringToUTF8(desc);
1.33 const int match = (SDL_strcmp(str, data->devname) == 0);
1.34 SDL_free(str);
1.35 if (match) {
2.1 --- a/src/audio/xaudio2/SDL_xaudio2.c Thu Aug 22 13:00:05 2013 -0400
2.2 +++ b/src/audio/xaudio2/SDL_xaudio2.c Thu Aug 22 13:32:27 2013 -0400
2.3 @@ -60,14 +60,6 @@
2.4 };
2.5
2.6
2.7 -static __inline__ char *
2.8 -utf16_to_utf8(const WCHAR *S)
2.9 -{
2.10 - /* !!! FIXME: this should be UTF-16, not UCS-2! */
2.11 - return SDL_iconv_string("UTF-8", "UCS-2", (char *)(S),
2.12 - (SDL_wcslen(S)+1)*sizeof(WCHAR));
2.13 -}
2.14 -
2.15 static void
2.16 XAUDIO2_DetectDevices(int iscapture, SDL_AddAudioDevice addfn)
2.17 {
2.18 @@ -90,7 +82,7 @@
2.19 for (i = 0; i < devcount; i++) {
2.20 XAUDIO2_DEVICE_DETAILS details;
2.21 if (IXAudio2_GetDeviceDetails(ixa2, i, &details) == S_OK) {
2.22 - char *str = utf16_to_utf8(details.DisplayName);
2.23 + char *str = WIN_StringToUTF8(details.DisplayName);
2.24 if (str != NULL) {
2.25 addfn(str);
2.26 SDL_free(str); /* addfn() made a copy of the string. */
2.27 @@ -265,7 +257,7 @@
2.28 for (i = 0; i < devcount; i++) {
2.29 XAUDIO2_DEVICE_DETAILS details;
2.30 if (IXAudio2_GetDeviceDetails(ixa2, i, &details) == S_OK) {
2.31 - char *str = utf16_to_utf8(details.DisplayName);
2.32 + char *str = WIN_StringToUTF8(details.DisplayName);
2.33 if (str != NULL) {
2.34 const int match = (SDL_strcmp(str, devname) == 0);
2.35 SDL_free(str);