@@ -58,42 +58,6 @@ static const IID SDL_IID_IAudioCaptureClient = { 0xc8adbd64, 0xe71e, 0x48a0,{ 0x
5858static const GUID SDL_KSDATAFORMAT_SUBTYPE_PCM = { 0x00000001 , 0x0000 , 0x0010 ,{ 0x80 , 0x00 , 0x00 , 0xaa , 0x00 , 0x38 , 0x9b , 0x71 } };
5959static const GUID SDL_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT = { 0x00000003 , 0x0000 , 0x0010 ,{ 0x80 , 0x00 , 0x00 , 0xaa , 0x00 , 0x38 , 0x9b , 0x71 } };
6060
61- static SDL_bool
62- WStrEqual (const WCHAR * a , const WCHAR * b )
63- {
64- while (* a ) {
65- if (* a != * b ) {
66- return SDL_FALSE ;
67- }
68- a ++ ;
69- b ++ ;
70- }
71- return * b == 0 ;
72- }
73-
74- static size_t
75- WStrLen (const WCHAR * wstr )
76- {
77- size_t retval = 0 ;
78- if (wstr ) {
79- while (* (wstr ++ )) {
80- retval ++ ;
81- }
82- }
83- return retval ;
84- }
85-
86- static WCHAR *
87- WStrDupe (const WCHAR * wstr )
88- {
89- const size_t len = (WStrLen (wstr ) + 1 ) * sizeof (WCHAR );
90- WCHAR * retval = (WCHAR * ) SDL_malloc (len );
91- if (retval ) {
92- SDL_memcpy (retval , wstr , len );
93- }
94- return retval ;
95- }
96-
9761
9862void
9963WASAPI_RemoveDevice (const SDL_bool iscapture , LPCWSTR devid )
@@ -103,7 +67,7 @@ WASAPI_RemoveDevice(const SDL_bool iscapture, LPCWSTR devid)
10367 DevIdList * prev = NULL ;
10468 for (i = deviceid_list ; i ; i = next ) {
10569 next = i -> next ;
106- if (WStrEqual (i -> str , devid )) {
70+ if (SDL_wcscmp (i -> str , devid ) == 0 ) {
10771 if (prev ) {
10872 prev -> next = next ;
10973 } else {
@@ -153,7 +117,7 @@ WASAPI_AddDevice(const SDL_bool iscapture, const char *devname, WAVEFORMATEXTENS
153117
154118 /* see if we already have this one. */
155119 for (devidlist = deviceid_list ; devidlist ; devidlist = devidlist -> next ) {
156- if (WStrEqual (devidlist -> str , devid )) {
120+ if (SDL_wcscmp (devidlist -> str , devid ) == 0 ) {
157121 return ; /* we already have this. */
158122 }
159123 }
@@ -163,7 +127,7 @@ WASAPI_AddDevice(const SDL_bool iscapture, const char *devname, WAVEFORMATEXTENS
163127 return ; /* oh well. */
164128 }
165129
166- devid = WStrDupe (devid );
130+ devid = SDL_wcsdup (devid );
167131 if (!devid ) {
168132 SDL_free (devidlist );
169133 return ; /* oh well. */
@@ -690,7 +654,7 @@ WASAPI_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
690654 if (!devid ) { /* is default device? */
691655 this -> hidden -> default_device_generation = SDL_AtomicGet (iscapture ? & WASAPI_DefaultCaptureGeneration : & WASAPI_DefaultPlaybackGeneration );
692656 } else {
693- this -> hidden -> devid = WStrDupe (devid );
657+ this -> hidden -> devid = SDL_wcsdup (devid );
694658 if (!this -> hidden -> devid ) {
695659 return SDL_OutOfMemory ();
696660 }
0 commit comments