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/alBuffer.c | |
parent | 301a8ba3a403ece650790d015995a56f27718115 (diff) |
Reduce some indentation
Diffstat (limited to 'OpenAL32/alBuffer.c')
-rw-r--r-- | OpenAL32/alBuffer.c | 49 |
1 files changed, 21 insertions, 28 deletions
diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c index 6ea11cdd..f00ac58b 100644 --- a/OpenAL32/alBuffer.c +++ b/OpenAL32/alBuffer.c @@ -114,45 +114,38 @@ AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *buffers) Context = GetContextSuspended(); if(!Context) return; - // Check that we are actually generation some Buffers - if(n < 0) + // Check that we are actually generating some Buffers + if(n < 0 || IsBadWritePtr((void*)buffers, n * sizeof(ALuint))) alSetError(Context, AL_INVALID_VALUE); else { ALCdevice *device = Context->Device; ALenum err; - // Check the pointer is valid (and points to enough memory to store Buffer Names) - if(IsBadWritePtr((void*)buffers, n * sizeof(ALuint))) - alSetError(Context, AL_INVALID_VALUE); - else + // Create all the new Buffers + while(i < n) { - // Create all the new Buffers - while(i < n) + ALbuffer *buffer = calloc(1, sizeof(ALbuffer)); + if(!buffer) { - ALbuffer *buffer = calloc(1, sizeof(ALbuffer)); - if(!buffer) - { - alSetError(Context, AL_OUT_OF_MEMORY); - alDeleteBuffers(i, buffers); - break; - } + alSetError(Context, AL_OUT_OF_MEMORY); + alDeleteBuffers(i, buffers); + break; + } - buffer->buffer = (ALuint)ALTHUNK_ADDENTRY(buffer); - err = InsertUIntMapEntry(&device->BufferMap, buffer->buffer, - buffer); - if(err != AL_NO_ERROR) - { - ALTHUNK_REMOVEENTRY(buffer->buffer); - memset(buffer, 0, sizeof(ALbuffer)); - free(buffer); + buffer->buffer = (ALuint)ALTHUNK_ADDENTRY(buffer); + err = InsertUIntMapEntry(&device->BufferMap, buffer->buffer, buffer); + if(err != AL_NO_ERROR) + { + ALTHUNK_REMOVEENTRY(buffer->buffer); + memset(buffer, 0, sizeof(ALbuffer)); + free(buffer); - alSetError(Context, err); - alDeleteBuffers(i, buffers); - break; - } - buffers[i++] = buffer->buffer; + alSetError(Context, err); + alDeleteBuffers(i, buffers); + break; } + buffers[i++] = buffer->buffer; } } |