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

@@ -353,7 +353,7 @@ int SDL_RemoveTimer(SDL_TimerID id)
{
SDL_TimerData *data = &SDL_timer_data;
SDL_TimerMap *prev, *entry;
SDL_bool canceled = SDL_FALSE;
bool canceled = false;
if (!id) {
return SDL_InvalidParamError("id");
@@ -377,7 +377,7 @@ int SDL_RemoveTimer(SDL_TimerID id)
if (entry) {
if (!SDL_AtomicGet(&entry->timer->canceled)) {
SDL_AtomicSet(&entry->timer->canceled, 1);
canceled = SDL_TRUE;
canceled = true;
}
SDL_free(entry);
}

View File

@@ -64,22 +64,22 @@
#if !defined(HAVE_CLOCK_GETTIME) && defined(SDL_PLATFORM_APPLE)
mach_timebase_info_data_t mach_base_info;
#endif
static SDL_bool checked_monotonic_time = SDL_FALSE;
static SDL_bool has_monotonic_time = SDL_FALSE;
static bool checked_monotonic_time = false;
static bool has_monotonic_time = false;
static void CheckMonotonicTime(void)
{
#ifdef HAVE_CLOCK_GETTIME
struct timespec value;
if (clock_gettime(SDL_MONOTONIC_CLOCK, &value) == 0) {
has_monotonic_time = SDL_TRUE;
has_monotonic_time = true;
} else
#elif defined(SDL_PLATFORM_APPLE)
if (mach_timebase_info(&mach_base_info) == 0) {
has_monotonic_time = SDL_TRUE;
has_monotonic_time = true;
}
#endif
checked_monotonic_time = SDL_TRUE;
checked_monotonic_time = true;
}
Uint64 SDL_GetPerformanceCounter(void)
@@ -101,7 +101,7 @@ Uint64 SDL_GetPerformanceCounter(void)
#elif defined(SDL_PLATFORM_APPLE)
ticks = mach_absolute_time();
#else
SDL_assert(SDL_FALSE);
SDL_assert(false);
ticks = 0;
#endif
} else {
@@ -147,7 +147,7 @@ void SDL_SYS_DelayNS(Uint64 ns)
#endif
#ifdef SDL_PLATFORM_EMSCRIPTEN
if (emscripten_has_asyncify() && SDL_GetHintBoolean(SDL_HINT_EMSCRIPTEN_ASYNCIFY, SDL_TRUE)) {
if (emscripten_has_asyncify() && SDL_GetHintBoolean(SDL_HINT_EMSCRIPTEN_ASYNCIFY, true)) {
// pseudo-synchronous pause, used directly or through e.g. SDL_WaitEvent
emscripten_sleep(ns / SDL_NS_PER_MS);
return;