diff options
author | Chris Robinson <[email protected]> | 2010-09-21 15:12:08 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2010-09-21 15:12:08 -0700 |
commit | 8a1d5a21c3b569424bdbe5b92d9e53aab00a60c6 (patch) | |
tree | 02f9a98b8c3a6f374dfa29049932c6969beb2c09 /OpenAL32/alEffect.c | |
parent | 301a8ba3a403ece650790d015995a56f27718115 (diff) |
Reduce some indentation
Diffstat (limited to 'OpenAL32/alEffect.c')
-rw-r--r-- | OpenAL32/alEffect.c | 52 |
1 files changed, 24 insertions, 28 deletions
diff --git a/OpenAL32/alEffect.c b/OpenAL32/alEffect.c index f3109ca2..e1c022a0 100644 --- a/OpenAL32/alEffect.c +++ b/OpenAL32/alEffect.c @@ -46,42 +46,38 @@ AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects) Context = GetContextSuspended(); if(!Context) return; - if (n > 0) + if(n < 0 || IsBadWritePtr((void*)effects, n * sizeof(ALuint))) + alSetError(Context, AL_INVALID_VALUE); + else { ALCdevice *device = Context->Device; + ALenum err; - // Check that enough memory has been allocted in the 'effects' array for n Effects - if (!IsBadWritePtr((void*)effects, n * sizeof(ALuint))) + while(i < n) { - ALenum err; - - while(i < n) + ALeffect *effect = calloc(1, sizeof(ALeffect)); + if(!effect) { - ALeffect *effect = calloc(1, sizeof(ALeffect)); - if(!effect) - { - alSetError(Context, AL_OUT_OF_MEMORY); - alDeleteEffects(i, effects); - break; - } - - effect->effect = ALTHUNK_ADDENTRY(effect); - err = InsertUIntMapEntry(&device->EffectMap, effect->effect, - effect); - if(err != AL_NO_ERROR) - { - ALTHUNK_REMOVEENTRY(effect->effect); - memset(effect, 0, sizeof(ALeffect)); - free(effect); + alSetError(Context, AL_OUT_OF_MEMORY); + alDeleteEffects(i, effects); + break; + } - alSetError(Context, err); - alDeleteEffects(i, effects); - break; - } + effect->effect = ALTHUNK_ADDENTRY(effect); + err = InsertUIntMapEntry(&device->EffectMap, effect->effect, effect); + if(err != AL_NO_ERROR) + { + ALTHUNK_REMOVEENTRY(effect->effect); + memset(effect, 0, sizeof(ALeffect)); + free(effect); - effects[i++] = effect->effect; - InitEffectParams(effect, AL_EFFECT_NULL); + alSetError(Context, err); + alDeleteEffects(i, effects); + break; } + + effects[i++] = effect->effect; + InitEffectParams(effect, AL_EFFECT_NULL); } } |