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/alFilter.c | |
parent | 301a8ba3a403ece650790d015995a56f27718115 (diff) |
Reduce some indentation
Diffstat (limited to 'OpenAL32/alFilter.c')
-rw-r--r-- | OpenAL32/alFilter.c | 52 |
1 files changed, 24 insertions, 28 deletions
diff --git a/OpenAL32/alFilter.c b/OpenAL32/alFilter.c index 35a58c7a..0d66b531 100644 --- a/OpenAL32/alFilter.c +++ b/OpenAL32/alFilter.c @@ -42,42 +42,38 @@ AL_API ALvoid AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters) Context = GetContextSuspended(); if(!Context) return; - if (n > 0) + if(n < 0 || IsBadWritePtr((void*)filters, n * sizeof(ALuint))) + alSetError(Context, AL_INVALID_VALUE); + else { ALCdevice *device = Context->Device; + ALenum err; - // Check that enough memory has been allocted in the 'filters' array for n Filters - if (!IsBadWritePtr((void*)filters, n * sizeof(ALuint))) + while(i < n) { - ALenum err; - - while(i < n) + ALfilter *filter = calloc(1, sizeof(ALfilter)); + if(!filter) { - ALfilter *filter = calloc(1, sizeof(ALfilter)); - if(!filter) - { - alSetError(Context, AL_OUT_OF_MEMORY); - alDeleteFilters(i, filters); - break; - } - - filter->filter = ALTHUNK_ADDENTRY(filter); - err = InsertUIntMapEntry(&device->FilterMap, filter->filter, - filter); - if(err != AL_NO_ERROR) - { - ALTHUNK_REMOVEENTRY(filter->filter); - memset(filter, 0, sizeof(ALfilter)); - free(filter); + alSetError(Context, AL_OUT_OF_MEMORY); + alDeleteFilters(i, filters); + break; + } - alSetError(Context, err); - alDeleteFilters(i, filters); - break; - } + filter->filter = ALTHUNK_ADDENTRY(filter); + err = InsertUIntMapEntry(&device->FilterMap, filter->filter, filter); + if(err != AL_NO_ERROR) + { + ALTHUNK_REMOVEENTRY(filter->filter); + memset(filter, 0, sizeof(ALfilter)); + free(filter); - filters[i++] = filter->filter; - InitFilterParams(filter, AL_FILTER_NULL); + alSetError(Context, err); + alDeleteFilters(i, filters); + break; } + + filters[i++] = filter->filter; + InitFilterParams(filter, AL_FILTER_NULL); } } |