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/alDatabuffer.c | |
parent | 301a8ba3a403ece650790d015995a56f27718115 (diff) |
Reduce some indentation
Diffstat (limited to 'OpenAL32/alDatabuffer.c')
-rw-r--r-- | OpenAL32/alDatabuffer.c | 58 |
1 files changed, 26 insertions, 32 deletions
diff --git a/OpenAL32/alDatabuffer.c b/OpenAL32/alDatabuffer.c index b799f133..060aaf0c 100644 --- a/OpenAL32/alDatabuffer.c +++ b/OpenAL32/alDatabuffer.c @@ -48,47 +48,41 @@ AL_API ALvoid AL_APIENTRY alGenDatabuffersEXT(ALsizei n,ALuint *puiBuffers) if(!Context) return; /* Check that we are actually generation some Databuffers */ - if(n > 0) + if(n < 0 || IsBadWritePtr((void*)puiBuffers, 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 - * Databuffer Names) */ - if(!IsBadWritePtr((void*)puiBuffers, n * sizeof(ALuint))) + /* Create all the new Databuffers */ + while(i < n) { - ALenum err; - - /* Create all the new Databuffers */ - while(i < n) + ALdatabuffer *buffer = calloc(1, sizeof(ALdatabuffer)); + if(!buffer) { - ALdatabuffer *buffer = calloc(1, sizeof(ALdatabuffer)); - if(!buffer) - { - alSetError(Context, AL_OUT_OF_MEMORY); - alDeleteDatabuffersEXT(i, puiBuffers); - break; - } - - buffer->databuffer = ALTHUNK_ADDENTRY(buffer); - err = InsertUIntMapEntry(&device->DatabufferMap, - buffer->databuffer, buffer); - if(err != AL_NO_ERROR) - { - ALTHUNK_REMOVEENTRY(buffer->databuffer); - memset(buffer, 0, sizeof(ALdatabuffer)); - free(buffer); + alSetError(Context, AL_OUT_OF_MEMORY); + alDeleteDatabuffersEXT(i, puiBuffers); + break; + } - alSetError(Context, err); - alDeleteDatabuffersEXT(i, puiBuffers); - break; - } - puiBuffers[i++] = buffer->databuffer; + buffer->databuffer = ALTHUNK_ADDENTRY(buffer); + err = InsertUIntMapEntry(&device->DatabufferMap, + buffer->databuffer, buffer); + if(err != AL_NO_ERROR) + { + ALTHUNK_REMOVEENTRY(buffer->databuffer); + memset(buffer, 0, sizeof(ALdatabuffer)); + free(buffer); - buffer->state = UNMAPPED; + alSetError(Context, err); + alDeleteDatabuffersEXT(i, puiBuffers); + break; } + puiBuffers[i++] = buffer->databuffer; + + buffer->state = UNMAPPED; } - else - alSetError(Context, AL_INVALID_VALUE); } ProcessContext(Context); |