diff options
Diffstat (limited to 'OpenAL32/alAuxEffectSlot.c')
-rw-r--r-- | OpenAL32/alAuxEffectSlot.c | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c index dfc0ad18..5d86409f 100644 --- a/OpenAL32/alAuxEffectSlot.c +++ b/OpenAL32/alAuxEffectSlot.c @@ -104,52 +104,53 @@ AL_API ALvoid AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, ALuint *effect { ALCcontext *Context; ALeffectslot *EffectSlot; + ALboolean SlotsValid = AL_FALSE; ALsizei i; Context = GetContextSuspended(); if(!Context) return; - if (n >= 0) + if(n < 0) + alSetError(Context, AL_INVALID_VALUE); + else { + SlotsValid = AL_TRUE; // Check that all effectslots are valid - for (i = 0; i < n; i++) + for(i = 0;i < n;i++) { if((EffectSlot=LookupEffectSlot(Context->EffectSlotMap, effectslots[i])) == NULL) { alSetError(Context, AL_INVALID_NAME); + SlotsValid = AL_FALSE; break; } - else + else if(EffectSlot->refcount > 0) { - if(EffectSlot->refcount > 0) - { - alSetError(Context, AL_INVALID_NAME); - break; - } + alSetError(Context, AL_INVALID_NAME); + SlotsValid = AL_FALSE; + break; } } + } - if (i == n) + if(SlotsValid) + { + // All effectslots are valid + for(i = 0;i < n;i++) { - // All effectslots are valid - for (i = 0; i < n; i++) - { - // Recheck that the effectslot is valid, because there could be duplicated names - if((EffectSlot=LookupEffectSlot(Context->EffectSlotMap, effectslots[i])) != NULL) - { - ALEffect_Destroy(EffectSlot->EffectState); + // Recheck that the effectslot is valid, because there could be duplicated names + if((EffectSlot=LookupEffectSlot(Context->EffectSlotMap, effectslots[i])) == NULL) + continue; - RemoveUIntMapKey(&Context->EffectSlotMap, EffectSlot->effectslot); - ALTHUNK_REMOVEENTRY(EffectSlot->effectslot); + ALEffect_Destroy(EffectSlot->EffectState); - memset(EffectSlot, 0, sizeof(ALeffectslot)); - free(EffectSlot); - } - } + RemoveUIntMapKey(&Context->EffectSlotMap, EffectSlot->effectslot); + ALTHUNK_REMOVEENTRY(EffectSlot->effectslot); + + memset(EffectSlot, 0, sizeof(ALeffectslot)); + free(EffectSlot); } } - else - alSetError(Context, AL_INVALID_VALUE); ProcessContext(Context); } |