From ffe7a11866f7314022ae4d4ed5b26ed2beab7b6d Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 15 Feb 2008 21:09:19 -0800 Subject: [PATCH] Avoid a static variable for enumerating --- Alc/dsound.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Alc/dsound.c b/Alc/dsound.c index 6dc87057..61be8f44 100644 --- a/Alc/dsound.c +++ b/Alc/dsound.c @@ -365,17 +365,16 @@ BackendFuncs DSoundFuncs = { static BOOL CALLBACK DSoundEnumDevices(LPGUID guid, LPCSTR desc, LPCSTR drvname, LPVOID data) { - static size_t i = 1; + size_t *iter = data; (void)drvname; - (void)data; if(guid) { char str[128]; snprintf(str, sizeof(str), "DirectSound Software on %s", desc); - DeviceList[i].name = AppendAllDeviceList(str); - DeviceList[i].guid = *guid; - i++; + DeviceList[*iter].name = AppendAllDeviceList(str); + DeviceList[*iter].guid = *guid; + (*iter)++; } else DeviceList[0].name = AppendDeviceList("DirectSound Software"); @@ -385,11 +384,12 @@ static BOOL CALLBACK DSoundEnumDevices(LPGUID guid, LPCSTR desc, LPCSTR drvname, void alcDSoundInit(BackendFuncs *FuncList) { + size_t iter = 1; HRESULT hr; *FuncList = DSoundFuncs; - hr = DirectSoundEnumerate(DSoundEnumDevices, NULL); + hr = DirectSoundEnumerate(DSoundEnumDevices, &iter); if(FAILED(hr)) AL_PRINT("Error enumerating DirectSound devices (%#x)!\n", (unsigned int)hr); } -- 2.11.4.GIT