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

@ -438,7 +438,7 @@ static SDL_bool WriteSubcommand(SDL_DriverSwitch_Context *ctx, ESwitchSubcommand
SwitchSubcommandInputPacket_t *reply = NULL;
int nTries;
for (nTries = 1; reply == NULL && nTries <= ctx->m_nMaxWriteAttempts; ++nTries) {
for (nTries = 1; !reply && nTries <= ctx->m_nMaxWriteAttempts; ++nTries) {
SwitchSubcommandOutputPacket_t commandPacket;
ConstructSubcommand(ctx, ucCommandID, pBuf, ucLen, &commandPacket);
@ -462,7 +462,7 @@ static SDL_bool WriteProprietary(SDL_DriverSwitch_Context *ctx, ESwitchProprieta
for (nTries = 1; nTries <= ctx->m_nMaxWriteAttempts; ++nTries) {
SwitchProprietaryOutputPacket_t packet;
if ((pBuf == NULL && ucLen > 0) || ucLen > sizeof(packet.rgucProprietaryData)) {
if ((!pBuf && ucLen > 0) || ucLen > sizeof(packet.rgucProprietaryData)) {
return SDL_FALSE;
}
@ -1272,7 +1272,7 @@ static SDL_bool HIDAPI_DriverSwitch_InitDevice(SDL_HIDAPI_Device *device)
SDL_DriverSwitch_Context *ctx;
ctx = (SDL_DriverSwitch_Context *)SDL_calloc(1, sizeof(*ctx));
if (ctx == NULL) {
if (!ctx) {
SDL_OutOfMemory();
return SDL_FALSE;
}
@ -2203,7 +2203,7 @@ static SDL_bool HIDAPI_DriverSwitch_UpdateDevice(SDL_HIDAPI_Device *device)
++packet_count;
ctx->m_ulLastInput = now;
if (joystick == NULL) {
if (!joystick) {
continue;
}