Use C99 bool internally in SDL

This commit is contained in:
Sam Lantinga
2024-08-22 09:21:26 -07:00
parent 6501e90018
commit 8f546bb3c9
450 changed files with 6046 additions and 6033 deletions

View File

@@ -136,12 +136,12 @@ SDL_bool SDL_AtomicCompareAndSwap(SDL_AtomicInt *a, int oldval, int newval)
#elif defined(SDL_PLATFORM_SOLARIS)
return ((int)atomic_cas_uint((volatile uint_t *)&a->value, (uint_t)oldval, (uint_t)newval) == oldval);
#elif defined(EMULATE_CAS)
SDL_bool retval = SDL_FALSE;
bool retval = false;
enterLock(a);
if (a->value == oldval) {
a->value = newval;
retval = SDL_TRUE;
retval = true;
}
leaveLock(a);
@@ -166,12 +166,12 @@ SDL_bool SDL_AtomicCompareAndSwapPointer(void **a, void *oldval, void *newval)
#elif defined(SDL_PLATFORM_SOLARIS)
return (atomic_cas_ptr(a, oldval, newval) == oldval);
#elif defined(EMULATE_CAS)
SDL_bool retval = SDL_FALSE;
bool retval = false;
enterLock(a);
if (*a == oldval) {
*a = newval;
retval = SDL_TRUE;
retval = true;
}
leaveLock(a);

View File

@@ -128,13 +128,13 @@ SDL_bool SDL_TryLockSpinlock(SDL_SpinLock *lock)
return ((int)atomic_cas_32((volatile uint32_t *)lock, 0, 1) == 0);
#elif defined(PS2)
uint32_t oldintr;
SDL_bool res = SDL_FALSE;
bool res = false;
// disable interuption
oldintr = DIntr();
if (*lock == 0) {
*lock = 1;
res = SDL_TRUE;
res = true;
}
// enable interuption
if (oldintr) {
@@ -153,10 +153,10 @@ SDL_bool SDL_TryLockSpinlock(SDL_SpinLock *lock)
if (*lock == 0) {
*lock = 1;
SDL_UnlockMutex(_spinlock_mutex);
return SDL_TRUE;
return true;
} else {
SDL_UnlockMutex(_spinlock_mutex);
return SDL_FALSE;
return false;
}
#endif
}