Pointer as bool (libsdl-org#7214)

This commit is contained in:
Sylvain authored and Sam Lantinga committed 2023-11-09 14:18:36 -08:00
1 parent 23db971681
commit d8600f717e
371 files changed
+2448 -2442

No files matched your search

+6 -6
View File
@@ -829,7 +829,7 @@ static void AddController(SDL_JoystickID id, SDL_bool verbose)
}
new_controllers = (Controller *)SDL_realloc(controllers, (num_controllers + 1) * sizeof(*controllers));
if (new_controllers == NULL) {
if (!new_controllers) {
return;
}
@@ -1092,7 +1092,7 @@ static void OpenVirtualGamepad(void)
SDL_Log("Couldn't attach virtual device: %s\n", SDL_GetError());
} else {
virtual_joystick = SDL_OpenJoystick(virtual_id);
if (virtual_joystick == NULL) {
if (!virtual_joystick) {
SDL_Log("Couldn't open virtual device: %s\n", SDL_GetError());
}
}
@@ -1818,7 +1818,7 @@ int main(int argc, char *argv[])
/* Initialize test framework */
state = SDLTest_CommonCreateState(argv, 0);
if (state == NULL) {
if (!state) {
return 1;
}
@@ -1890,13 +1890,13 @@ int main(int argc, char *argv[])
screen_width = (int)SDL_ceilf(SCREEN_WIDTH * content_scale);
screen_height = (int)SDL_ceilf(SCREEN_HEIGHT * content_scale);
window = SDL_CreateWindow("SDL Controller Test", screen_width, screen_height, 0);
if (window == NULL) {
if (!window) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s\n", SDL_GetError());
return 2;
}
screen = SDL_CreateRenderer(window, NULL, 0);
if (screen == NULL) {
if (!screen) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError());
SDL_DestroyWindow(window);
return 2;
@@ -1923,7 +1923,7 @@ int main(int argc, char *argv[])
type_area.y = (float)TITLE_HEIGHT / 2 - type_area.h / 2;
image = CreateGamepadImage(screen);
if (image == NULL) {
if (!image) {
SDL_DestroyRenderer(screen);
SDL_DestroyWindow(window);
return 2;