diff options
author | Chris Robinson <[email protected]> | 2008-02-15 21:09:19 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2008-02-15 21:09:19 -0800 |
commit | ffe7a11866f7314022ae4d4ed5b26ed2beab7b6d (patch) | |
tree | 2fd151e56755a0e23a53e9470e21f522ef2ac7c5 /Alc/dsound.c | |
parent | 8c3188bc7dc2f47a27398fc61ed2dacd36397190 (diff) |
Avoid a static variable for enumerating
Diffstat (limited to 'Alc/dsound.c')
-rw-r--r-- | Alc/dsound.c | 12 |
1 files 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); } |