Pointer as bool (libsdl-org#7214)

This commit is contained in:
Sylvain 2023-11-09 22:29:15 +01:00 committed by Sam Lantinga
parent 23db971681
commit d8600f717e
371 changed files with 2448 additions and 2442 deletions

View file

@ -66,7 +66,7 @@ static void VIRTUAL_FreeHWData(joystick_hwdata *hwdata)
SDL_AssertJoysticksLocked();
if (hwdata == NULL) {
if (!hwdata) {
return;
}
@ -114,7 +114,7 @@ SDL_JoystickID SDL_JoystickAttachVirtualInner(const SDL_VirtualJoystickDesc *des
SDL_AssertJoysticksLocked();
if (desc == NULL) {
if (!desc) {
return SDL_InvalidParamError("desc");
}
if (desc->version != SDL_VIRTUAL_JOYSTICK_DESC_VERSION) {
@ -123,7 +123,7 @@ SDL_JoystickID SDL_JoystickAttachVirtualInner(const SDL_VirtualJoystickDesc *des
}
hwdata = SDL_calloc(1, sizeof(joystick_hwdata));
if (hwdata == NULL) {
if (!hwdata) {
VIRTUAL_FreeHWData(hwdata);
return SDL_OutOfMemory();
}
@ -257,7 +257,7 @@ SDL_JoystickID SDL_JoystickAttachVirtualInner(const SDL_VirtualJoystickDesc *des
int SDL_JoystickDetachVirtualInner(SDL_JoystickID instance_id)
{
joystick_hwdata *hwdata = VIRTUAL_HWDataForInstance(instance_id);
if (hwdata == NULL) {
if (!hwdata) {
return SDL_SetError("Virtual joystick data not found");
}
VIRTUAL_FreeHWData(hwdata);
@ -271,7 +271,7 @@ int SDL_SetJoystickVirtualAxisInner(SDL_Joystick *joystick, int axis, Sint16 val
SDL_AssertJoysticksLocked();
if (joystick == NULL || !joystick->hwdata) {
if (!joystick || !joystick->hwdata) {
SDL_UnlockJoysticks();
return SDL_SetError("Invalid joystick");
}
@ -293,7 +293,7 @@ int SDL_SetJoystickVirtualButtonInner(SDL_Joystick *joystick, int button, Uint8
SDL_AssertJoysticksLocked();
if (joystick == NULL || !joystick->hwdata) {
if (!joystick || !joystick->hwdata) {
SDL_UnlockJoysticks();
return SDL_SetError("Invalid joystick");
}
@ -315,7 +315,7 @@ int SDL_SetJoystickVirtualHatInner(SDL_Joystick *joystick, int hat, Uint8 value)
SDL_AssertJoysticksLocked();
if (joystick == NULL || !joystick->hwdata) {
if (!joystick || !joystick->hwdata) {
SDL_UnlockJoysticks();
return SDL_SetError("Invalid joystick");
}
@ -356,7 +356,7 @@ static void VIRTUAL_JoystickDetect(void)
static const char *VIRTUAL_JoystickGetDeviceName(int device_index)
{
joystick_hwdata *hwdata = VIRTUAL_HWDataForIndex(device_index);
if (hwdata == NULL) {
if (!hwdata) {
return NULL;
}
return hwdata->name;
@ -384,7 +384,7 @@ static void VIRTUAL_JoystickSetDevicePlayerIndex(int device_index, int player_in
static SDL_JoystickGUID VIRTUAL_JoystickGetDeviceGUID(int device_index)
{
joystick_hwdata *hwdata = VIRTUAL_HWDataForIndex(device_index);
if (hwdata == NULL) {
if (!hwdata) {
SDL_JoystickGUID guid;
SDL_zero(guid);
return guid;
@ -395,7 +395,7 @@ static SDL_JoystickGUID VIRTUAL_JoystickGetDeviceGUID(int device_index)
static SDL_JoystickID VIRTUAL_JoystickGetDeviceInstanceID(int device_index)
{
joystick_hwdata *hwdata = VIRTUAL_HWDataForIndex(device_index);
if (hwdata == NULL) {
if (!hwdata) {
return 0;
}
return hwdata->instance_id;
@ -408,7 +408,7 @@ static int VIRTUAL_JoystickOpen(SDL_Joystick *joystick, int device_index)
SDL_AssertJoysticksLocked();
hwdata = VIRTUAL_HWDataForIndex(device_index);
if (hwdata == NULL) {
if (!hwdata) {
return SDL_SetError("No such device");
}
joystick->instance_id = hwdata->instance_id;
@ -535,7 +535,7 @@ static void VIRTUAL_JoystickUpdate(SDL_Joystick *joystick)
SDL_AssertJoysticksLocked();
if (joystick == NULL) {
if (!joystick) {
return;
}
if (!joystick->hwdata) {