diff options
author | Chris Robinson <[email protected]> | 2011-06-17 23:59:25 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2011-06-17 23:59:25 -0700 |
commit | 0d39ac652889bc2ecea0286fe24fcdcd6c04995e (patch) | |
tree | d21b0a88ed08e2901c5e5a6049705fb64a9d8247 /OpenAL32 | |
parent | 157e1394d6d3d32630d287a9725396ec4dff24bb (diff) |
Allow alThunkAddEntry to return a proper error
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/Include/alThunk.h | 6 | ||||
-rw-r--r-- | OpenAL32/alAuxEffectSlot.c | 6 | ||||
-rw-r--r-- | OpenAL32/alBuffer.c | 5 | ||||
-rw-r--r-- | OpenAL32/alEffect.c | 5 | ||||
-rw-r--r-- | OpenAL32/alFilter.c | 5 | ||||
-rw-r--r-- | OpenAL32/alSource.c | 6 | ||||
-rw-r--r-- | OpenAL32/alThunk.c | 7 |
7 files changed, 22 insertions, 18 deletions
diff --git a/OpenAL32/Include/alThunk.h b/OpenAL32/Include/alThunk.h index 902f00e5..b4dae22a 100644 --- a/OpenAL32/Include/alThunk.h +++ b/OpenAL32/Include/alThunk.h @@ -12,7 +12,7 @@ extern "C" { void alThunkInit(void); void alThunkExit(void); -ALuint alThunkAddEntry(ALvoid *ptr); +ALenum alThunkAddEntry(ALvoid *ptr, ALuint *idx); void alThunkRemoveEntry(ALuint index); ALvoid *alThunkLookupEntry(ALuint index); @@ -20,7 +20,7 @@ ALvoid *alThunkLookupEntry(ALuint index); #define ALTHUNK_INIT() alThunkInit() #define ALTHUNK_EXIT() alThunkExit() -#define ALTHUNK_ADDENTRY(p) alThunkAddEntry(p) +#define ALTHUNK_ADDENTRY(p,i) alThunkAddEntry(p,i) #define ALTHUNK_REMOVEENTRY(i) alThunkRemoveEntry(i) #define ALTHUNK_LOOKUPENTRY(i) alThunkLookupEntry(i) @@ -28,7 +28,7 @@ ALvoid *alThunkLookupEntry(ALuint index); #define ALTHUNK_INIT() #define ALTHUNK_EXIT() -#define ALTHUNK_ADDENTRY(p) ((ALuint)p) +#define ALTHUNK_ADDENTRY(p,i) ((*(i) = (ALuint)p),AL_NO_ERROR) #define ALTHUNK_REMOVEENTRY(i) ((ALvoid)i) #define ALTHUNK_LOOKUPENTRY(i) ((ALvoid*)(i)) diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c index 6fba29ee..5138487d 100644 --- a/OpenAL32/alAuxEffectSlot.c +++ b/OpenAL32/alAuxEffectSlot.c @@ -68,9 +68,9 @@ AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslo break; } - slot->effectslot = (ALuint)ALTHUNK_ADDENTRY(slot); - err = InsertUIntMapEntry(&Context->EffectSlotMap, - slot->effectslot, slot); + err = ALTHUNK_ADDENTRY(slot, &slot->effectslot); + if(err == AL_NO_ERROR) + err = InsertUIntMapEntry(&Context->EffectSlotMap, slot->effectslot, slot); if(err != AL_NO_ERROR) { ALTHUNK_REMOVEENTRY(slot->effectslot); diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c index ac3a85af..9e245eef 100644 --- a/OpenAL32/alBuffer.c +++ b/OpenAL32/alBuffer.c @@ -161,8 +161,9 @@ AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *buffers) break; } - buffer->buffer = (ALuint)ALTHUNK_ADDENTRY(buffer); - err = InsertUIntMapEntry(&device->BufferMap, buffer->buffer, buffer); + err = ALTHUNK_ADDENTRY(buffer, &buffer->buffer); + if(err == AL_NO_ERROR) + err = InsertUIntMapEntry(&device->BufferMap, buffer->buffer, buffer); if(err != AL_NO_ERROR) { ALTHUNK_REMOVEENTRY(buffer->buffer); diff --git a/OpenAL32/alEffect.c b/OpenAL32/alEffect.c index 62e4d0c4..45fd5e78 100644 --- a/OpenAL32/alEffect.c +++ b/OpenAL32/alEffect.c @@ -63,8 +63,9 @@ AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects) break; } - effect->effect = ALTHUNK_ADDENTRY(effect); - err = InsertUIntMapEntry(&device->EffectMap, effect->effect, effect); + err = ALTHUNK_ADDENTRY(effect, &effect->effect); + if(err == AL_NO_ERROR) + err = InsertUIntMapEntry(&device->EffectMap, effect->effect, effect); if(err != AL_NO_ERROR) { ALTHUNK_REMOVEENTRY(effect->effect); diff --git a/OpenAL32/alFilter.c b/OpenAL32/alFilter.c index 1535dbce..c68a949a 100644 --- a/OpenAL32/alFilter.c +++ b/OpenAL32/alFilter.c @@ -59,8 +59,9 @@ AL_API ALvoid AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters) break; } - filter->filter = ALTHUNK_ADDENTRY(filter); - err = InsertUIntMapEntry(&device->FilterMap, filter->filter, filter); + err = ALTHUNK_ADDENTRY(filter, &filter->filter); + if(err == AL_NO_ERROR) + err = InsertUIntMapEntry(&device->FilterMap, filter->filter, filter); if(err != AL_NO_ERROR) { ALTHUNK_REMOVEENTRY(filter->filter); diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index c50e648c..ec730040 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -86,9 +86,9 @@ AL_API ALvoid AL_APIENTRY alGenSources(ALsizei n,ALuint *sources) break; } - source->source = (ALuint)ALTHUNK_ADDENTRY(source); - err = InsertUIntMapEntry(&Context->SourceMap, source->source, - source); + err = ALTHUNK_ADDENTRY(source, &source->source); + if(err == AL_NO_ERROR) + err = InsertUIntMapEntry(&Context->SourceMap, source->source, source); if(err != AL_NO_ERROR) { ALTHUNK_REMOVEENTRY(source->source); diff --git a/OpenAL32/alThunk.c b/OpenAL32/alThunk.c index 08b80b06..467615cf 100644 --- a/OpenAL32/alThunk.c +++ b/OpenAL32/alThunk.c @@ -50,7 +50,7 @@ void alThunkExit(void) DeleteCriticalSection(&g_ThunkLock); } -ALuint alThunkAddEntry(ALvoid *ptr) +ALenum alThunkAddEntry(ALvoid *ptr, ALuint *idx) { ALuint index; @@ -71,7 +71,7 @@ ALuint alThunkAddEntry(ALvoid *ptr) { LeaveCriticalSection(&g_ThunkLock); AL_PRINT("Realloc failed to increase to %u enties!\n", g_ThunkArraySize*2); - return 0; + return AL_OUT_OF_MEMORY; } memset(&NewList[g_ThunkArraySize], 0, g_ThunkArraySize*sizeof(ThunkEntry)); g_ThunkArraySize *= 2; @@ -80,10 +80,11 @@ ALuint alThunkAddEntry(ALvoid *ptr) g_ThunkArray[index].ptr = ptr; g_ThunkArray[index].InUse = AL_TRUE; + *idx = index+1; LeaveCriticalSection(&g_ThunkLock); - return index+1; + return AL_NO_ERROR; } void alThunkRemoveEntry(ALuint index) |