Small changes to improve compatibility with GCC. (PR #902)

* Fix GCC build.

1) do not fwd declare enums
2) include only base class header file IPropertySheet.

* DSInit(): make sure sound devices are cleaned before the 2nd call.

And use std::string to avoid need of memory management.
This commit is contained in:
Andrea
2020-12-29 21:17:03 +00:00
committed by GitHub
parent 6cf907f303
commit b226bdfd53
3 changed files with 8 additions and 4 deletions
+5 -2
View File
@@ -38,7 +38,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#define MAX_SOUND_DEVICES 10
static char *sound_devices[MAX_SOUND_DEVICES];
static std::string sound_devices[MAX_SOUND_DEVICES];
static GUID sound_device_guid[MAX_SOUND_DEVICES];
static int num_sound_devices = 0;
@@ -67,7 +67,9 @@ static BOOL CALLBACK DSEnumProc(LPGUID lpGUID, LPCTSTR lpszDesc, LPCTSTR lpszDrv
return TRUE;
if(lpGUID != NULL)
memcpy(&sound_device_guid[i], lpGUID, sizeof (GUID));
sound_devices[i] = _strdup(lpszDesc);
else
memset(&sound_device_guid[i], 0, sizeof(GUID));
sound_devices[i] = lpszDesc;
if(g_fh) fprintf(g_fh, "%d: %s - %s\n",i,lpszDesc,lpszDrvName);
@@ -491,6 +493,7 @@ bool DSInit()
return true; // Already initialised successfully
}
num_sound_devices = 0;
HRESULT hr = DirectSoundEnumerate((LPDSENUMCALLBACK)DSEnumProc, NULL);
if(FAILED(hr))
{