aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alMain.h18
-rw-r--r--OpenAL32/alAuxEffectSlot.c2
-rw-r--r--OpenAL32/alSource.c6
3 files changed, 14 insertions, 12 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index 0d8f14dc..b8057fa1 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -226,6 +226,8 @@ void *GetSymbol(void *handle, const char *name);
#endif
+typedef void *volatile XchgPtr;
+
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1))
typedef ALuint RefCount;
static __inline RefCount IncrementRef(volatile RefCount *ptr)
@@ -237,7 +239,7 @@ static __inline int ExchangeInt(volatile int *ptr, int newval)
{
return __sync_lock_test_and_set(ptr, newval);
}
-static __inline void *ExchangePtr(void *volatile*ptr, void *newval)
+static __inline void *ExchangePtr(XchgPtr *ptr, void *newval)
{
return __sync_lock_test_and_set(ptr, newval);
}
@@ -245,7 +247,7 @@ static __inline ALboolean CompExchangeInt(volatile int *ptr, int oldval, int new
{
return __sync_bool_compare_and_swap(ptr, oldval, newval);
}
-static __inline ALboolean CompExchangePtr(void *volatile*ptr, void *oldval, void *newval)
+static __inline ALboolean CompExchangePtr(XchgPtr *ptr, void *oldval, void *newval)
{
return __sync_bool_compare_and_swap(ptr, oldval, newval);
}
@@ -288,7 +290,7 @@ static __inline ALboolean CompExchangeInt(volatile int *dest, int oldval, int ne
return ret == oldval;
}
-static __inline void *ExchangePtr(void *volatile*dest, void *newval)
+static __inline void *ExchangePtr(XchgPtr *dest, void *newval)
{
void *ret;
__asm__ __volatile__(
@@ -304,7 +306,7 @@ static __inline void *ExchangePtr(void *volatile*dest, void *newval)
return ret;
}
-static __inline ALboolean CompExchangePtr(void *volatile*dest, void *oldval, void *newval)
+static __inline ALboolean CompExchangePtr(XchgPtr *dest, void *oldval, void *newval)
{
void *ret;
__asm__ __volatile__(
@@ -338,7 +340,7 @@ static __inline int ExchangeInt(volatile int *ptr, int newval)
} u = { ptr };
return InterlockedExchange(u.l, newval);
}
-static __inline void *ExchangePtr(void *volatile*ptr, void *newval)
+static __inline void *ExchangePtr(XchgPtr *ptr, void *newval)
{
return InterlockedExchangePointer(ptr, newval);
}
@@ -350,7 +352,7 @@ static __inline ALboolean CompExchangeInt(volatile int *ptr, int oldval, int new
} u = { ptr };
return InterlockedCompareExchange(u.l, newval, oldval) == oldval;
}
-static __inline ALboolean CompExchangePtr(void *volatile*ptr, void *oldval, void *newval)
+static __inline ALboolean CompExchangePtr(XchgPtr *ptr, void *oldval, void *newval)
{
return InterlockedCompareExchangePointer(ptr, newval, oldval) == oldval;
}
@@ -374,7 +376,7 @@ static __inline int ExchangeInt(volatile int *ptr, int newval)
} while(!OSAtomicCompareAndSwap32Barrier(oldval, newval, ptr));
return oldval;
}
-static __inline void *ExchangePtr(void *volatile*ptr, void *newval)
+static __inline void *ExchangePtr(XchgPtr *ptr, void *newval)
{
void *oldval;
do {
@@ -386,7 +388,7 @@ static __inline ALboolean CompExchangeInt(volatile int *ptr, int oldval, int new
{
return OSAtomicCompareAndSwap32Barrier(oldval, newval, ptr);
}
-static __inline ALboolean CompExchangePtr(void *volatile*ptr, void *oldval, void *newval)
+static __inline ALboolean CompExchangePtr(XchgPtr *ptr, void *oldval, void *newval)
{
return OSAtomicCompareAndSwapPtrBarrier(oldval, newval, ptr);
}
diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c
index c8a12d33..03a6218b 100644
--- a/OpenAL32/alAuxEffectSlot.c
+++ b/OpenAL32/alAuxEffectSlot.c
@@ -570,7 +570,7 @@ static ALvoid InitializeEffect(ALCcontext *Context, ALeffectslot *EffectSlot, AL
alSetError(Context, AL_OUT_OF_MEMORY);
return;
}
- State = ExchangePtr((void**)&EffectSlot->EffectState, State);
+ State = ExchangePtr((XchgPtr*)&EffectSlot->EffectState, State);
if(!effect)
memset(&EffectSlot->effect, 0, sizeof(EffectSlot->effect));
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index 7d0aa978..982da4c4 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -583,7 +583,7 @@ AL_API ALvoid AL_APIENTRY alSourcei(ALuint source,ALenum eParam,ALint lValue)
// Increment reference counter for buffer
IncrementRef(&buffer->ref);
- oldlist = ExchangePtr((void**)&Source->queue, BufferListItem);
+ oldlist = ExchangePtr((XchgPtr*)&Source->queue, BufferListItem);
Source->BuffersInQueue = 1;
ReadLock(&buffer->lock);
@@ -600,7 +600,7 @@ AL_API ALvoid AL_APIENTRY alSourcei(ALuint source,ALenum eParam,ALint lValue)
{
// Source is now in UNDETERMINED mode
Source->lSourceType = AL_UNDETERMINED;
- oldlist = ExchangePtr((void**)&Source->queue, NULL);
+ oldlist = ExchangePtr((XchgPtr*)&Source->queue, NULL);
}
// Delete all previous elements in the queue
@@ -780,7 +780,7 @@ AL_API void AL_APIENTRY alSource3i(ALuint source, ALenum eParam, ALint lValue1,
/* Release refcount on the previous slot, and add one for
* the new slot */
if(ALEffectSlot) IncrementRef(&ALEffectSlot->ref);
- ALEffectSlot = ExchangePtr((void**)&Source->Send[lValue2].Slot, ALEffectSlot);
+ ALEffectSlot = ExchangePtr((XchgPtr*)&Source->Send[lValue2].Slot, ALEffectSlot);
if(ALEffectSlot) DecrementRef(&ALEffectSlot->ref);
if(!ALFilter)