diff options
Diffstat (limited to 'OpenAL32/alEffect.c')
-rw-r--r-- | OpenAL32/alEffect.c | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/OpenAL32/alEffect.c b/OpenAL32/alEffect.c index e1c022a0..0814cfe0 100644 --- a/OpenAL32/alEffect.c +++ b/OpenAL32/alEffect.c @@ -87,48 +87,52 @@ AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects) AL_API ALvoid AL_APIENTRY alDeleteEffects(ALsizei n, ALuint *effects) { ALCcontext *Context; + ALCdevice *device; ALeffect *ALEffect; + ALboolean Failed; ALsizei i; Context = GetContextSuspended(); if(!Context) return; - if (n >= 0) + Failed = AL_TRUE; + device = Context->Device; + if(n < 0) + alSetError(Context, AL_INVALID_VALUE); + else { - ALCdevice *device = Context->Device; - + Failed = AL_FALSE; // Check that all effects are valid - for (i = 0; i < n; i++) + for(i = 0;i < n;i++) { if(!effects[i]) continue; - if(!LookupEffect(device->EffectMap, effects[i])) + if(LookupEffect(device->EffectMap, effects[i]) == NULL) { alSetError(Context, AL_INVALID_NAME); + Failed = AL_TRUE; break; } } + } - if (i == n) + if(!Failed) + { + // All effects are valid + for(i = 0;i < n;i++) { - // All effects are valid - for (i = 0; i < n; i++) - { - // Recheck that the effect is valid, because there could be duplicated names - if((ALEffect=LookupEffect(device->EffectMap, effects[i])) != NULL) - { - RemoveUIntMapKey(&device->EffectMap, ALEffect->effect); - ALTHUNK_REMOVEENTRY(ALEffect->effect); + // Recheck that the effect is valid, because there could be duplicated names + if((ALEffect=LookupEffect(device->EffectMap, effects[i])) == NULL) + continue; - memset(ALEffect, 0, sizeof(ALeffect)); - free(ALEffect); - } - } + RemoveUIntMapKey(&device->EffectMap, ALEffect->effect); + ALTHUNK_REMOVEENTRY(ALEffect->effect); + + memset(ALEffect, 0, sizeof(ALeffect)); + free(ALEffect); } } - else - alSetError(Context, AL_INVALID_VALUE); ProcessContext(Context); } |