+1
include/SDL3/SDL_stdinc.h
+1
include/SDL3/SDL_stdinc.h
···
46
46
47
47
#ifndef __cplusplus
48
48
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
49
+
(defined(_MSC_VER) && (_MSC_VER >= 1910 /* Visual Studio 2017 */)) || \
49
50
defined(SDL_INCLUDE_STDBOOL_H)
50
51
#include <stdbool.h>
51
52
#elif !defined(__bool_true_false_are_defined) && !defined(bool)
+2
-2
src/core/windows/SDL_windows.c
+2
-2
src/core/windows/SDL_windows.c
···
306
306
307
307
BOOL WIN_IsEqualGUID(const GUID *a, const GUID *b)
308
308
{
309
-
return SDL_memcmp(a, b, sizeof(*a)) == 0;
309
+
return (SDL_memcmp(a, b, sizeof(*a)) == 0);
310
310
}
311
311
312
312
BOOL WIN_IsEqualIID(REFIID a, REFIID b)
313
313
{
314
-
return SDL_memcmp(a, b, sizeof(*a)) == 0;
314
+
return (SDL_memcmp(a, b, sizeof(*a)) == 0);
315
315
}
316
316
317
317
void WIN_RECTToRect(const RECT *winrect, SDL_Rect *sdlrect)
+3
-4
src/filesystem/windows/SDL_sysfsops.c
+3
-4
src/filesystem/windows/SDL_sysfsops.c
···
45
45
const size_t patternlen = SDL_strlen(path) + 3;
46
46
char *pattern = (char *) SDL_malloc(patternlen);
47
47
if (!pattern) {
48
-
return -1;
48
+
return false;
49
49
}
50
50
51
51
// you need a wildcard to enumerate through FindFirstFileEx(), but the wildcard is only checked in the
···
56
56
WCHAR *wpattern = WIN_UTF8ToStringW(pattern);
57
57
SDL_free(pattern);
58
58
if (!wpattern) {
59
-
return -1;
59
+
return false;
60
60
}
61
61
62
62
WIN32_FIND_DATAW entw;
63
63
HANDLE dir = FindFirstFileExW(wpattern, FindExInfoStandard, &entw, FindExSearchNameMatch, NULL, 0);
64
64
SDL_free(wpattern);
65
65
if (dir == INVALID_HANDLE_VALUE) {
66
-
WIN_SetError("Failed to enumerate directory");
67
-
return -1;
66
+
return WIN_SetError("Failed to enumerate directory");
68
67
}
69
68
70
69
do {
+1
-1
src/haptic/SDL_haptic.c
+1
-1
src/haptic/SDL_haptic.c
+5
-4
src/haptic/windows/SDL_dinputhaptic.c
+5
-4
src/haptic/windows/SDL_dinputhaptic.c
···
455
455
return false;
456
456
}
457
457
458
-
return WIN_IsEqualGUID(&hap_instance.guidInstance, &joy_instance.guidInstance);
458
+
return (WIN_IsEqualGUID(&hap_instance.guidInstance, &joy_instance.guidInstance) == TRUE);
459
459
}
460
460
461
461
bool SDL_DINPUT_HapticOpenFromJoystick(SDL_Haptic *haptic, SDL_Joystick *joystick)
···
1052
1052
1053
1053
ret = IDirectInputEffect_GetEffectStatus(effect->hweffect->ref, &status);
1054
1054
if (FAILED(ret)) {
1055
-
return DI_SetError("Getting effect status", ret);
1055
+
DI_SetError("Getting effect status", ret);
1056
+
return -1;
1056
1057
}
1057
1058
1058
1059
if (status == 0) {
1059
-
return false;
1060
+
return 0;
1060
1061
}
1061
-
return true;
1062
+
return 1;
1062
1063
}
1063
1064
1064
1065
bool SDL_DINPUT_HapticSetGain(SDL_Haptic *haptic, int gain)
+1
-1
src/joystick/SDL_joystick.c
+1
-1
src/joystick/SDL_joystick.c
+1
-1
src/storage/steam/SDL_steamstorage.c
+1
-1
src/storage/steam/SDL_steamstorage.c
···
95
95
96
96
static bool STEAM_WriteStorageFile(void *userdata, const char *path, const void *source, Uint64 length)
97
97
{
98
-
int result = false;
98
+
bool result = false;
99
99
STEAM_RemoteStorage *steam = (STEAM_RemoteStorage*) userdata;
100
100
void *steamremotestorage = steam->SteamAPI_SteamRemoteStorage_v016();
101
101
if (steamremotestorage == NULL) {
+2
-2
src/thread/windows/SDL_syscond_cv.c
+2
-2
src/thread/windows/SDL_syscond_cv.c
···
119
119
mutex->count = 0;
120
120
mutex->owner = 0;
121
121
122
-
result = pSleepConditionVariableSRW(&cond->cond, &mutex->srw, timeout, 0);
122
+
result = (pSleepConditionVariableSRW(&cond->cond, &mutex->srw, timeout, 0) == TRUE);
123
123
124
124
// The mutex is owned by us again, regardless of status of the wait
125
125
SDL_assert(mutex->count == 0 && mutex->owner == 0);
···
130
130
131
131
SDL_assert(SDL_mutex_impl_active.Type == SDL_MUTEX_CS);
132
132
133
-
result = pSleepConditionVariableCS(&cond->cond, &mutex->cs, timeout);
133
+
result = (pSleepConditionVariableCS(&cond->cond, &mutex->cs, timeout) == TRUE);
134
134
}
135
135
136
136
return result;
+1
-1
src/thread/windows/SDL_sysmutex.c
+1
-1
src/thread/windows/SDL_sysmutex.c
···
157
157
static bool SDL_TryLockMutex_cs(SDL_Mutex *mutex_)
158
158
{
159
159
SDL_mutex_cs *mutex = (SDL_mutex_cs *)mutex_;
160
-
return TryEnterCriticalSection(&mutex->cs);
160
+
return (TryEnterCriticalSection(&mutex->cs) == TRUE);
161
161
}
162
162
163
163
static void SDL_UnlockMutex_cs(SDL_Mutex *mutex_) SDL_NO_THREAD_SAFETY_ANALYSIS // clang doesn't know about NULL mutexes