diff options
author | Chris Robinson <[email protected]> | 2018-01-24 17:07:01 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-01-24 17:07:01 -0800 |
commit | 2ded5547ba431a0859bc08276ab720aea9ca92a8 (patch) | |
tree | 8f71cfb37a279805b162f9702839bad856f8dadf /OpenAL32 | |
parent | 395278fcdb2f83ba35b5fba9341bb868af4330b2 (diff) |
Provide messages for the remaining AL errors
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/Include/alError.h | 18 | ||||
-rw-r--r-- | OpenAL32/alAuxEffectSlot.c | 62 | ||||
-rw-r--r-- | OpenAL32/alBuffer.c | 196 | ||||
-rw-r--r-- | OpenAL32/alEffect.c | 10 | ||||
-rw-r--r-- | OpenAL32/alExtension.c | 4 | ||||
-rw-r--r-- | OpenAL32/alFilter.c | 118 | ||||
-rw-r--r-- | OpenAL32/alListener.c | 107 | ||||
-rw-r--r-- | OpenAL32/alSource.c | 115 | ||||
-rw-r--r-- | OpenAL32/alState.c | 94 | ||||
-rw-r--r-- | OpenAL32/event.c | 11 |
10 files changed, 371 insertions, 364 deletions
diff --git a/OpenAL32/Include/alError.h b/OpenAL32/Include/alError.h index 9fb7a7e3..3dc16103 100644 --- a/OpenAL32/Include/alError.h +++ b/OpenAL32/Include/alError.h @@ -11,24 +11,14 @@ extern ALboolean TrapALError; ALvoid alSetError(ALCcontext *context, ALenum errorCode, ALuint objid, const char *msg); -#define SET_ERROR_AND_RETURN(ctx, err) do { \ - alSetError((ctx), (err), 0, "Unimplemented message"); \ - return; \ -} while(0) - -#define SET_ERROR_AND_RETURN_VALUE(ctx, err, val) do { \ - alSetError((ctx), (err), 0, "Unimplemented message"); \ - return (val); \ -} while(0) - -#define SET_ERROR_AND_GOTO(ctx, err, lbl) do { \ - alSetError((ctx), (err), 0, "Unimplemented message"); \ +#define SETERR_GOTO(ctx, err, objid, msg, lbl) do { \ + alSetError((ctx), (err), (objid), (msg)); \ goto lbl; \ } while(0) -#define SET_ERR_AND_RETURN(ctx, err, objid, msg) do { \ +#define SETERR_RETURN(ctx, err, objid, msg, retval) do { \ alSetError((ctx), (err), (objid), (msg)); \ - return; \ + return retval; \ } while(0) #ifdef __cplusplus diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c index 2dcf7125..a8186f07 100644 --- a/OpenAL32/alAuxEffectSlot.c +++ b/OpenAL32/alAuxEffectSlot.c @@ -73,7 +73,7 @@ AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslo if(!context) return; if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Generating negative effect slots", done); tmpslots = al_malloc(DEF_ALIGN, sizeof(ALeffectslot*)*n); LockEffectSlotsWrite(context); @@ -87,7 +87,7 @@ AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslo UnlockEffectSlotsWrite(context); alDeleteAuxiliaryEffectSlots(cur, effectslots); - SET_ERROR_AND_GOTO(context, err, done); + SETERR_GOTO(context, err, 0, "Effect slot object allocation failed", done); } err = NewThunkEntry(&slot->id); @@ -103,7 +103,7 @@ AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslo UnlockEffectSlotsWrite(context); alDeleteAuxiliaryEffectSlots(cur, effectslots); - SET_ERROR_AND_GOTO(context, err, done); + SETERR_GOTO(context, err, 0, "Failed to set effect slot ID", done); } aluInitEffectPanning(slot); @@ -149,13 +149,15 @@ AL_API ALvoid AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, const ALuint * LockEffectSlotsWrite(context); if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Deleting negative effect slots", + done); for(i = 0;i < n;i++) { if((slot=LookupEffectSlot(context, effectslots[i])) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, effectslots[i], "Invalid effect slot ID", done); if(ReadRef(&slot->ref) != 0) - SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, done); + SETERR_GOTO(context, AL_INVALID_OPERATION, effectslots[i], + "Deleting in-use effect slot", done); } // All effectslots are valid @@ -238,7 +240,7 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param WriteLock(&context->PropLock); LockEffectSlotsRead(context); if((slot=LookupEffectSlot(context, effectslot)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, effectslot, "Invalid effect slot ID", done); switch(param) { case AL_EFFECTSLOT_EFFECT: @@ -249,23 +251,25 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param if(!(value == 0 || effect != NULL)) { UnlockEffectsRead(device); - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, effectslot, "Invalid effect ID", done); } err = InitializeEffect(context, slot, effect); UnlockEffectsRead(device); if(err != AL_NO_ERROR) - SET_ERROR_AND_GOTO(context, err, done); + SETERR_GOTO(context, err, effectslot, "Effect initialization failed", done); break; case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO: if(!(value == AL_TRUE || value == AL_FALSE)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, effectslot, + "Effect slot auxiliary send auto out of range", done); slot->AuxSendAuto = value; break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + SETERR_GOTO(context, AL_INVALID_ENUM, effectslot, "Invalid effect slot integer property", + done); } DO_UPDATEPROPS(); @@ -292,11 +296,12 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotiv(ALuint effectslot, ALenum para LockEffectSlotsRead(context); if(LookupEffectSlot(context, effectslot) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, effectslot, "Invalid effect slot ID", done); switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, effectslot, + "Invalid effect slot integer-vector property"); } done: @@ -315,17 +320,19 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotf(ALuint effectslot, ALenum param WriteLock(&context->PropLock); LockEffectSlotsRead(context); if((slot=LookupEffectSlot(context, effectslot)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, effectslot, "Invalid effect slot ID", done); switch(param) { case AL_EFFECTSLOT_GAIN: if(!(value >= 0.0f && value <= 1.0f)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, effectslot, "Effect slot gain out of range", + done); slot->Gain = value; break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + SETERR_GOTO(context, AL_INVALID_ENUM, effectslot, "Invalid effect slot float property", + done); } DO_UPDATEPROPS(); @@ -351,11 +358,12 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotfv(ALuint effectslot, ALenum para LockEffectSlotsRead(context); if(LookupEffectSlot(context, effectslot) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, effectslot, "Invalid effect slot ID", done); switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, effectslot, + "Invalid effect slot float-vector property"); } done: @@ -373,7 +381,7 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSloti(ALuint effectslot, ALenum pa LockEffectSlotsRead(context); if((slot=LookupEffectSlot(context, effectslot)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, effectslot, "Invalid effect slot ID", done); switch(param) { case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO: @@ -381,7 +389,7 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSloti(ALuint effectslot, ALenum pa break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, effectslot, "Invalid effect slot integer property"); } done: @@ -406,11 +414,12 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotiv(ALuint effectslot, ALenum p LockEffectSlotsRead(context); if(LookupEffectSlot(context, effectslot) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, effectslot, "Invalid effect slot ID", done); switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, effectslot, + "Invalid effect slot integer-vector property"); } done: @@ -428,7 +437,7 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotf(ALuint effectslot, ALenum pa LockEffectSlotsRead(context); if((slot=LookupEffectSlot(context, effectslot)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, effectslot, "Invalid effect slot ID", done); switch(param) { case AL_EFFECTSLOT_GAIN: @@ -436,7 +445,7 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotf(ALuint effectslot, ALenum pa break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, effectslot, "Invalid effect slot float property"); } done: @@ -460,11 +469,12 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotfv(ALuint effectslot, ALenum p LockEffectSlotsRead(context); if(LookupEffectSlot(context, effectslot) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, effectslot, "Invalid effect slot ID", done); switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, effectslot, + "Invalid effect slot float-vector property"); } done: diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c index 754368b7..922c379c 100644 --- a/OpenAL32/alBuffer.c +++ b/OpenAL32/alBuffer.c @@ -66,7 +66,7 @@ AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *buffers) if(!context) return; if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Generating negative buffers", done); for(cur = 0;cur < n;cur++) { @@ -98,7 +98,7 @@ AL_API ALvoid AL_APIENTRY alDeleteBuffers(ALsizei n, const ALuint *buffers) LockBuffersWrite(device); if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Deleting negative buffers", done); for(i = 0;i < n;i++) { @@ -107,9 +107,9 @@ AL_API ALvoid AL_APIENTRY alDeleteBuffers(ALsizei n, const ALuint *buffers) /* Check for valid Buffer ID */ if((ALBuf=LookupBuffer(device, buffers[i])) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, buffers[i], "Invalid buffer ID", done); if(ReadRef(&ALBuf->ref) != 0) - SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, done); + SETERR_GOTO(context, AL_INVALID_OPERATION, buffers[i], "Deleting in-use buffer", done); } for(i = 0;i < n;i++) @@ -161,16 +161,19 @@ AL_API void AL_APIENTRY alBufferStorageSOFT(ALuint buffer, ALenum format, const device = context->Device; LockBuffersRead(device); if((albuf=LookupBuffer(device, buffer)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - if(!(size >= 0 && freq > 0) || (flags&INVALID_STORAGE_MASK) != 0) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_NAME, buffer, "Invalid buffer ID", done); + if(!(size >= 0)) SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "Negative storage size", done); + if(!(freq > 0)) SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "Invalid sample rate", done); + if((flags&INVALID_STORAGE_MASK) != 0) + SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "Invalid storage flags", done); if((flags&AL_MAP_PERSISTENT_BIT_SOFT) && !(flags&MAP_READ_WRITE_FLAGS)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, buffer, + "Declaring persistently mapped storage without read or write access", done); if(DecomposeUserFormat(format, &srcchannels, &srctype) == AL_FALSE) - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + SETERR_GOTO(context, AL_INVALID_ENUM, buffer, "Invalid format", done); align = SanitizeAlignment(srctype, ATOMIC_LOAD_SEQ(&albuf->UnpackAlign)); - if(align < 1) SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + if(align < 1) SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "Invalid unpack alignment", done); switch(srctype) { @@ -215,21 +218,32 @@ AL_API void* AL_APIENTRY alMapBufferSOFT(ALuint buffer, ALsizei offset, ALsizei device = context->Device; LockBuffersRead(device); if((albuf=LookupBuffer(device, buffer)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - if(!(access&MAP_READ_WRITE_FLAGS) || (access&~MAP_ACCESS_FLAGS) != 0) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_NAME, buffer, "Invalid buffer ID", done); + if((access&~MAP_ACCESS_FLAGS) != 0) + SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "Invalid map flags", done); + if(!(access&MAP_READ_WRITE_FLAGS)) + SETERR_GOTO(context, AL_INVALID_VALUE, buffer, + "Mapping buffer without read or write access", done); WriteLock(&albuf->lock); - if((ReadRef(&albuf->ref) != 0 && !(access&AL_MAP_PERSISTENT_BIT_SOFT)) || - albuf->MappedAccess != 0) - SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, unlock_done); - if(((access&AL_MAP_READ_BIT_SOFT) && !(albuf->Access&AL_MAP_READ_BIT_SOFT)) || - ((access&AL_MAP_WRITE_BIT_SOFT) && !(albuf->Access&AL_MAP_WRITE_BIT_SOFT)) || - ((access&AL_MAP_PERSISTENT_BIT_SOFT) && !(albuf->Access&AL_MAP_PERSISTENT_BIT_SOFT))) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, unlock_done); + if(ReadRef(&albuf->ref) != 0 && !(access&AL_MAP_PERSISTENT_BIT_SOFT)) + SETERR_GOTO(context, AL_INVALID_OPERATION, buffer, + "Mapping in-use buffer without persistent mapping", unlock_done); + if(albuf->MappedAccess != 0) + SETERR_GOTO(context, AL_INVALID_OPERATION, buffer, "Mapping already-mapped buffer", + unlock_done); + if((access&AL_MAP_READ_BIT_SOFT) && !(albuf->Access&AL_MAP_READ_BIT_SOFT)) + SETERR_GOTO(context, AL_INVALID_VALUE, buffer, + "Mapping buffer for reading without read access", unlock_done); + if((access&AL_MAP_WRITE_BIT_SOFT) && !(albuf->Access&AL_MAP_WRITE_BIT_SOFT)) + SETERR_GOTO(context, AL_INVALID_VALUE, buffer, + "Mapping buffer for writing without write access", unlock_done); + if((access&AL_MAP_PERSISTENT_BIT_SOFT) && !(albuf->Access&AL_MAP_PERSISTENT_BIT_SOFT)) + SETERR_GOTO(context, AL_INVALID_VALUE, buffer, + "Mapping buffer persistently without persistent access", unlock_done); if(offset < 0 || offset >= albuf->OriginalSize || length <= 0 || length > albuf->OriginalSize - offset) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, unlock_done); + SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "Mapping out of range", unlock_done); retval = (ALbyte*)albuf->data + offset; albuf->MappedAccess = access; @@ -258,7 +272,7 @@ AL_API void AL_APIENTRY alUnmapBufferSOFT(ALuint buffer) device = context->Device; LockBuffersRead(device); if((albuf=LookupBuffer(device, buffer)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, buffer, "Invalid buffer ID", done); WriteLock(&albuf->lock); if(albuf->MappedAccess == 0) @@ -288,7 +302,7 @@ AL_API void AL_APIENTRY alFlushMappedBufferSOFT(ALuint buffer, ALsizei offset, A device = context->Device; LockBuffersRead(device); if((albuf=LookupBuffer(device, buffer)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, buffer, "Invalid buffer ID", done); WriteLock(&albuf->lock); if(albuf->MappedAccess == 0 || !(albuf->MappedAccess&AL_MAP_WRITE_BIT_SOFT)) @@ -332,21 +346,22 @@ AL_API ALvoid AL_APIENTRY alBufferSubDataSOFT(ALuint buffer, ALenum format, cons device = context->Device; LockBuffersRead(device); if((albuf=LookupBuffer(device, buffer)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - if(!(length >= 0 && offset >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_NAME, buffer, "Invalid buffer ID", done); if(DecomposeUserFormat(format, &srcchannels, &srctype) == AL_FALSE) - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + SETERR_GOTO(context, AL_INVALID_ENUM, buffer, "Invalid format", done); WriteLock(&albuf->lock); align = SanitizeAlignment(srctype, ATOMIC_LOAD_SEQ(&albuf->UnpackAlign)); - if(align < 1) SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, unlock_done); + if(align < 1) SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "Invalid unpack alignment", done); if((long)srcchannels != (long)albuf->FmtChannels || srctype != albuf->OriginalType) - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, unlock_done); + SETERR_GOTO(context, AL_INVALID_ENUM, buffer, "Unpacking data with mismatched format", + unlock_done); if(align != albuf->OriginalAlign) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, unlock_done); + SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "Unpacking data with mismatched alignment", + unlock_done); if(albuf->MappedAccess != 0) - SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, unlock_done); + SETERR_GOTO(context, AL_INVALID_OPERATION, buffer, "Unpacking data into mapped buffer", + unlock_done); num_chans = ChannelsFromFmt(albuf->FmtChannels); frame_size = num_chans * BytesFromFmt(albuf->FmtType); @@ -357,9 +372,11 @@ AL_API ALvoid AL_APIENTRY alBufferSubDataSOFT(ALuint buffer, ALenum format, cons else byte_align = align * frame_size; - if(offset > albuf->OriginalSize || length > albuf->OriginalSize-offset || - (offset%byte_align) != 0 || (length%byte_align) != 0) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, unlock_done); + if(offset < 0 || length < 0 || offset > albuf->OriginalSize || + length > albuf->OriginalSize-offset) + SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "Data sub-range out of range", unlock_done); + if((offset%byte_align) != 0 || (length%byte_align) != 0) + SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "Invalid sub-range alignment", unlock_done); /* offset -> byte offset, length -> sample count */ offset = offset/byte_align * frame_size; @@ -452,12 +469,12 @@ AL_API void AL_APIENTRY alBufferf(ALuint buffer, ALenum param, ALfloat UNUSED(va device = context->Device; LockBuffersRead(device); if(LookupBuffer(device, buffer) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, buffer, "Invalid buffer ID", done); switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, buffer, "Invalid buffer float property"); } done: @@ -477,12 +494,12 @@ AL_API void AL_APIENTRY alBuffer3f(ALuint buffer, ALenum param, ALfloat UNUSED(v device = context->Device; LockBuffersRead(device); if(LookupBuffer(device, buffer) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, buffer, "Invalid buffer ID", done); switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, buffer, "Invalid buffer 3-float property"); } done: @@ -502,14 +519,13 @@ AL_API void AL_APIENTRY alBufferfv(ALuint buffer, ALenum param, const ALfloat *v device = context->Device; LockBuffersRead(device); if(LookupBuffer(device, buffer) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, buffer, "Invalid buffer ID", done); - if(!(values)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + if(!values) SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "NULL pointer", done); switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, buffer, "Invalid buffer float-vector property"); } done: @@ -530,24 +546,26 @@ AL_API void AL_APIENTRY alBufferi(ALuint buffer, ALenum param, ALint value) device = context->Device; LockBuffersRead(device); if((albuf=LookupBuffer(device, buffer)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, buffer, "Invalid buffer ID", done); switch(param) { case AL_UNPACK_BLOCK_ALIGNMENT_SOFT: if(!(value >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, buffer, + "Negative buffer unpack block alignment", done); ATOMIC_STORE_SEQ(&albuf->UnpackAlign, value); break; case AL_PACK_BLOCK_ALIGNMENT_SOFT: if(!(value >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "Negative buffer pack block alignment", + done); ATOMIC_STORE_SEQ(&albuf->PackAlign, value); break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, buffer, "Invalid buffer integer property"); } done: @@ -566,12 +584,12 @@ AL_API void AL_APIENTRY alBuffer3i(ALuint buffer, ALenum param, ALint UNUSED(val device = context->Device; if(LookupBuffer(device, buffer) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, buffer, "Invalid buffer ID", done); switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, buffer, "Invalid buffer 3-integer property"); } done: @@ -602,10 +620,9 @@ AL_API void AL_APIENTRY alBufferiv(ALuint buffer, ALenum param, const ALint *val device = context->Device; LockBuffersRead(device); if((albuf=LookupBuffer(device, buffer)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, buffer, "Invalid buffer ID", done); - if(!(values)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + if(!values) SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "NULL pointer", done); switch(param) { case AL_LOOP_POINTS_SOFT: @@ -613,13 +630,14 @@ AL_API void AL_APIENTRY alBufferiv(ALuint buffer, ALenum param, const ALint *val if(ReadRef(&albuf->ref) != 0) { WriteUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, done); + SETERR_GOTO(context, AL_INVALID_OPERATION, buffer, + "Modifying in-use buffer loop points", done); } if(values[0] >= values[1] || values[0] < 0 || values[1] > albuf->SampleLen) { WriteUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "Invalid loop point range", done); } albuf->LoopStart = values[0]; @@ -628,7 +646,7 @@ AL_API void AL_APIENTRY alBufferiv(ALuint buffer, ALenum param, const ALint *val break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, buffer, "Invalid buffer integer-vector property"); } done: @@ -649,14 +667,13 @@ AL_API ALvoid AL_APIENTRY alGetBufferf(ALuint buffer, ALenum param, ALfloat *val device = context->Device; LockBuffersRead(device); if((albuf=LookupBuffer(device, buffer)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, buffer, "Invalid buffer ID", done); - if(!(value)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + if(!value) SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "NULL pointer", done); switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, buffer, "Invalid buffer float property"); } done: @@ -676,14 +693,14 @@ AL_API void AL_APIENTRY alGetBuffer3f(ALuint buffer, ALenum param, ALfloat *valu device = context->Device; LockBuffersRead(device); if(LookupBuffer(device, buffer) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, buffer, "Invalid buffer ID", done); - if(!(value1 && value2 && value3)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + if(!value1 || !value2 || !value3) + SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "NULL pointer", done); switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, buffer, "Invalid buffer 3-float property"); } done: @@ -710,14 +727,13 @@ AL_API void AL_APIENTRY alGetBufferfv(ALuint buffer, ALenum param, ALfloat *valu device = context->Device; LockBuffersRead(device); if(LookupBuffer(device, buffer) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, buffer, "Invalid buffer ID", done); - if(!(values)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + if(!values) SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "NULL pointer", done); switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, buffer, "Invalid buffer float-vector property"); } done: @@ -738,10 +754,9 @@ AL_API ALvoid AL_APIENTRY alGetBufferi(ALuint buffer, ALenum param, ALint *value device = context->Device; LockBuffersRead(device); if((albuf=LookupBuffer(device, buffer)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, buffer, "Invalid buffer ID", done); - if(!(value)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + if(!value) SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "NULL pointer", done); switch(param) { case AL_FREQUENCY: @@ -772,7 +787,7 @@ AL_API ALvoid AL_APIENTRY alGetBufferi(ALuint buffer, ALenum param, ALint *value break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, buffer, "Invalid buffer integer property"); } done: @@ -792,14 +807,14 @@ AL_API void AL_APIENTRY alGetBuffer3i(ALuint buffer, ALenum param, ALint *value1 device = context->Device; LockBuffersRead(device); if(LookupBuffer(device, buffer) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, buffer, "Invalid buffer ID", done); - if(!(value1 && value2 && value3)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + if(!value1 || !value2 || !value3) + SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "NULL pointer", done); switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, buffer, "Invalid buffer 3-integer property"); } done: @@ -835,10 +850,9 @@ AL_API void AL_APIENTRY alGetBufferiv(ALuint buffer, ALenum param, ALint *values device = context->Device; LockBuffersRead(device); if((albuf=LookupBuffer(device, buffer)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, buffer, "Invalid buffer ID", done); - if(!(values)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + if(!values) SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "NULL pointer", done); switch(param) { case AL_LOOP_POINTS_SOFT: @@ -849,7 +863,7 @@ AL_API void AL_APIENTRY alGetBufferiv(ALuint buffer, ALenum param, ALint *values break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, buffer, "Invalid buffer integer-vector property"); } done: @@ -884,7 +898,7 @@ static void LoadData(ALCcontext *context, ALbuffer *ALBuf, ALuint freq, ALsizei case UserFmtBFormat3D: DstChannels = FmtBFormat3D; break; } if(UNLIKELY((long)SrcChannels != (long)DstChannels)) - SET_ERR_AND_RETURN(context, AL_INVALID_ENUM, ALBuf->id, "Invalid format"); + SETERR_RETURN(context, AL_INVALID_ENUM, ALBuf->id, "Invalid format",); /* IMA4 and MSADPCM convert to 16-bit short. */ switch(SrcType) @@ -902,23 +916,23 @@ static void LoadData(ALCcontext *context, ALbuffer *ALBuf, ALuint freq, ALsizei if(access != 0) { if(UNLIKELY((long)SrcType != (long)DstType)) - SET_ERR_AND_RETURN(context, AL_INVALID_VALUE, ALBuf->id, - "Format cannot be mapped or preserved"); + SETERR_RETURN(context, AL_INVALID_VALUE, ALBuf->id, + "Format cannot be mapped or preserved",); } NumChannels = ChannelsFromFmt(DstChannels); FrameSize = NumChannels * BytesFromFmt(DstType); if(UNLIKELY(frames > INT_MAX/FrameSize)) - SET_ERR_AND_RETURN(context, AL_OUT_OF_MEMORY, ALBuf->id, "Buffer size too large"); + SETERR_RETURN(context, AL_OUT_OF_MEMORY, ALBuf->id, "Buffer size too large",); newsize = frames*FrameSize; WriteLock(&ALBuf->lock); if(UNLIKELY(ReadRef(&ALBuf->ref) != 0 || ALBuf->MappedAccess != 0)) { WriteUnlock(&ALBuf->lock); - SET_ERR_AND_RETURN(context, AL_INVALID_OPERATION, ALBuf->id, - "Modifying storage for in-use buffer"); + SETERR_RETURN(context, AL_INVALID_OPERATION, ALBuf->id, + "Modifying storage for in-use buffer",); } if((access&AL_PRESERVE_DATA_BIT_SOFT)) @@ -927,14 +941,14 @@ static void LoadData(ALCcontext *context, ALbuffer *ALBuf, ALuint freq, ALsizei if(UNLIKELY(ALBuf->FmtChannels != DstChannels || ALBuf->OriginalType != SrcType)) { WriteUnlock(&ALBuf->lock); - SET_ERR_AND_RETURN(context, AL_INVALID_VALUE, ALBuf->id, - "Preserving data of mismatched format"); + SETERR_RETURN(context, AL_INVALID_VALUE, ALBuf->id, + "Preserving data of mismatched format",); } if(UNLIKELY(ALBuf->OriginalAlign != align)) { WriteUnlock(&ALBuf->lock); - SET_ERR_AND_RETURN(context, AL_INVALID_VALUE, ALBuf->id, - "Preserving data of mismatched alignment"); + SETERR_RETURN(context, AL_INVALID_VALUE, ALBuf->id, + "Preserving data of mismatched alignment",); } } @@ -952,7 +966,7 @@ static void LoadData(ALCcontext *context, ALbuffer *ALBuf, ALuint freq, ALsizei if(UNLIKELY(!temp && newsize)) { WriteUnlock(&ALBuf->lock); - SET_ERR_AND_RETURN(context, AL_OUT_OF_MEMORY, ALBuf->id, "Failed to allocate storage"); + SETERR_RETURN(context, AL_OUT_OF_MEMORY, ALBuf->id, "Failed to allocate storage",); } if((access&AL_PRESERVE_DATA_BIT_SOFT)) { @@ -1190,7 +1204,7 @@ ALbuffer *NewBuffer(ALCcontext *context) buffer = al_calloc(16, sizeof(ALbuffer)); if(!buffer) - SET_ERROR_AND_RETURN_VALUE(context, AL_OUT_OF_MEMORY, NULL); + SETERR_RETURN(context, AL_OUT_OF_MEMORY, 0, "Failed to allocate buffer object", NULL); RWLockInit(&buffer->lock); buffer->Access = 0; buffer->MappedAccess = 0; @@ -1204,7 +1218,7 @@ ALbuffer *NewBuffer(ALCcontext *context) memset(buffer, 0, sizeof(ALbuffer)); al_free(buffer); - SET_ERROR_AND_RETURN_VALUE(context, err, NULL); + SETERR_RETURN(context, err, 0, "Failed to set buffer ID", NULL); } return buffer; diff --git a/OpenAL32/alEffect.c b/OpenAL32/alEffect.c index 755d792e..5f6e661a 100644 --- a/OpenAL32/alEffect.c +++ b/OpenAL32/alEffect.c @@ -69,7 +69,7 @@ AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects) if(!context) return; if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Generating negative effects", done); device = context->Device; for(cur = 0;cur < n;cur++) @@ -80,7 +80,7 @@ AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects) { al_free(effect); alDeleteEffects(cur, effects); - SET_ERROR_AND_GOTO(context, err, done); + SETERR_GOTO(context, err, 0, "Failed to allocate effect object", done); } err = NewThunkEntry(&effect->id); @@ -93,7 +93,7 @@ AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects) al_free(effect); alDeleteEffects(cur, effects); - SET_ERROR_AND_GOTO(context, err, done); + SETERR_GOTO(context, err, 0, "Failed to set effect ID", done); } effects[cur] = effect->id; @@ -116,11 +116,11 @@ AL_API ALvoid AL_APIENTRY alDeleteEffects(ALsizei n, const ALuint *effects) device = context->Device; LockEffectsWrite(device); if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Deleting negative effects", done); for(i = 0;i < n;i++) { if(effects[i] && LookupEffect(device, effects[i]) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, effects[i], "Invalid effect ID", done); } for(i = 0;i < n;i++) { diff --git a/OpenAL32/alExtension.c b/OpenAL32/alExtension.c index 7db326a2..9b6e5a97 100644 --- a/OpenAL32/alExtension.c +++ b/OpenAL32/alExtension.c @@ -45,8 +45,8 @@ AL_API ALboolean AL_APIENTRY alIsExtensionPresent(const ALchar *extName) context = GetContextRef(); if(!context) return AL_FALSE; - if(!(extName)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + if(!extName) + SETERR_GOTO(context, AL_INVALID_VALUE, 0, "NULL pointer", done); len = strlen(extName); ptr = context->ExtensionList; diff --git a/OpenAL32/alFilter.c b/OpenAL32/alFilter.c index 16796760..24b0e607 100644 --- a/OpenAL32/alFilter.c +++ b/OpenAL32/alFilter.c @@ -55,7 +55,7 @@ AL_API ALvoid AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters) if(!context) return; if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Generating negative filters", done); device = context->Device; for(cur = 0;cur < n;cur++) @@ -64,7 +64,7 @@ AL_API ALvoid AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters) if(!filter) { alDeleteFilters(cur, filters); - SET_ERROR_AND_GOTO(context, AL_OUT_OF_MEMORY, done); + SETERR_GOTO(context, AL_OUT_OF_MEMORY, 0, "Failed to allocate filter object", done); } InitFilterParams(filter, AL_FILTER_NULL); @@ -78,7 +78,7 @@ AL_API ALvoid AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters) al_free(filter); alDeleteFilters(cur, filters); - SET_ERROR_AND_GOTO(context, err, done); + SETERR_GOTO(context, err, 0, "Failed ot set filter ID", done); } filters[cur] = filter->id; @@ -101,11 +101,11 @@ AL_API ALvoid AL_APIENTRY alDeleteFilters(ALsizei n, const ALuint *filters) device = context->Device; LockFiltersWrite(device); if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Deleting negative filters", done); for(i = 0;i < n;i++) { if(filters[i] && LookupFilter(device, filters[i]) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, filters[i], "Invalid filter ID", done); } for(i = 0;i < n;i++) { @@ -435,37 +435,37 @@ void ALfilterState_setParams(ALfilterState *filter, ALfilterType type, ALfloat g } -static void ALlowpass_setParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void ALlowpass_setParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), const ALint *UNUSED(vals)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } +static void ALlowpass_setParami(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), ALint UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid low-pass integer property"); } +static void ALlowpass_setParamiv(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), const ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid low-pass integer-vector property"); } static void ALlowpass_setParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat val) { switch(param) { case AL_LOWPASS_GAIN: if(!(val >= AL_LOWPASS_MIN_GAIN && val <= AL_LOWPASS_MAX_GAIN)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE, filter->id, "Low-pass gain out of range",); filter->Gain = val; break; case AL_LOWPASS_GAINHF: if(!(val >= AL_LOWPASS_MIN_GAINHF && val <= AL_LOWPASS_MAX_GAINHF)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE, filter->id, "Low-pass gainhf out of range",); filter->GainHF = val; break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid low-pass float property"); } } static void ALlowpass_setParamfv(ALfilter *filter, ALCcontext *context, ALenum param, const ALfloat *vals) { ALlowpass_setParamf(filter, context, param, vals[0]); } -static void ALlowpass_getParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void ALlowpass_getParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(vals)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } +static void ALlowpass_getParami(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid low-pass integer property"); } +static void ALlowpass_getParamiv(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid low-pass integer-vector property"); } static void ALlowpass_getParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *val) { switch(param) @@ -479,7 +479,7 @@ static void ALlowpass_getParamf(ALfilter *filter, ALCcontext *context, ALenum pa break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid low-pass float property"); } } static void ALlowpass_getParamfv(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *vals) @@ -488,37 +488,37 @@ static void ALlowpass_getParamfv(ALfilter *filter, ALCcontext *context, ALenum p DEFINE_ALFILTER_VTABLE(ALlowpass); -static void ALhighpass_setParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void ALhighpass_setParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), const ALint *UNUSED(vals)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } +static void ALhighpass_setParami(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), ALint UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid high-pass integer property"); } +static void ALhighpass_setParamiv(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), const ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid high-pass integer-vector property"); } static void ALhighpass_setParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat val) { switch(param) { case AL_HIGHPASS_GAIN: if(!(val >= AL_HIGHPASS_MIN_GAIN && val <= AL_HIGHPASS_MAX_GAIN)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE, filter->id, "High-pass gain out of range",); filter->Gain = val; break; case AL_HIGHPASS_GAINLF: if(!(val >= AL_HIGHPASS_MIN_GAINLF && val <= AL_HIGHPASS_MAX_GAINLF)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE, filter->id, "High-pass gainlf out of range",); filter->GainLF = val; break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid high-pass float property"); } } static void ALhighpass_setParamfv(ALfilter *filter, ALCcontext *context, ALenum param, const ALfloat *vals) { ALhighpass_setParamf(filter, context, param, vals[0]); } -static void ALhighpass_getParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void ALhighpass_getParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(vals)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } +static void ALhighpass_getParami(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid high-pass integer property"); } +static void ALhighpass_getParamiv(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid high-pass integer-vector property"); } static void ALhighpass_getParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *val) { switch(param) @@ -532,7 +532,7 @@ static void ALhighpass_getParamf(ALfilter *filter, ALCcontext *context, ALenum p break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid high-pass float property"); } } static void ALhighpass_getParamfv(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *vals) @@ -541,43 +541,43 @@ static void ALhighpass_getParamfv(ALfilter *filter, ALCcontext *context, ALenum DEFINE_ALFILTER_VTABLE(ALhighpass); -static void ALbandpass_setParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void ALbandpass_setParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), const ALint *UNUSED(vals)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } +static void ALbandpass_setParami(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), ALint UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid band-pass integer property"); } +static void ALbandpass_setParamiv(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), const ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid band-pass integer-vector property"); } static void ALbandpass_setParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat val) { switch(param) { case AL_BANDPASS_GAIN: if(!(val >= AL_BANDPASS_MIN_GAIN && val <= AL_BANDPASS_MAX_GAIN)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE, filter->id, "Band-pass gain out of range",); filter->Gain = val; break; case AL_BANDPASS_GAINHF: if(!(val >= AL_BANDPASS_MIN_GAINHF && val <= AL_BANDPASS_MAX_GAINHF)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE, filter->id, "Band-pass gainhf out of range",); filter->GainHF = val; break; case AL_BANDPASS_GAINLF: if(!(val >= AL_BANDPASS_MIN_GAINLF && val <= AL_BANDPASS_MAX_GAINLF)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE, filter->id, "Band-pass gainlf out of range",); filter->GainLF = val; break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid band-pass float property"); } } static void ALbandpass_setParamfv(ALfilter *filter, ALCcontext *context, ALenum param, const ALfloat *vals) { ALbandpass_setParamf(filter, context, param, vals[0]); } -static void ALbandpass_getParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void ALbandpass_getParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(vals)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } +static void ALbandpass_getParami(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid band-pass integer property"); } +static void ALbandpass_getParamiv(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid band-pass integer-vector property"); } static void ALbandpass_getParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *val) { switch(param) @@ -595,7 +595,7 @@ static void ALbandpass_getParamf(ALfilter *filter, ALCcontext *context, ALenum p break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid band-pass float property"); } } static void ALbandpass_getParamfv(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *vals) @@ -604,23 +604,23 @@ static void ALbandpass_getParamfv(ALfilter *filter, ALCcontext *context, ALenum DEFINE_ALFILTER_VTABLE(ALbandpass); -static void ALnullfilter_setParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void ALnullfilter_setParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), const ALint *UNUSED(vals)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void ALnullfilter_setParamf(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALfloat UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void ALnullfilter_setParamfv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), const ALfloat *UNUSED(vals)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } - -static void ALnullfilter_getParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void ALnullfilter_getParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(vals)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void ALnullfilter_getParamf(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALfloat *UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void ALnullfilter_getParamfv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALfloat *UNUSED(vals)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } +static void ALnullfilter_setParami(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), ALint UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid null filter property"); } +static void ALnullfilter_setParamiv(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), const ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid null filter property"); } +static void ALnullfilter_setParamf(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), ALfloat UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid null filter property"); } +static void ALnullfilter_setParamfv(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), const ALfloat *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid null filter property"); } + +static void ALnullfilter_getParami(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid null filter property"); } +static void ALnullfilter_getParamiv(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid null filter property"); } +static void ALnullfilter_getParamf(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), ALfloat *UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid null filter property"); } +static void ALnullfilter_getParamfv(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), ALfloat *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid null filter property"); } DEFINE_ALFILTER_VTABLE(ALnullfilter); diff --git a/OpenAL32/alListener.c b/OpenAL32/alListener.c index 9a90c16e..51ab6fc9 100644 --- a/OpenAL32/alListener.c +++ b/OpenAL32/alListener.c @@ -48,14 +48,15 @@ AL_API ALvoid AL_APIENTRY alListenerf(ALenum param, ALfloat value) { case AL_GAIN: if(!(value >= 0.0f && isfinite(value))) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Listener gain out of range", done); listener->Gain = value; DO_UPDATEPROPS(); break; case AL_METERS_PER_UNIT: if(!(value >= AL_MIN_METERS_PER_UNIT && value <= AL_MAX_METERS_PER_UNIT)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Listener meters per unit out of range", + done); context->MetersPerUnit = value; if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) UpdateContextProps(context); @@ -64,7 +65,7 @@ AL_API ALvoid AL_APIENTRY alListenerf(ALenum param, ALfloat value) break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, 0, "Invalid listener float property"); } done: @@ -87,7 +88,7 @@ AL_API ALvoid AL_APIENTRY alListener3f(ALenum param, ALfloat value1, ALfloat val { case AL_POSITION: if(!(isfinite(value1) && isfinite(value2) && isfinite(value3))) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Listener position out of range", done); listener->Position[0] = value1; listener->Position[1] = value2; listener->Position[2] = value3; @@ -96,7 +97,7 @@ AL_API ALvoid AL_APIENTRY alListener3f(ALenum param, ALfloat value1, ALfloat val case AL_VELOCITY: if(!(isfinite(value1) && isfinite(value2) && isfinite(value3))) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Listener velocity out of range", done); listener->Velocity[0] = value1; listener->Velocity[1] = value2; listener->Velocity[2] = value3; @@ -104,7 +105,7 @@ AL_API ALvoid AL_APIENTRY alListener3f(ALenum param, ALfloat value1, ALfloat val break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, 0, "Invalid listener 3-float property"); } done: @@ -139,14 +140,13 @@ AL_API ALvoid AL_APIENTRY alListenerfv(ALenum param, const ALfloat *values) listener = context->Listener; WriteLock(&context->PropLock); - if(!(values)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + if(!values) SETERR_GOTO(context, AL_INVALID_VALUE, 0, "NULL pointer", done); switch(param) { case AL_ORIENTATION: if(!(isfinite(values[0]) && isfinite(values[1]) && isfinite(values[2]) && isfinite(values[3]) && isfinite(values[4]) && isfinite(values[5]))) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Listener orientation out of range", done); /* AT then UP */ listener->Forward[0] = values[0]; listener->Forward[1] = values[1]; @@ -158,7 +158,7 @@ AL_API ALvoid AL_APIENTRY alListenerfv(ALenum param, const ALfloat *values) break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, 0, "Invalid listener float-vector property"); } done: @@ -178,11 +178,10 @@ AL_API ALvoid AL_APIENTRY alListeneri(ALenum param, ALint UNUSED(value)) switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, 0, "Invalid listener integer property"); } - -done: WriteUnlock(&context->PropLock); + ALCcontext_DecRef(context); } @@ -206,11 +205,10 @@ AL_API void AL_APIENTRY alListener3i(ALenum param, ALint value1, ALint value2, A switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, 0, "Invalid listener 3-integer property"); } - -done: WriteUnlock(&context->PropLock); + ALCcontext_DecRef(context); } @@ -245,16 +243,15 @@ AL_API void AL_APIENTRY alListeneriv(ALenum param, const ALint *values) if(!context) return; WriteLock(&context->PropLock); - if(!(values)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch(param) + if(!values) + alSetError(context, AL_INVALID_VALUE, 0, "NULL pointer"); + else switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, 0, "Invalid listener integer-vector property"); } - -done: WriteUnlock(&context->PropLock); + ALCcontext_DecRef(context); } @@ -267,9 +264,9 @@ AL_API ALvoid AL_APIENTRY alGetListenerf(ALenum param, ALfloat *value) if(!context) return; ReadLock(&context->PropLock); - if(!(value)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch(param) + if(!value) + alSetError(context, AL_INVALID_VALUE, 0, "NULL pointer"); + else switch(param) { case AL_GAIN: *value = context->Listener->Gain; @@ -280,11 +277,10 @@ AL_API ALvoid AL_APIENTRY alGetListenerf(ALenum param, ALfloat *value) break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, 0, "Invalid listener float property"); } - -done: ReadUnlock(&context->PropLock); + ALCcontext_DecRef(context); } @@ -297,9 +293,9 @@ AL_API ALvoid AL_APIENTRY alGetListener3f(ALenum param, ALfloat *value1, ALfloat if(!context) return; ReadLock(&context->PropLock); - if(!(value1 && value2 && value3)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch(param) + if(!value1 || !value2 || !value3) + alSetError(context, AL_INVALID_VALUE, 0, "NULL pointer"); + else switch(param) { case AL_POSITION: *value1 = context->Listener->Position[0]; @@ -314,11 +310,10 @@ AL_API ALvoid AL_APIENTRY alGetListener3f(ALenum param, ALfloat *value1, ALfloat break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, 0, "Invalid listener 3-float property"); } - -done: ReadUnlock(&context->PropLock); + ALCcontext_DecRef(context); } @@ -344,9 +339,9 @@ AL_API ALvoid AL_APIENTRY alGetListenerfv(ALenum param, ALfloat *values) if(!context) return; ReadLock(&context->PropLock); - if(!(values)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch(param) + if(!values) + alSetError(context, AL_INVALID_VALUE, 0, "NULL pointer"); + else switch(param) { case AL_ORIENTATION: // AT then UP @@ -359,11 +354,10 @@ AL_API ALvoid AL_APIENTRY alGetListenerfv(ALenum param, ALfloat *values) break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, 0, "Invalid listener float-vector property"); } - -done: ReadUnlock(&context->PropLock); + ALCcontext_DecRef(context); } @@ -376,16 +370,15 @@ AL_API ALvoid AL_APIENTRY alGetListeneri(ALenum param, ALint *value) if(!context) return; ReadLock(&context->PropLock); - if(!(value)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch(param) + if(!value) + alSetError(context, AL_INVALID_VALUE, 0, "NULL pointer"); + else switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, 0, "Invalid listener integer property"); } - -done: ReadUnlock(&context->PropLock); + ALCcontext_DecRef(context); } @@ -398,9 +391,9 @@ AL_API void AL_APIENTRY alGetListener3i(ALenum param, ALint *value1, ALint *valu if(!context) return; ReadLock(&context->PropLock); - if(!(value1 && value2 && value3)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch (param) + if(!value1 || !value2 || !value3) + alSetError(context, AL_INVALID_VALUE, 0, "NULL pointer"); + else switch(param) { case AL_POSITION: *value1 = (ALint)context->Listener->Position[0]; @@ -415,11 +408,10 @@ AL_API void AL_APIENTRY alGetListener3i(ALenum param, ALint *value1, ALint *valu break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, 0, "Invalid listener 3-integer property"); } - -done: ReadUnlock(&context->PropLock); + ALCcontext_DecRef(context); } @@ -440,9 +432,9 @@ AL_API void AL_APIENTRY alGetListeneriv(ALenum param, ALint* values) if(!context) return; ReadLock(&context->PropLock); - if(!(values)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch(param) + if(!values) + alSetError(context, AL_INVALID_VALUE, 0, "NULL pointer"); + else switch(param) { case AL_ORIENTATION: // AT then UP @@ -455,11 +447,10 @@ AL_API void AL_APIENTRY alGetListeneriv(ALenum param, ALint* values) break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, 0, "Invalid listener integer-vector property"); } - -done: ReadUnlock(&context->PropLock); + ALCcontext_DecRef(context); } diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index 2b561597..c60b6a01 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -452,7 +452,11 @@ static ALint Int64ValsByProp(ALenum prop) #define CHECKVAL(x) do { \ if(!(x)) \ - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_VALUE, AL_FALSE); \ + { \ + alSetError(Context, AL_INVALID_VALUE, Source->id, \ + "Value out of range"); \ + return AL_FALSE; \ + } \ } while(0) #define DO_UPDATEPROPS() do { \ @@ -477,7 +481,8 @@ static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp p case AL_SEC_OFFSET_LATENCY_SOFT: case AL_SEC_OFFSET_CLOCK_SOFT: /* Query only */ - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_OPERATION, AL_FALSE); + SETERR_RETURN(Context, AL_INVALID_OPERATION, Source->id, + "Setting read-only source property", AL_FALSE); case AL_PITCH: CHECKVAL(*values >= 0.0f); @@ -601,7 +606,8 @@ static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp p { WriteUnlock(&Source->queue_lock); ALCdevice_Unlock(Context->Device); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_VALUE, AL_FALSE); + SETERR_RETURN(Context, AL_INVALID_VALUE, Source->id, "Invalid offset", + AL_FALSE); } WriteUnlock(&Source->queue_lock); } @@ -694,7 +700,7 @@ static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp p } ERR("Unexpected property: 0x%04x\n", prop); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_ENUM, AL_FALSE); + SETERR_RETURN(Context, AL_INVALID_ENUM, Source->id, "Invalid source float property", AL_FALSE); } static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp prop, const ALint *values) @@ -716,7 +722,8 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p case AL_SAMPLE_LENGTH_SOFT: case AL_SEC_LENGTH_SOFT: /* Query only */ - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_OPERATION, AL_FALSE); + SETERR_RETURN(Context, AL_INVALID_OPERATION, Source->id, + "Setting read-only source property", AL_FALSE); case AL_SOURCE_RELATIVE: CHECKVAL(*values == AL_FALSE || *values == AL_TRUE); @@ -756,7 +763,8 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p if(!(*values == 0 || (buffer=LookupBuffer(device, *values)) != NULL)) { UnlockBuffersRead(device); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_VALUE, AL_FALSE); + SETERR_RETURN(Context, AL_INVALID_VALUE, Source->id, "Invalid buffer ID", + AL_FALSE); } WriteLock(&Source->queue_lock); @@ -765,7 +773,8 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p { WriteUnlock(&Source->queue_lock); UnlockBuffersRead(device); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_OPERATION, AL_FALSE); + SETERR_RETURN(Context, AL_INVALID_OPERATION, Source->id, + "Setting non-persistently mapped buffer", AL_FALSE); } else { @@ -774,7 +783,8 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p { WriteUnlock(&Source->queue_lock); UnlockBuffersRead(device); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_OPERATION, AL_FALSE); + SETERR_RETURN(Context, AL_INVALID_OPERATION, Source->id, + "Setting buffer on playing or paused source", AL_FALSE); } } @@ -839,7 +849,8 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p { WriteUnlock(&Source->queue_lock); ALCdevice_Unlock(Context->Device); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_VALUE, AL_FALSE); + SETERR_RETURN(Context, AL_INVALID_VALUE, Source->id, + "Invalid source offset", AL_FALSE); } WriteUnlock(&Source->queue_lock); } @@ -852,7 +863,8 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p if(!(*values == 0 || (filter=LookupFilter(device, *values)) != NULL)) { UnlockFiltersRead(device); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_VALUE, AL_FALSE); + SETERR_RETURN(Context, AL_INVALID_VALUE, Source->id, "Invalid filter ID", + AL_FALSE); } if(!filter) @@ -941,7 +953,9 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p { UnlockFiltersRead(device); UnlockEffectSlotsRead(Context); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_VALUE, AL_FALSE); + /* TODO: Fix message */ + SETERR_RETURN(Context, AL_INVALID_VALUE, Source->id, "Invalid send parameter", + AL_FALSE); } if(!filter) @@ -1040,7 +1054,8 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p } ERR("Unexpected property: 0x%04x\n", prop); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_ENUM, AL_FALSE); + SETERR_RETURN(Context, AL_INVALID_ENUM, Source->id, "Invalid source integer property", + AL_FALSE); } static ALboolean SetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp prop, const ALint64SOFT *values) @@ -1060,8 +1075,8 @@ static ALboolean SetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp case AL_SAMPLE_LENGTH_SOFT: case AL_SEC_LENGTH_SOFT: /* Query only */ - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_OPERATION, AL_FALSE); - + SETERR_RETURN(Context, AL_INVALID_OPERATION, Source->id, + "Setting read-only source property", AL_FALSE); /* 1x int */ case AL_SOURCE_RELATIVE: @@ -1145,7 +1160,8 @@ static ALboolean SetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp } ERR("Unexpected property: 0x%04x\n", prop); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_ENUM, AL_FALSE); + SETERR_RETURN(Context, AL_INVALID_ENUM, Source->id, "Invalid source integer64 property", + AL_FALSE); } #undef CHECKVAL @@ -1342,7 +1358,8 @@ static ALboolean GetSourcedv(ALsource *Source, ALCcontext *Context, SourceProp p } ERR("Unexpected property: 0x%04x\n", prop); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_ENUM, AL_FALSE); + SETERR_RETURN(Context, AL_INVALID_ENUM, Source->id, "Invalid source double property", + AL_FALSE); } static ALboolean GetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp prop, ALint *values) @@ -1586,7 +1603,8 @@ static ALboolean GetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p } ERR("Unexpected property: 0x%04x\n", prop); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_ENUM, AL_FALSE); + SETERR_RETURN(Context, AL_INVALID_ENUM, Source->id, "Invalid source integer property", + AL_FALSE); } static ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp prop, ALint64 *values) @@ -1718,7 +1736,8 @@ static ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp } ERR("Unexpected property: 0x%04x\n", prop); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_ENUM, AL_FALSE); + SETERR_RETURN(Context, AL_INVALID_ENUM, Source->id, "Invalid source integer64 property", + AL_FALSE); } @@ -1733,7 +1752,7 @@ AL_API ALvoid AL_APIENTRY alGenSources(ALsizei n, ALuint *sources) if(!context) return; if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Generating negative sources", done); device = context->Device; for(cur = 0;cur < n;cur++) { @@ -1741,7 +1760,7 @@ AL_API ALvoid AL_APIENTRY alGenSources(ALsizei n, ALuint *sources) if(!source) { alDeleteSources(cur, sources); - SET_ERROR_AND_GOTO(context, AL_OUT_OF_MEMORY, done); + SETERR_GOTO(context, AL_OUT_OF_MEMORY,0, "Failed to allocate source object", done); } InitSourceParams(source, device->NumAuxSends); @@ -1755,7 +1774,7 @@ AL_API ALvoid AL_APIENTRY alGenSources(ALsizei n, ALuint *sources) al_free(source); alDeleteSources(cur, sources); - SET_ERROR_AND_GOTO(context, err, done); + SETERR_GOTO(context, err, 0, "Failed to set source ID", done); } sources[cur] = source->id; @@ -1778,13 +1797,13 @@ AL_API ALvoid AL_APIENTRY alDeleteSources(ALsizei n, const ALuint *sources) LockSourcesWrite(context); if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Deleting negative sources", done); /* Check that all Sources are valid */ for(i = 0;i < n;i++) { if(LookupSource(context, sources[i]) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, sources[i], "Invalid source ID", done); } device = context->Device; for(i = 0;i < n;i++) @@ -2490,11 +2509,11 @@ AL_API ALvoid AL_APIENTRY alSourcePlayv(ALsizei n, const ALuint *sources) LockSourcesRead(context); if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Playing negative sources", done); for(i = 0;i < n;i++) { if(!LookupSource(context, sources[i])) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, sources[i], "Invalid source ID", done); } device = context->Device; @@ -2517,7 +2536,7 @@ AL_API ALvoid AL_APIENTRY alSourcePlayv(ALsizei n, const ALuint *sources) if(context->MaxVoices >= newcount) { ALCdevice_Unlock(device); - SET_ERROR_AND_GOTO(context, AL_OUT_OF_MEMORY, done); + SETERR_GOTO(context, AL_OUT_OF_MEMORY, 0, "Max voice count overflow", done); } AllocateVoices(context, newcount, device->NumAuxSends); } @@ -2677,11 +2696,11 @@ AL_API ALvoid AL_APIENTRY alSourcePausev(ALsizei n, const ALuint *sources) LockSourcesRead(context); if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Pausing negative sources", done); for(i = 0;i < n;i++) { if(!LookupSource(context, sources[i])) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, sources[i], "Invalid source ID", done); } device = context->Device; @@ -2724,11 +2743,11 @@ AL_API ALvoid AL_APIENTRY alSourceStopv(ALsizei n, const ALuint *sources) LockSourcesRead(context); if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Stopping negative sources", done); for(i = 0;i < n;i++) { if(!LookupSource(context, sources[i])) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, sources[i], "Invalid source ID", done); } device = context->Device; @@ -2774,11 +2793,11 @@ AL_API ALvoid AL_APIENTRY alSourceRewindv(ALsizei n, const ALuint *sources) LockSourcesRead(context); if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Rewinding negative sources", done); for(i = 0;i < n;i++) { if(!LookupSource(context, sources[i])) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, sources[i], "Invalid source ID", done); } device = context->Device; @@ -2828,16 +2847,16 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint src, ALsizei nb, const ALu LockSourcesRead(context); if(!(nb >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, src, "Queueing negative buffers", done); if((source=LookupSource(context, src)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, src, "Invalid source ID", done); WriteLock(&source->queue_lock); if(source->SourceType == AL_STATIC) { WriteUnlock(&source->queue_lock); /* Can't queue on a Static Source */ - SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, done); + SETERR_GOTO(context, AL_INVALID_OPERATION, src, "Queueing onto a static source", done); } /* Check for a valid Buffer, for its frequency and format */ @@ -2862,7 +2881,7 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint src, ALsizei nb, const ALu if(buffers[i] && (buffer=LookupBuffer(device, buffers[i])) == NULL) { WriteUnlock(&source->queue_lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, buffer_error); + SETERR_GOTO(context, AL_INVALID_NAME, src, "Invalid buffer ID", buffer_error); } if(!BufferListStart) @@ -2892,7 +2911,8 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint src, ALsizei nb, const ALu if(buffer->MappedAccess != 0 && !(buffer->MappedAccess&AL_MAP_PERSISTENT_BIT_SOFT)) { WriteUnlock(&source->queue_lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, buffer_error); + SETERR_GOTO(context, AL_INVALID_OPERATION, src, + "Queueing non-persistently mapped buffer", buffer_error); } if(BufferFmt == NULL) @@ -2902,7 +2922,8 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint src, ALsizei nb, const ALu BufferFmt->OriginalType != buffer->OriginalType) { WriteUnlock(&source->queue_lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, buffer_error); + alSetError(context, AL_INVALID_OPERATION, src, + "Queueing buffer with mismatched format"); buffer_error: /* A buffer failed (invalid ID or format), so unlock and release @@ -2973,20 +2994,25 @@ AL_API ALvoid AL_APIENTRY alSourceUnqueueBuffers(ALuint src, ALsizei nb, ALuint LockSourcesRead(context); if(!(nb >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, src, "Unqueueing negative buffers", done); if((source=LookupSource(context, src)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, src, "Invalid source ID", done); /* Nothing to unqueue. */ if(nb == 0) goto done; WriteLock(&source->queue_lock); - if(source->Looping || source->SourceType != AL_STREAMING) + if(source->Looping) + { + WriteUnlock(&source->queue_lock); + SETERR_GOTO(context, AL_INVALID_VALUE, src, "Unqueueing from a looping source", done); + } + if(source->SourceType != AL_STREAMING) { WriteUnlock(&source->queue_lock); - /* Trying to unqueue buffers on a looping or non-streaming source. */ - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, src, "Unqueueing from a non-streaming source", + done); } /* Find the new buffer queue head */ @@ -3008,8 +3034,7 @@ AL_API ALvoid AL_APIENTRY alSourceUnqueueBuffers(ALuint src, ALsizei nb, ALuint if(i != nb) { WriteUnlock(&source->queue_lock); - /* Trying to unqueue pending buffers. */ - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, src, "Unqueueing pending buffers", done); } /* Swap it, and cut the new head from the old. */ diff --git a/OpenAL32/alState.c b/OpenAL32/alState.c index 36afd46e..f34f385f 100644 --- a/OpenAL32/alState.c +++ b/OpenAL32/alState.c @@ -88,11 +88,10 @@ AL_API ALvoid AL_APIENTRY alEnable(ALenum capability) break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, 0, "Invalid enable property"); } - -done: WriteUnlock(&context->PropLock); + ALCcontext_DecRef(context); } @@ -112,11 +111,10 @@ AL_API ALvoid AL_APIENTRY alDisable(ALenum capability) break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, 0, "Invalid disable property"); } - -done: WriteUnlock(&context->PropLock); + ALCcontext_DecRef(context); } @@ -135,12 +133,10 @@ AL_API ALboolean AL_APIENTRY alIsEnabled(ALenum capability) break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, 0, "Invalid is enabled property"); } -done: ALCcontext_DecRef(context); - return value; } @@ -194,12 +190,10 @@ AL_API ALboolean AL_APIENTRY alGetBoolean(ALenum pname) break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, 0, "Invalid boolean property"); } -done: ALCcontext_DecRef(context); - return value; } @@ -247,12 +241,10 @@ AL_API ALdouble AL_APIENTRY alGetDouble(ALenum pname) break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, 0, "Invalid double property"); } -done: ALCcontext_DecRef(context); - return value; } @@ -300,12 +292,10 @@ AL_API ALfloat AL_APIENTRY alGetFloat(ALenum pname) break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, 0, "Invalid float property"); } -done: ALCcontext_DecRef(context); - return value; } @@ -353,12 +343,10 @@ AL_API ALint AL_APIENTRY alGetInteger(ALenum pname) break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, 0, "Invalid integer property"); } -done: ALCcontext_DecRef(context); - return value; } @@ -406,12 +394,10 @@ AL_API ALint64SOFT AL_APIENTRY alGetInteger64SOFT(ALenum pname) break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, 0, "Invalid integer64 property"); } -done: ALCcontext_DecRef(context); - return value; } @@ -433,13 +419,11 @@ AL_API void* AL_APIENTRY alGetPointerSOFT(ALenum pname) value = context->EventParam; break; - default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + default: + alSetError(context, AL_INVALID_VALUE, 0, "Invalid pointer property"); } -done: ALCcontext_DecRef(context); - return value; } @@ -461,15 +445,14 @@ AL_API void AL_APIENTRY alGetPointervSOFT(ALenum pname, void **values) context = GetContextRef(); if(!context) return; - if(!(values)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + if(!values) + alSetError(context, AL_INVALID_VALUE, 0, "NULL pointer"); switch(pname) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, 0, "Invalid pointer-vector property"); } -done: ALCcontext_DecRef(context); } @@ -497,15 +480,14 @@ AL_API ALvoid AL_APIENTRY alGetBooleanv(ALenum pname, ALboolean *values) context = GetContextRef(); if(!context) return; - if(!(values)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + if(!values) + alSetError(context, AL_INVALID_VALUE, 0, "NULL pointer"); switch(pname) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, 0, "Invalid boolean-vector property"); } -done: ALCcontext_DecRef(context); } @@ -533,15 +515,14 @@ AL_API ALvoid AL_APIENTRY alGetDoublev(ALenum pname, ALdouble *values) context = GetContextRef(); if(!context) return; - if(!(values)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + if(!values) + alSetError(context, AL_INVALID_VALUE, 0, "NULL pointer"); switch(pname) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, 0, "Invalid double-vector property"); } -done: ALCcontext_DecRef(context); } @@ -569,15 +550,14 @@ AL_API ALvoid AL_APIENTRY alGetFloatv(ALenum pname, ALfloat *values) context = GetContextRef(); if(!context) return; - if(!(values)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + if(!values) + alSetError(context, AL_INVALID_VALUE, 0, "NULL pointer"); switch(pname) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, 0, "Invalid float-vector property"); } -done: ALCcontext_DecRef(context); } @@ -605,13 +585,14 @@ AL_API ALvoid AL_APIENTRY alGetIntegerv(ALenum pname, ALint *values) context = GetContextRef(); if(!context) return; + if(!values) + alSetError(context, AL_INVALID_VALUE, 0, "NULL pointer"); switch(pname) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, 0, "Invalid integer-vector property"); } -done: ALCcontext_DecRef(context); } @@ -639,13 +620,14 @@ AL_API void AL_APIENTRY alGetInteger64vSOFT(ALenum pname, ALint64SOFT *values) context = GetContextRef(); if(!context) return; + if(!values) + alSetError(context, AL_INVALID_VALUE, 0, "NULL pointer"); switch(pname) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, 0, "Invalid integer64-vector property"); } -done: ALCcontext_DecRef(context); } @@ -700,12 +682,10 @@ AL_API const ALchar* AL_APIENTRY alGetString(ALenum pname) break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, 0, "Invalid string property"); } -done: ALCcontext_DecRef(context); - return value; } @@ -717,7 +697,7 @@ AL_API ALvoid AL_APIENTRY alDopplerFactor(ALfloat value) if(!context) return; if(!(value >= 0.0f && isfinite(value))) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Doppler factor out of range", done); WriteLock(&context->PropLock); context->DopplerFactor = value; @@ -736,7 +716,7 @@ AL_API ALvoid AL_APIENTRY alDopplerVelocity(ALfloat value) if(!context) return; if(!(value >= 0.0f && isfinite(value))) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Doppler velocity out of range", done); WriteLock(&context->PropLock); context->DopplerVelocity = value; @@ -755,7 +735,7 @@ AL_API ALvoid AL_APIENTRY alSpeedOfSound(ALfloat value) if(!context) return; if(!(value > 0.0f && isfinite(value))) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Speed of sound out of range", done); WriteLock(&context->PropLock); context->SpeedOfSound = value; @@ -777,7 +757,7 @@ AL_API ALvoid AL_APIENTRY alDistanceModel(ALenum value) value == AL_LINEAR_DISTANCE || value == AL_LINEAR_DISTANCE_CLAMPED || value == AL_EXPONENT_DISTANCE || value == AL_EXPONENT_DISTANCE_CLAMPED || value == AL_NONE)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Distance model out of range", done); WriteLock(&context->PropLock); context->DistanceModel = value; @@ -834,12 +814,12 @@ AL_API const ALchar* AL_APIENTRY alGetStringiSOFT(ALenum pname, ALsizei index) { case AL_RESAMPLER_NAME_SOFT: if(index < 0 || (size_t)index >= COUNTOF(ResamplerNames)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Resampler name index out of range", done); value = ResamplerNames[index]; break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, 0, "Invalid string indexed property"); } done: diff --git a/OpenAL32/event.c b/OpenAL32/event.c index 4e844ce9..88885f52 100644 --- a/OpenAL32/event.c +++ b/OpenAL32/event.c @@ -17,11 +17,9 @@ AL_API void AL_APIENTRY alEventControlSOFT(ALsizei count, const ALenum *types, A context = GetContextRef(); if(!context) return; - if(count < 0) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + if(count < 0) SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Controlling negative events", done); if(count == 0) goto done; - if(!types) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + if(!types) SETERR_GOTO(context, AL_INVALID_VALUE, 0, "NULL pointer", done); for(i = 0;i < count;i++) { @@ -34,17 +32,16 @@ AL_API void AL_APIENTRY alEventControlSOFT(ALsizei count, const ALenum *types, A else if(types[i] == AL_EVENT_TYPE_PERFORMANCE_SOFT) flags |= EventType_Performance; else - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + SETERR_GOTO(context, AL_INVALID_ENUM, 0, "Invalid event type", done); } almtx_lock(&context->EventLock); - if(enable) context->EnabledEvts |= flags; else context->EnabledEvts &= ~flags; - almtx_unlock(&context->EventLock); + done: ALCcontext_DecRef(context); } |