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

@@ -40,7 +40,7 @@ static recDevice *gpDeviceList = NULL;
void FreeRumbleEffectData(FFEFFECT *effect)
{
if (effect == NULL) {
if (!effect) {
return;
}
SDL_free(effect->rgdwAxes);
@@ -56,7 +56,7 @@ FFEFFECT *CreateRumbleEffectData(Sint16 magnitude)
/* Create the effect */
effect = (FFEFFECT *)SDL_calloc(1, sizeof(*effect));
if (effect == NULL) {
if (!effect) {
return NULL;
}
effect->dwSize = sizeof(*effect);
@@ -80,7 +80,7 @@ FFEFFECT *CreateRumbleEffectData(Sint16 magnitude)
effect->dwFlags |= FFEFF_CARTESIAN;
periodic = (FFPERIODIC *)SDL_calloc(1, sizeof(*periodic));
if (periodic == NULL) {
if (!periodic) {
FreeRumbleEffectData(effect);
return NULL;
}
@@ -506,7 +506,7 @@ static SDL_bool JoystickAlreadyKnown(IOHIDDeviceRef ioHIDDeviceObject)
}
#endif
for (i = gpDeviceList; i != NULL; i = i->pNext) {
for (i = gpDeviceList; i; i = i->pNext) {
if (i->deviceRef == ioHIDDeviceObject) {
return SDL_TRUE;
}
@@ -528,7 +528,7 @@ static void JoystickDeviceWasAddedCallback(void *ctx, IOReturn res, void *sender
}
device = (recDevice *)SDL_calloc(1, sizeof(recDevice));
if (device == NULL) {
if (!device) {
SDL_OutOfMemory();
return;
}
@@ -561,13 +561,13 @@ static void JoystickDeviceWasAddedCallback(void *ctx, IOReturn res, void *sender
}
/* Add device to the end of the list */
if (gpDeviceList == NULL) {
if (!gpDeviceList) {
gpDeviceList = device;
} else {
recDevice *curdevice;
curdevice = gpDeviceList;
while (curdevice->pNext != NULL) {
while (curdevice->pNext) {
curdevice = curdevice->pNext;
}
curdevice->pNext = device;
@@ -851,7 +851,7 @@ static int DARWIN_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_ru
/* Scale and average the two rumble strengths */
Sint16 magnitude = (Sint16)(((low_frequency_rumble / 2) + (high_frequency_rumble / 2)) / 2);
if (device == NULL) {
if (!device) {
return SDL_SetError("Rumble failed, device disconnected");
}
@@ -892,7 +892,7 @@ static Uint32 DARWIN_JoystickGetCapabilities(SDL_Joystick *joystick)
recDevice *device = joystick->hwdata;
Uint32 result = 0;
if (device == NULL) {
if (!device) {
return 0;
}
@@ -926,7 +926,7 @@ static void DARWIN_JoystickUpdate(SDL_Joystick *joystick)
int i, goodRead = SDL_FALSE;
Uint64 timestamp = SDL_GetTicksNS();
if (device == NULL) {
if (!device) {
return;
}