diff options
-rw-r--r-- | OpenAL32/alBuffer.c | 2 | ||||
-rw-r--r-- | OpenAL32/alEffect.c | 8 | ||||
-rw-r--r-- | OpenAL32/alFilter.c | 8 | ||||
-rw-r--r-- | OpenAL32/alSource.c | 10 |
4 files changed, 16 insertions, 12 deletions
diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c index a8ad855f..10f661f6 100644 --- a/OpenAL32/alBuffer.c +++ b/OpenAL32/alBuffer.c @@ -1258,6 +1258,7 @@ static ALbuffer *AllocBuffer(ALCcontext *context) if(UNLIKELY(VECTOR_SIZE(device->BufferList) >= 1<<25)) { almtx_unlock(&device->BufferLock); + alSetError(context, AL_OUT_OF_MEMORY, "Too many buffers allocated"); return NULL; } lidx = (ALsizei)VECTOR_SIZE(device->BufferList); @@ -1269,6 +1270,7 @@ static ALbuffer *AllocBuffer(ALCcontext *context) { VECTOR_POP_BACK(device->BufferList); almtx_unlock(&device->BufferLock); + alSetError(context, AL_OUT_OF_MEMORY, "Failed to allocate buffer batch"); return NULL; } diff --git a/OpenAL32/alEffect.c b/OpenAL32/alEffect.c index 797687fa..0fa2ee08 100644 --- a/OpenAL32/alEffect.c +++ b/OpenAL32/alEffect.c @@ -83,9 +83,8 @@ AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects) if(!context) return; if(!(n >= 0)) - SETERR_GOTO(context, AL_INVALID_VALUE, done, "Generating %d effects", n); - - for(cur = 0;cur < n;cur++) + alSetError(context, AL_INVALID_VALUE, "Generating %d effects", n); + else for(cur = 0;cur < n;cur++) { ALeffect *effect = AllocEffect(context); if(!effect) @@ -96,7 +95,6 @@ AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects) effects[cur] = effect->id; } -done: ALCcontext_DecRef(context); } @@ -407,6 +405,7 @@ static ALeffect *AllocEffect(ALCcontext *context) if(UNLIKELY(VECTOR_SIZE(device->EffectList) >= 1<<25)) { almtx_unlock(&device->EffectLock); + alSetError(context, AL_OUT_OF_MEMORY, "Too many effects allocated"); return NULL; } lidx = (ALsizei)VECTOR_SIZE(device->EffectList); @@ -418,6 +417,7 @@ static ALeffect *AllocEffect(ALCcontext *context) { VECTOR_POP_BACK(device->EffectList); almtx_unlock(&device->EffectLock); + alSetError(context, AL_OUT_OF_MEMORY, "Failed to allocate effect batch"); return NULL; } diff --git a/OpenAL32/alFilter.c b/OpenAL32/alFilter.c index de8e3a8c..7a3513c3 100644 --- a/OpenAL32/alFilter.c +++ b/OpenAL32/alFilter.c @@ -68,9 +68,8 @@ AL_API ALvoid AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters) if(!context) return; if(!(n >= 0)) - SETERR_GOTO(context, AL_INVALID_VALUE, done, "Generating %d filters", n); - - for(cur = 0;cur < n;cur++) + alSetError(context, AL_INVALID_VALUE, "Generating %d filters", n); + else for(cur = 0;cur < n;cur++) { ALfilter *filter = AllocFilter(context); if(!filter) @@ -82,7 +81,6 @@ AL_API ALvoid AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters) filters[cur] = filter->id; } -done: ALCcontext_DecRef(context); } @@ -649,6 +647,7 @@ static ALfilter *AllocFilter(ALCcontext *context) if(UNLIKELY(VECTOR_SIZE(device->FilterList) >= 1<<25)) { almtx_unlock(&device->FilterLock); + alSetError(context, AL_OUT_OF_MEMORY, "Too many filters allocated"); return NULL; } lidx = (ALsizei)VECTOR_SIZE(device->FilterList); @@ -660,6 +659,7 @@ static ALfilter *AllocFilter(ALCcontext *context) { VECTOR_POP_BACK(device->FilterList); almtx_unlock(&device->FilterLock); + alSetError(context, AL_OUT_OF_MEMORY, "Failed to allocate filter batch"); return NULL; } diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index 01555b69..19017e51 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -1807,19 +1807,18 @@ AL_API ALvoid AL_APIENTRY alGenSources(ALsizei n, ALuint *sources) if(!context) return; if(!(n >= 0)) - SETERR_GOTO(context, AL_INVALID_VALUE, done, "Generating %d sources", n); - for(cur = 0;cur < n;cur++) + alSetError(context, AL_INVALID_VALUE, "Generating %d sources", n); + else for(cur = 0;cur < n;cur++) { ALsource *source = AllocSource(context); if(!source) { alDeleteSources(cur, sources); - SETERR_GOTO(context, AL_OUT_OF_MEMORY, done, "Failed to allocate source object"); + break; } sources[cur] = source->id; } -done: ALCcontext_DecRef(context); } @@ -3685,6 +3684,7 @@ static ALsource *AllocSource(ALCcontext *context) if(context->NumSources >= device->SourcesMax) { almtx_unlock(&context->SourceLock); + alSetError(context, AL_OUT_OF_MEMORY, "Exceeding %u source limit", device->SourcesMax); return NULL; } sublist = VECTOR_BEGIN(context->SourceList); @@ -3708,6 +3708,7 @@ static ALsource *AllocSource(ALCcontext *context) if(UNLIKELY(VECTOR_SIZE(context->SourceList) >= 1<<25)) { almtx_unlock(&device->BufferLock); + alSetError(context, AL_OUT_OF_MEMORY, "Too many sources allocated"); return NULL; } lidx = (ALsizei)VECTOR_SIZE(context->SourceList); @@ -3719,6 +3720,7 @@ static ALsource *AllocSource(ALCcontext *context) { VECTOR_POP_BACK(context->SourceList); almtx_unlock(&context->SourceLock); + alSetError(context, AL_OUT_OF_MEMORY, "Failed to allocate source batch"); return NULL; } |