From cb6b8b0132cdabe1e6ab6f76854ddfe0074c02a0 Mon Sep 17 00:00:00 2001 From: Sylvain Becker Date: Fri, 3 Feb 2023 22:08:42 +0100 Subject: [PATCH] Simplify flags testing (#7220) --- src/SDL.c | 38 +++++----- src/audio/SDL_audiotypecvt.c | 80 ++++++++++----------- src/audio/directsound/SDL_directsound.c | 4 +- src/core/linux/SDL_evdev.c | 2 +- src/cpuinfo/SDL_cpuinfo.c | 2 +- src/events/SDL_keyboard.c | 6 +- src/events/SDL_mouse.c | 6 +- src/events/SDL_windowevents.c | 4 +- src/haptic/SDL_haptic.c | 10 +-- src/joystick/hidapi/SDL_hidapi_gamecube.c | 4 +- src/joystick/hidapi/SDL_hidapi_ps4.c | 16 ++--- src/joystick/hidapi/SDL_hidapi_ps5.c | 18 ++--- src/joystick/hidapi/SDL_hidapi_shield.c | 2 +- src/joystick/hidapi/SDL_hidapi_steam.c | 2 +- src/joystick/hidapi/SDL_hidapi_xboxone.c | 4 +- src/joystick/windows/SDL_dinputjoystick.c | 4 +- src/render/SDL_render.c | 4 +- src/render/direct3d/SDL_render_d3d.c | 4 +- src/render/direct3d11/SDL_render_d3d11.c | 2 +- src/render/direct3d12/SDL_render_d3d12.c | 2 +- src/stdlib/SDL_iconv.c | 2 +- src/test/SDL_test_common.c | 16 ++--- src/test/SDL_test_font.c | 2 +- src/thread/ngage/SDL_systhread.cpp | 2 +- src/video/SDL_blit_0.c | 28 ++++---- src/video/SDL_egl.c | 2 +- src/video/SDL_surface.c | 2 +- src/video/SDL_video.c | 32 ++++----- src/video/android/SDL_androidwindow.c | 2 +- src/video/cocoa/SDL_cocoakeyboard.m | 2 +- src/video/cocoa/SDL_cocoawindow.m | 10 +-- src/video/emscripten/SDL_emscriptenevents.c | 2 +- src/video/haiku/SDL_bwindow.cc | 2 +- src/video/riscos/SDL_riscosevents.c | 6 +- src/video/uikit/SDL_uikitview.m | 4 +- src/video/vita/SDL_vitavideo.c | 6 +- src/video/wayland/SDL_waylandvideo.c | 2 +- src/video/wayland/SDL_waylandwindow.c | 4 +- src/video/windows/SDL_windowsevents.c | 30 ++++---- src/video/windows/SDL_windowskeyboard.c | 6 +- src/video/windows/SDL_windowswindow.c | 16 ++--- src/video/x11/SDL_x11events.c | 14 ++-- src/video/x11/SDL_x11window.c | 22 +++--- test/gamepadmap.c | 4 +- test/testgamepad.c | 2 +- test/testime.c | 2 +- 46 files changed, 218 insertions(+), 218 deletions(-) diff --git a/src/SDL.c b/src/SDL.c index 48a4d1a43..9d1d9354a 100644 --- a/src/SDL.c +++ b/src/SDL.c @@ -175,18 +175,18 @@ int SDL_InitSubSystem(Uint32 flags) SDL_DBus_Init(); #endif - if ((flags & SDL_INIT_GAMEPAD)) { + if (flags & SDL_INIT_GAMEPAD) { /* game controller implies joystick */ flags |= SDL_INIT_JOYSTICK; } - if ((flags & (SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_AUDIO))) { + if (flags & (SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_AUDIO)) { /* video or joystick or audio implies events */ flags |= SDL_INIT_EVENTS; } #if SDL_VIDEO_DRIVER_WINDOWS - if ((flags & (SDL_INIT_HAPTIC | SDL_INIT_JOYSTICK))) { + if (flags & (SDL_INIT_HAPTIC | SDL_INIT_JOYSTICK)) { if (SDL_HelperWindowCreate() < 0) { goto quit_and_error; } @@ -198,7 +198,7 @@ int SDL_InitSubSystem(Uint32 flags) #endif /* Initialize the event subsystem */ - if ((flags & SDL_INIT_EVENTS)) { + if (flags & SDL_INIT_EVENTS) { #if !SDL_EVENTS_DISABLED if (SDL_ShouldInitSubsystem(SDL_INIT_EVENTS)) { SDL_IncrementSubsystemRefCount(SDL_INIT_EVENTS); @@ -217,7 +217,7 @@ int SDL_InitSubSystem(Uint32 flags) } /* Initialize the timer subsystem */ - if ((flags & SDL_INIT_TIMER)) { + if (flags & SDL_INIT_TIMER) { #if !SDL_TIMERS_DISABLED && !SDL_TIMER_DUMMY if (SDL_ShouldInitSubsystem(SDL_INIT_TIMER)) { SDL_IncrementSubsystemRefCount(SDL_INIT_TIMER); @@ -236,7 +236,7 @@ int SDL_InitSubSystem(Uint32 flags) } /* Initialize the video subsystem */ - if ((flags & SDL_INIT_VIDEO)) { + if (flags & SDL_INIT_VIDEO) { #if !SDL_VIDEO_DISABLED if (SDL_ShouldInitSubsystem(SDL_INIT_VIDEO)) { SDL_IncrementSubsystemRefCount(SDL_INIT_VIDEO); @@ -255,7 +255,7 @@ int SDL_InitSubSystem(Uint32 flags) } /* Initialize the audio subsystem */ - if ((flags & SDL_INIT_AUDIO)) { + if (flags & SDL_INIT_AUDIO) { #if !SDL_AUDIO_DISABLED if (SDL_ShouldInitSubsystem(SDL_INIT_AUDIO)) { SDL_IncrementSubsystemRefCount(SDL_INIT_AUDIO); @@ -274,7 +274,7 @@ int SDL_InitSubSystem(Uint32 flags) } /* Initialize the joystick subsystem */ - if ((flags & SDL_INIT_JOYSTICK)) { + if (flags & SDL_INIT_JOYSTICK) { #if !SDL_JOYSTICK_DISABLED if (SDL_ShouldInitSubsystem(SDL_INIT_JOYSTICK)) { SDL_IncrementSubsystemRefCount(SDL_INIT_JOYSTICK); @@ -292,7 +292,7 @@ int SDL_InitSubSystem(Uint32 flags) #endif } - if ((flags & SDL_INIT_GAMEPAD)) { + if (flags & SDL_INIT_GAMEPAD) { #if !SDL_JOYSTICK_DISABLED if (SDL_ShouldInitSubsystem(SDL_INIT_GAMEPAD)) { SDL_IncrementSubsystemRefCount(SDL_INIT_GAMEPAD); @@ -311,7 +311,7 @@ int SDL_InitSubSystem(Uint32 flags) } /* Initialize the haptic subsystem */ - if ((flags & SDL_INIT_HAPTIC)) { + if (flags & SDL_INIT_HAPTIC) { #if !SDL_HAPTIC_DISABLED if (SDL_ShouldInitSubsystem(SDL_INIT_HAPTIC)) { SDL_IncrementSubsystemRefCount(SDL_INIT_HAPTIC); @@ -330,7 +330,7 @@ int SDL_InitSubSystem(Uint32 flags) } /* Initialize the sensor subsystem */ - if ((flags & SDL_INIT_SENSOR)) { + if (flags & SDL_INIT_SENSOR) { #if !SDL_SENSOR_DISABLED if (SDL_ShouldInitSubsystem(SDL_INIT_SENSOR)) { SDL_IncrementSubsystemRefCount(SDL_INIT_SENSOR); @@ -366,7 +366,7 @@ void SDL_QuitSubSystem(Uint32 flags) { /* Shut down requested initialized subsystems */ #if !SDL_SENSOR_DISABLED - if ((flags & SDL_INIT_SENSOR)) { + if (flags & SDL_INIT_SENSOR) { if (SDL_ShouldQuitSubsystem(SDL_INIT_SENSOR)) { SDL_QuitSensors(); } @@ -375,7 +375,7 @@ void SDL_QuitSubSystem(Uint32 flags) #endif #if !SDL_JOYSTICK_DISABLED - if ((flags & SDL_INIT_GAMEPAD)) { + if (flags & SDL_INIT_GAMEPAD) { /* game controller implies joystick */ flags |= SDL_INIT_JOYSTICK; @@ -385,7 +385,7 @@ void SDL_QuitSubSystem(Uint32 flags) SDL_DecrementSubsystemRefCount(SDL_INIT_GAMEPAD); } - if ((flags & SDL_INIT_JOYSTICK)) { + if (flags & SDL_INIT_JOYSTICK) { /* joystick implies events */ flags |= SDL_INIT_EVENTS; @@ -397,7 +397,7 @@ void SDL_QuitSubSystem(Uint32 flags) #endif #if !SDL_HAPTIC_DISABLED - if ((flags & SDL_INIT_HAPTIC)) { + if (flags & SDL_INIT_HAPTIC) { if (SDL_ShouldQuitSubsystem(SDL_INIT_HAPTIC)) { SDL_QuitHaptics(); } @@ -406,7 +406,7 @@ void SDL_QuitSubSystem(Uint32 flags) #endif #if !SDL_AUDIO_DISABLED - if ((flags & SDL_INIT_AUDIO)) { + if (flags & SDL_INIT_AUDIO) { /* audio implies events */ flags |= SDL_INIT_EVENTS; @@ -418,7 +418,7 @@ void SDL_QuitSubSystem(Uint32 flags) #endif #if !SDL_VIDEO_DISABLED - if ((flags & SDL_INIT_VIDEO)) { + if (flags & SDL_INIT_VIDEO) { /* video implies events */ flags |= SDL_INIT_EVENTS; @@ -430,7 +430,7 @@ void SDL_QuitSubSystem(Uint32 flags) #endif #if !SDL_TIMERS_DISABLED && !SDL_TIMER_DUMMY - if ((flags & SDL_INIT_TIMER)) { + if (flags & SDL_INIT_TIMER) { if (SDL_ShouldQuitSubsystem(SDL_INIT_TIMER)) { SDL_QuitTimers(); } @@ -439,7 +439,7 @@ void SDL_QuitSubSystem(Uint32 flags) #endif #if !SDL_EVENTS_DISABLED - if ((flags & SDL_INIT_EVENTS)) { + if (flags & SDL_INIT_EVENTS) { if (SDL_ShouldQuitSubsystem(SDL_INIT_EVENTS)) { SDL_QuitEvents(); } diff --git a/src/audio/SDL_audiotypecvt.c b/src/audio/SDL_audiotypecvt.c index 25479cf13..a82243ab1 100644 --- a/src/audio/SDL_audiotypecvt.c +++ b/src/audio/SDL_audiotypecvt.c @@ -293,10 +293,10 @@ static void SDLCALL SDL_Convert_S8_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioForma src -= 15; dst -= 15; /* adjust to read SSE blocks from the start. */ - SDL_assert(!i || ((((size_t)dst) & 15) == 0)); + SDL_assert(!i || !(((size_t)dst) & 15)); /* Make sure src is aligned too. */ - if ((((size_t)src) & 15) == 0) { + if (!(((size_t)src) & 15)) { /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ const __m128i *mmsrc = (const __m128i *)src; const __m128i zero = _mm_setzero_si128(); @@ -357,10 +357,10 @@ static void SDLCALL SDL_Convert_U8_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioForma src -= 15; dst -= 15; /* adjust to read SSE blocks from the start. */ - SDL_assert(!i || ((((size_t)dst) & 15) == 0)); + SDL_assert(!i || !(((size_t)dst) & 15)); /* Make sure src is aligned too. */ - if ((((size_t)src) & 15) == 0) { + if (!(((size_t)src) & 15)) { /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ const __m128i *mmsrc = (const __m128i *)src; const __m128i zero = _mm_setzero_si128(); @@ -423,10 +423,10 @@ static void SDLCALL SDL_Convert_S16_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioForm src -= 7; dst -= 7; /* adjust to read SSE blocks from the start. */ - SDL_assert(!i || ((((size_t)dst) & 15) == 0)); + SDL_assert(!i || !(((size_t)dst) & 15)); /* Make sure src is aligned too. */ - if ((((size_t)src) & 15) == 0) { + if (!(((size_t)src) & 15)) { /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ const __m128 divby32768 = _mm_set1_ps(DIVBY32768); while (i >= 8) { /* 8 * 16-bit */ @@ -476,10 +476,10 @@ static void SDLCALL SDL_Convert_U16_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioForm src -= 7; dst -= 7; /* adjust to read SSE blocks from the start. */ - SDL_assert(!i || ((((size_t)dst) & 15) == 0)); + SDL_assert(!i || !(((size_t)dst) & 15)); /* Make sure src is aligned too. */ - if ((((size_t)src) & 15) == 0) { + if (!(((size_t)src) & 15)) { /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ const __m128 divby32768 = _mm_set1_ps(DIVBY32768); const __m128 minus1 = _mm_set1_ps(-1.0f); @@ -528,10 +528,10 @@ static void SDLCALL SDL_Convert_S32_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioForm *dst = ((float)(*src >> 8)) * DIVBY8388607; } - SDL_assert(!i || ((((size_t)dst) & 15) == 0)); + SDL_assert(!i || !(((size_t)dst) & 15)); /* Make sure src is aligned too. */ - if ((((size_t)src) & 15) == 0) { + if (!(((size_t)src) & 15)) { /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ const __m128 divby8388607 = _mm_set1_ps(DIVBY8388607); const __m128i *mmsrc = (const __m128i *)src; @@ -578,10 +578,10 @@ static void SDLCALL SDL_Convert_F32_to_S8_SSE2(SDL_AudioCVT *cvt, SDL_AudioForma } } - SDL_assert(!i || ((((size_t)dst) & 15) == 0)); + SDL_assert(!i || !(((size_t)dst) & 15)); /* Make sure src is aligned too. */ - if ((((size_t)src) & 15) == 0) { + if (!(((size_t)src) & 15)) { /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ const __m128 one = _mm_set1_ps(1.0f); const __m128 negone = _mm_set1_ps(-1.0f); @@ -641,10 +641,10 @@ static void SDLCALL SDL_Convert_F32_to_U8_SSE2(SDL_AudioCVT *cvt, SDL_AudioForma } } - SDL_assert(!i || ((((size_t)dst) & 15) == 0)); + SDL_assert(!i || !(((size_t)dst) & 15)); /* Make sure src is aligned too. */ - if ((((size_t)src) & 15) == 0) { + if (!(((size_t)src) & 15)) { /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ const __m128 one = _mm_set1_ps(1.0f); const __m128 negone = _mm_set1_ps(-1.0f); @@ -704,10 +704,10 @@ static void SDLCALL SDL_Convert_F32_to_S16_SSE2(SDL_AudioCVT *cvt, SDL_AudioForm } } - SDL_assert(!i || ((((size_t)dst) & 15) == 0)); + SDL_assert(!i || !(((size_t)dst) & 15)); /* Make sure src is aligned too. */ - if ((((size_t)src) & 15) == 0) { + if (!(((size_t)src) & 15)) { /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ const __m128 one = _mm_set1_ps(1.0f); const __m128 negone = _mm_set1_ps(-1.0f); @@ -765,10 +765,10 @@ static void SDLCALL SDL_Convert_F32_to_U16_SSE2(SDL_AudioCVT *cvt, SDL_AudioForm } } - SDL_assert(!i || ((((size_t)dst) & 15) == 0)); + SDL_assert(!i || !(((size_t)dst) & 15)); /* Make sure src is aligned too. */ - if ((((size_t)src) & 15) == 0) { + if (!(((size_t)src) & 15)) { /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ /* This calculates differently than the scalar path because SSE2 can't pack int32 data down to unsigned int16. _mm_packs_epi32 does signed @@ -834,8 +834,8 @@ static void SDLCALL SDL_Convert_F32_to_S32_SSE2(SDL_AudioCVT *cvt, SDL_AudioForm } } - SDL_assert(!i || ((((size_t)dst) & 15) == 0)); - SDL_assert(!i || ((((size_t)src) & 15) == 0)); + SDL_assert(!i || !(((size_t)dst) & 15)); + SDL_assert(!i || !(((size_t)src) & 15)); { /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ @@ -889,10 +889,10 @@ static void SDLCALL SDL_Convert_S8_to_F32_NEON(SDL_AudioCVT *cvt, SDL_AudioForma src -= 15; dst -= 15; /* adjust to read NEON blocks from the start. */ - SDL_assert(!i || ((((size_t)dst) & 15) == 0)); + SDL_assert(!i || !(((size_t)dst) & 15)); /* Make sure src is aligned too. */ - if ((((size_t)src) & 15) == 0) { + if (!(((size_t)src) & 15)) { /* Aligned! Do NEON blocks as long as we have 16 bytes available. */ const int8_t *mmsrc = (const int8_t *)src; const float32x4_t divby128 = vdupq_n_f32(DIVBY128); @@ -945,10 +945,10 @@ static void SDLCALL SDL_Convert_U8_to_F32_NEON(SDL_AudioCVT *cvt, SDL_AudioForma src -= 15; dst -= 15; /* adjust to read NEON blocks from the start. */ - SDL_assert(!i || ((((size_t)dst) & 15) == 0)); + SDL_assert(!i || !(((size_t)dst) & 15)); /* Make sure src is aligned too. */ - if ((((size_t)src) & 15) == 0) { + if (!(((size_t)src) & 15)) { /* Aligned! Do NEON blocks as long as we have 16 bytes available. */ const uint8_t *mmsrc = (const uint8_t *)src; const float32x4_t divby128 = vdupq_n_f32(DIVBY128); @@ -1002,10 +1002,10 @@ static void SDLCALL SDL_Convert_S16_to_F32_NEON(SDL_AudioCVT *cvt, SDL_AudioForm src -= 7; dst -= 7; /* adjust to read NEON blocks from the start. */ - SDL_assert(!i || ((((size_t)dst) & 15) == 0)); + SDL_assert(!i || !(((size_t)dst) & 15)); /* Make sure src is aligned too. */ - if ((((size_t)src) & 15) == 0) { + if (!(((size_t)src) & 15)) { /* Aligned! Do NEON blocks as long as we have 16 bytes available. */ const float32x4_t divby32768 = vdupq_n_f32(DIVBY32768); while (i >= 8) { /* 8 * 16-bit */ @@ -1051,10 +1051,10 @@ static void SDLCALL SDL_Convert_U16_to_F32_NEON(SDL_AudioCVT *cvt, SDL_AudioForm src -= 7; dst -= 7; /* adjust to read NEON blocks from the start. */ - SDL_assert(!i || ((((size_t)dst) & 15) == 0)); + SDL_assert(!i || !(((size_t)dst) & 15)); /* Make sure src is aligned too. */ - if ((((size_t)src) & 15) == 0) { + if (!(((size_t)src) & 15)) { /* Aligned! Do NEON blocks as long as we have 16 bytes available. */ const float32x4_t divby32768 = vdupq_n_f32(DIVBY32768); const float32x4_t negone = vdupq_n_f32(-1.0f); @@ -1099,10 +1099,10 @@ static void SDLCALL SDL_Convert_S32_to_F32_NEON(SDL_AudioCVT *cvt, SDL_AudioForm *dst = ((float)(*src >> 8)) * DIVBY8388607; } - SDL_assert(!i || ((((size_t)dst) & 15) == 0)); + SDL_assert(!i || !(((size_t)dst) & 15)); /* Make sure src is aligned too. */ - if ((((size_t)src) & 15) == 0) { + if (!(((size_t)src) & 15)) { /* Aligned! Do NEON blocks as long as we have 16 bytes available. */ const float32x4_t divby8388607 = vdupq_n_f32(DIVBY8388607); const int32_t *mmsrc = (const int32_t *)src; @@ -1149,10 +1149,10 @@ static void SDLCALL SDL_Convert_F32_to_S8_NEON(SDL_AudioCVT *cvt, SDL_AudioForma } } - SDL_assert(!i || ((((size_t)dst) & 15) == 0)); + SDL_assert(!i || !(((size_t)dst) & 15)); /* Make sure src is aligned too. */ - if ((((size_t)src) & 15) == 0) { + if (!(((size_t)src) & 15)) { /* Aligned! Do NEON blocks as long as we have 16 bytes available. */ const float32x4_t one = vdupq_n_f32(1.0f); const float32x4_t negone = vdupq_n_f32(-1.0f); @@ -1214,10 +1214,10 @@ static void SDLCALL SDL_Convert_F32_to_U8_NEON(SDL_AudioCVT *cvt, SDL_AudioForma } } - SDL_assert(!i || ((((size_t)dst) & 15) == 0)); + SDL_assert(!i || !(((size_t)dst) & 15)); /* Make sure src is aligned too. */ - if ((((size_t)src) & 15) == 0) { + if (!(((size_t)src) & 15)) { /* Aligned! Do NEON blocks as long as we have 16 bytes available. */ const float32x4_t one = vdupq_n_f32(1.0f); const float32x4_t negone = vdupq_n_f32(-1.0f); @@ -1280,10 +1280,10 @@ static void SDLCALL SDL_Convert_F32_to_S16_NEON(SDL_AudioCVT *cvt, SDL_AudioForm } } - SDL_assert(!i || ((((size_t)dst) & 15) == 0)); + SDL_assert(!i || !(((size_t)dst) & 15)); /* Make sure src is aligned too. */ - if ((((size_t)src) & 15) == 0) { + if (!(((size_t)src) & 15)) { /* Aligned! Do NEON blocks as long as we have 16 bytes available. */ const float32x4_t one = vdupq_n_f32(1.0f); const float32x4_t negone = vdupq_n_f32(-1.0f); @@ -1341,10 +1341,10 @@ static void SDLCALL SDL_Convert_F32_to_U16_NEON(SDL_AudioCVT *cvt, SDL_AudioForm } } - SDL_assert(!i || ((((size_t)dst) & 15) == 0)); + SDL_assert(!i || !(((size_t)dst) & 15)); /* Make sure src is aligned too. */ - if ((((size_t)src) & 15) == 0) { + if (!(((size_t)src) & 15)) { /* Aligned! Do NEON blocks as long as we have 16 bytes available. */ const float32x4_t one = vdupq_n_f32(1.0f); const float32x4_t negone = vdupq_n_f32(-1.0f); @@ -1402,8 +1402,8 @@ static void SDLCALL SDL_Convert_F32_to_S32_NEON(SDL_AudioCVT *cvt, SDL_AudioForm } } - SDL_assert(!i || ((((size_t)dst) & 15) == 0)); - SDL_assert(!i || ((((size_t)src) & 15) == 0)); + SDL_assert(!i || !(((size_t)dst) & 15)); + SDL_assert(!i || !(((size_t)src) & 15)); { /* Aligned! Do NEON blocks as long as we have 16 bytes available. */ diff --git a/src/audio/directsound/SDL_directsound.c b/src/audio/directsound/SDL_directsound.c index 6001795d7..65a467a04 100644 --- a/src/audio/directsound/SDL_directsound.c +++ b/src/audio/directsound/SDL_directsound.c @@ -226,10 +226,10 @@ static void DSOUND_WaitDevice(_THIS) /* Try to restore a lost sound buffer */ IDirectSoundBuffer_GetStatus(this->hidden->mixbuf, &status); - if ((status & DSBSTATUS_BUFFERLOST)) { + if (status & DSBSTATUS_BUFFERLOST) { IDirectSoundBuffer_Restore(this->hidden->mixbuf); IDirectSoundBuffer_GetStatus(this->hidden->mixbuf, &status); - if ((status & DSBSTATUS_BUFFERLOST)) { + if (status & DSBSTATUS_BUFFERLOST) { break; } } diff --git a/src/core/linux/SDL_evdev.c b/src/core/linux/SDL_evdev.c index 24f744226..8fe643eb6 100644 --- a/src/core/linux/SDL_evdev.c +++ b/src/core/linux/SDL_evdev.c @@ -251,7 +251,7 @@ static void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_event, int udev_cl return; } - if ((udev_class & SDL_UDEV_DEVICE_JOYSTICK)) { + if (udev_class & SDL_UDEV_DEVICE_JOYSTICK) { return; } diff --git a/src/cpuinfo/SDL_cpuinfo.c b/src/cpuinfo/SDL_cpuinfo.c index e66be970a..942c3265f 100644 --- a/src/cpuinfo/SDL_cpuinfo.c +++ b/src/cpuinfo/SDL_cpuinfo.c @@ -476,7 +476,7 @@ static int CPU_haveNEON(void) AndroidCpuFamily cpu_family = android_getCpuFamily(); if (cpu_family == ANDROID_CPU_FAMILY_ARM) { uint64_t cpu_features = android_getCpuFeatures(); - if ((cpu_features & ANDROID_CPU_ARM_FEATURE_NEON) != 0) { + if (cpu_features & ANDROID_CPU_ARM_FEATURE_NEON) { return 1; } } diff --git a/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c index 8081e7001..32b8d3b49 100644 --- a/src/events/SDL_keyboard.c +++ b/src/events/SDL_keyboard.c @@ -930,8 +930,8 @@ static int SDL_SendKeyboardKeyInternal(Uint64 timestamp, SDL_KeyboardFlags flags state == SDL_PRESSED && (keyboard->modstate & SDL_KMOD_ALT) && keyboard->focus && - (keyboard->focus->flags & SDL_WINDOW_KEYBOARD_GRABBED) != 0 && - (keyboard->focus->flags & SDL_WINDOW_FULLSCREEN) != 0 && + (keyboard->focus->flags & SDL_WINDOW_KEYBOARD_GRABBED) && + (keyboard->focus->flags & SDL_WINDOW_FULLSCREEN) && SDL_GetHintBoolean(SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED, SDL_TRUE)) { /* We will temporarily forfeit our grab by minimizing our window, allowing the user to escape the application */ @@ -1009,7 +1009,7 @@ SDL_HardwareKeyboardKeyPressed(void) SDL_Scancode scancode; for (scancode = SDL_SCANCODE_UNKNOWN; scancode < SDL_NUM_SCANCODES; ++scancode) { - if ((keyboard->keysource[scancode] & KEYBOARD_HARDWARE) != 0) { + if (keyboard->keysource[scancode] & KEYBOARD_HARDWARE) { return SDL_TRUE; } } diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index d0418f847..fb8deb89e 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -310,7 +310,7 @@ static SDL_bool SDL_UpdateMouseFocus(SDL_Window *window, float x, float y, Uint3 SDL_Mouse *mouse = SDL_GetMouse(); SDL_bool inWindow = SDL_TRUE; - if (window && ((window->flags & SDL_WINDOW_MOUSE_CAPTURE) == 0)) { + if (window && !(window->flags & SDL_WINDOW_MOUSE_CAPTURE)) { if (x < 0.0f || y < 0.0f || x >= (float)window->w || y >= (float)window->h) { inWindow = SDL_FALSE; } @@ -482,7 +482,7 @@ static int SDL_PrivateSendMouseMotion(Uint64 timestamp, SDL_Window *window, SDL_ return 0; } } else { - if (window && (window->flags & SDL_WINDOW_INPUT_FOCUS) != 0) { + if (window && (window->flags & SDL_WINDOW_INPUT_FOCUS)) { if (mouse->WarpMouse) { mouse->WarpMouse(window, center_x, center_y); } else { @@ -532,7 +532,7 @@ static int SDL_PrivateSendMouseMotion(Uint64 timestamp, SDL_Window *window, SDL_ /* make sure that the pointers find themselves inside the windows, unless we have the mouse captured. */ - if (window && ((window->flags & SDL_WINDOW_MOUSE_CAPTURE) == 0)) { + if (window && !(window->flags & SDL_WINDOW_MOUSE_CAPTURE)) { int x_min = 0, x_max = window->w - 1; int y_min = 0, y_max = window->h - 1; const SDL_Rect *confine = SDL_GetWindowMouseRect(window); diff --git a/src/events/SDL_windowevents.c b/src/events/SDL_windowevents.c index 5deba6fd9..befe1ff97 100644 --- a/src/events/SDL_windowevents.c +++ b/src/events/SDL_windowevents.c @@ -67,7 +67,7 @@ int SDL_SendWindowEvent(SDL_Window *window, SDL_EventType windowevent, SDL_WINDOWPOS_ISUNDEFINED(data2)) { return 0; } - if ((window->flags & SDL_WINDOW_FULLSCREEN) == 0) { + if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { window->windowed.x = data1; window->windowed.y = data2; } @@ -78,7 +78,7 @@ int SDL_SendWindowEvent(SDL_Window *window, SDL_EventType windowevent, window->y = data2; break; case SDL_EVENT_WINDOW_RESIZED: - if ((window->flags & SDL_WINDOW_FULLSCREEN) == 0) { + if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { window->windowed.w = data1; window->windowed.h = data2; } diff --git a/src/haptic/SDL_haptic.c b/src/haptic/SDL_haptic.c index 98a186379..e3310c7d2 100644 --- a/src/haptic/SDL_haptic.c +++ b/src/haptic/SDL_haptic.c @@ -585,7 +585,7 @@ int SDL_HapticGetEffectStatus(SDL_Haptic *haptic, int effect) return -1; } - if ((haptic->supported & SDL_HAPTIC_STATUS) == 0) { + if (!(haptic->supported & SDL_HAPTIC_STATUS)) { return SDL_SetError("Haptic: Device does not support status queries."); } @@ -604,7 +604,7 @@ int SDL_HapticSetGain(SDL_Haptic *haptic, int gain) return -1; } - if ((haptic->supported & SDL_HAPTIC_GAIN) == 0) { + if (!(haptic->supported & SDL_HAPTIC_GAIN)) { return SDL_SetError("Haptic: Device does not support setting gain."); } @@ -646,7 +646,7 @@ int SDL_HapticSetAutocenter(SDL_Haptic *haptic, int autocenter) return -1; } - if ((haptic->supported & SDL_HAPTIC_AUTOCENTER) == 0) { + if (!(haptic->supported & SDL_HAPTIC_AUTOCENTER)) { return SDL_SetError("Haptic: Device does not support setting autocenter."); } @@ -670,7 +670,7 @@ int SDL_HapticPause(SDL_Haptic *haptic) return -1; } - if ((haptic->supported & SDL_HAPTIC_PAUSE) == 0) { + if (!(haptic->supported & SDL_HAPTIC_PAUSE)) { return SDL_SetError("Haptic: Device does not support setting pausing."); } @@ -686,7 +686,7 @@ int SDL_HapticUnpause(SDL_Haptic *haptic) return -1; } - if ((haptic->supported & SDL_HAPTIC_PAUSE) == 0) { + if (!(haptic->supported & SDL_HAPTIC_PAUSE)) { return 0; /* Not going to be paused, so we pretend it's unpaused. */ } diff --git a/src/joystick/hidapi/SDL_hidapi_gamecube.c b/src/joystick/hidapi/SDL_hidapi_gamecube.c index bbddf923d..c108e5cc0 100644 --- a/src/joystick/hidapi/SDL_hidapi_gamecube.c +++ b/src/joystick/hidapi/SDL_hidapi_gamecube.c @@ -183,7 +183,7 @@ static SDL_bool HIDAPI_DriverGameCube_InitDevice(SDL_HIDAPI_Device *device) ctx->wireless[i] = (curSlot[0] & 0x20) != 0; /* Only allow rumble if the adapter's second USB cable is connected */ - ctx->rumbleAllowed[i] = (curSlot[0] & 0x04) != 0 && !ctx->wireless[i]; + ctx->rumbleAllowed[i] = (curSlot[0] & 0x04) && !ctx->wireless[i]; if (curSlot[0] & 0x30) { /* 0x10 - Wired, 0x20 - Wireless */ if (ctx->joysticks[i] == 0) { @@ -312,7 +312,7 @@ static void HIDAPI_DriverGameCube_HandleNintendoPacket(SDL_HIDAPI_Device *device ctx->wireless[i] = (curSlot[0] & 0x20) != 0; /* Only allow rumble if the adapter's second USB cable is connected */ - ctx->rumbleAllowed[i] = (curSlot[0] & 0x04) != 0 && !ctx->wireless[i]; + ctx->rumbleAllowed[i] = (curSlot[0] & 0x04) && !ctx->wireless[i]; if (curSlot[0] & 0x30) { /* 0x10 - Wired, 0x20 - Wireless */ if (ctx->joysticks[i] == 0) { diff --git a/src/joystick/hidapi/SDL_hidapi_ps4.c b/src/joystick/hidapi/SDL_hidapi_ps4.c index 0b4b3da6b..5dba5a52f 100644 --- a/src/joystick/hidapi/SDL_hidapi_ps4.c +++ b/src/joystick/hidapi/SDL_hidapi_ps4.c @@ -317,16 +317,16 @@ static SDL_bool HIDAPI_DriverPS4_InitDevice(SDL_HIDAPI_Device *device) #ifdef DEBUG_PS4_PROTOCOL HIDAPI_DumpPacket("PS4 capabilities: size = %d", data, size); #endif - if ((capabilities & 0x02) != 0) { + if (capabilities & 0x02) { ctx->sensors_supported = SDL_TRUE; } - if ((capabilities & 0x04) != 0) { + if (capabilities & 0x04) { ctx->lightbar_supported = SDL_TRUE; } - if ((capabilities & 0x08) != 0) { + if (capabilities & 0x08) { ctx->vibration_supported = SDL_TRUE; } - if ((capabilities & 0x40) != 0) { + if (capabilities & 0x40) { ctx->touchpad_supported = SDL_TRUE; } @@ -895,7 +895,7 @@ static void HIDAPI_DriverPS4_HandleStatePacket(SDL_Joystick *joystick, SDL_hid_d /* Some fightsticks, ex: Victrix FS Pro will only this these digital trigger bits and not the analog values so this needs to run whenever the trigger is evaluated */ - if ((packet->rgucButtonsHatAndCounter[1] & 0x0C) != 0) { + if (packet->rgucButtonsHatAndCounter[1] & 0x0C) { Uint8 data = packet->rgucButtonsHatAndCounter[1]; packet->ucTriggerLeft = (data & 0x04) && packet->ucTriggerLeft == 0 ? 255 : packet->ucTriggerLeft; packet->ucTriggerRight = (data & 0x08) && packet->ucTriggerRight == 0 ? 255 : packet->ucTriggerRight; @@ -940,12 +940,12 @@ static void HIDAPI_DriverPS4_HandleStatePacket(SDL_Joystick *joystick, SDL_hid_d } if (ctx->report_touchpad) { - touchpad_state = ((packet->ucTouchpadCounter1 & 0x80) == 0) ? SDL_PRESSED : SDL_RELEASED; + touchpad_state = !(packet->ucTouchpadCounter1 & 0x80) ? SDL_PRESSED : SDL_RELEASED; touchpad_x = packet->rgucTouchpadData1[0] | (((int)packet->rgucTouchpadData1[1] & 0x0F) << 8); touchpad_y = (packet->rgucTouchpadData1[1] >> 4) | ((int)packet->rgucTouchpadData1[2] << 4); SDL_SendJoystickTouchpad(timestamp, joystick, 0, 0, touchpad_state, touchpad_x * TOUCHPAD_SCALEX, touchpad_y * TOUCHPAD_SCALEY, touchpad_state ? 1.0f : 0.0f); - touchpad_state = ((packet->ucTouchpadCounter2 & 0x80) == 0) ? SDL_PRESSED : SDL_RELEASED; + touchpad_state = !(packet->ucTouchpadCounter2 & 0x80) ? SDL_PRESSED : SDL_RELEASED; touchpad_x = packet->rgucTouchpadData2[0] | (((int)packet->rgucTouchpadData2[1] & 0x0F) << 8); touchpad_y = (packet->rgucTouchpadData2[1] >> 4) | ((int)packet->rgucTouchpadData2[2] << 4); SDL_SendJoystickTouchpad(timestamp, joystick, 0, 1, touchpad_state, touchpad_x * TOUCHPAD_SCALEX, touchpad_y * TOUCHPAD_SCALEY, touchpad_state ? 1.0f : 0.0f); @@ -1007,7 +1007,7 @@ static SDL_bool HIDAPI_DriverPS4_IsPacketValid(SDL_DriverPS4_Context *ctx, Uint8 * This is usually the ID over USB, but the DS4v2 that started shipping with the PS4 Slim will also send this * packet over BT with a size of 128 */ - if (size >= 64 && (data[31] & 0x04) == 0) { + if (size >= 64 && !(data[31] & 0x04)) { return SDL_TRUE; } break; diff --git a/src/joystick/hidapi/SDL_hidapi_ps5.c b/src/joystick/hidapi/SDL_hidapi_ps5.c index c30e72da9..a8485e6e7 100644 --- a/src/joystick/hidapi/SDL_hidapi_ps5.c +++ b/src/joystick/hidapi/SDL_hidapi_ps5.c @@ -433,19 +433,19 @@ static SDL_bool HIDAPI_DriverPS5_InitDevice(SDL_HIDAPI_Device *device) #ifdef DEBUG_PS5_PROTOCOL HIDAPI_DumpPacket("PS5 capabilities: size = %d", data, size); #endif - if ((capabilities & 0x02) != 0) { + if (capabilities & 0x02) { ctx->sensors_supported = SDL_TRUE; } - if ((capabilities & 0x04) != 0) { + if (capabilities & 0x04) { ctx->lightbar_supported = SDL_TRUE; } - if ((capabilities & 0x08) != 0) { + if (capabilities & 0x08) { ctx->vibration_supported = SDL_TRUE; } - if ((capabilities & 0x40) != 0) { + if (capabilities & 0x40) { ctx->touchpad_supported = SDL_TRUE; } - if ((capabilities2 & 0x80) != 0) { + if (capabilities2 & 0x80) { ctx->playerled_supported = SDL_TRUE; } @@ -1232,12 +1232,12 @@ static void HIDAPI_DriverPS5_HandleStatePacket(SDL_Joystick *joystick, SDL_hid_d Uint64 timestamp = SDL_GetTicksNS(); if (ctx->report_touchpad) { - touchpad_state = ((packet->ucTouchpadCounter1 & 0x80) == 0) ? SDL_PRESSED : SDL_RELEASED; + touchpad_state = !(packet->ucTouchpadCounter1 & 0x80) ? SDL_PRESSED : SDL_RELEASED; touchpad_x = packet->rgucTouchpadData1[0] | (((int)packet->rgucTouchpadData1[1] & 0x0F) << 8); touchpad_y = (packet->rgucTouchpadData1[1] >> 4) | ((int)packet->rgucTouchpadData1[2] << 4); SDL_SendJoystickTouchpad(timestamp, joystick, 0, 0, touchpad_state, touchpad_x * TOUCHPAD_SCALEX, touchpad_y * TOUCHPAD_SCALEY, touchpad_state ? 1.0f : 0.0f); - touchpad_state = ((packet->ucTouchpadCounter2 & 0x80) == 0) ? SDL_PRESSED : SDL_RELEASED; + touchpad_state = !(packet->ucTouchpadCounter2 & 0x80) ? SDL_PRESSED : SDL_RELEASED; touchpad_x = packet->rgucTouchpadData2[0] | (((int)packet->rgucTouchpadData2[1] & 0x0F) << 8); touchpad_y = (packet->rgucTouchpadData2[1] >> 4) | ((int)packet->rgucTouchpadData2[2] << 4); SDL_SendJoystickTouchpad(timestamp, joystick, 0, 1, touchpad_state, touchpad_x * TOUCHPAD_SCALEX, touchpad_y * TOUCHPAD_SCALEY, touchpad_state ? 1.0f : 0.0f); @@ -1275,12 +1275,12 @@ static void HIDAPI_DriverPS5_HandleStatePacketAlt(SDL_Joystick *joystick, SDL_hi Uint64 timestamp = SDL_GetTicksNS(); if (ctx->report_touchpad) { - touchpad_state = ((packet->ucTouchpadCounter1 & 0x80) == 0) ? SDL_PRESSED : SDL_RELEASED; + touchpad_state = !(packet->ucTouchpadCounter1 & 0x80) ? SDL_PRESSED : SDL_RELEASED; touchpad_x = packet->rgucTouchpadData1[0] | (((int)packet->rgucTouchpadData1[1] & 0x0F) << 8); touchpad_y = (packet->rgucTouchpadData1[1] >> 4) | ((int)packet->rgucTouchpadData1[2] << 4); SDL_SendJoystickTouchpad(timestamp, joystick, 0, 0, touchpad_state, touchpad_x * TOUCHPAD_SCALEX, touchpad_y * TOUCHPAD_SCALEY, touchpad_state ? 1.0f : 0.0f); - touchpad_state = ((packet->ucTouchpadCounter2 & 0x80) == 0) ? SDL_PRESSED : SDL_RELEASED; + touchpad_state = !(packet->ucTouchpadCounter2 & 0x80) ? SDL_PRESSED : SDL_RELEASED; touchpad_x = packet->rgucTouchpadData2[0] | (((int)packet->rgucTouchpadData2[1] & 0x0F) << 8); touchpad_y = (packet->rgucTouchpadData2[1] >> 4) | ((int)packet->rgucTouchpadData2[2] << 4); SDL_SendJoystickTouchpad(timestamp, joystick, 0, 1, touchpad_state, touchpad_x * TOUCHPAD_SCALEX, touchpad_y * TOUCHPAD_SCALEY, touchpad_state ? 1.0f : 0.0f); diff --git a/src/joystick/hidapi/SDL_hidapi_shield.c b/src/joystick/hidapi/SDL_hidapi_shield.c index 7a2160b0b..633061e7f 100644 --- a/src/joystick/hidapi/SDL_hidapi_shield.c +++ b/src/joystick/hidapi/SDL_hidapi_shield.c @@ -377,7 +377,7 @@ static void HIDAPI_DriverShield_HandleTouchPacketV103(SDL_Joystick *joystick, SD SDL_SendJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_SHIELD_V103_TOUCHPAD, (data[1] & 0x01) ? SDL_PRESSED : SDL_RELEASED); /* It's a triangular pad, but just use the center as the usable touch area */ - touchpad_state = ((data[1] & 0x80) == 0) ? SDL_PRESSED : SDL_RELEASED; + touchpad_state = !(data[1] & 0x80) ? SDL_PRESSED : SDL_RELEASED; touchpad_x = clamp((float)(data[2] - 0x70) / 0x50, 0.0f, 1.0f); touchpad_y = clamp((float)(data[4] - 0x40) / 0x15, 0.0f, 1.0f); SDL_SendJoystickTouchpad(timestamp, joystick, 0, 0, touchpad_state, touchpad_x, touchpad_y, touchpad_state ? 1.0f : 0.0f); diff --git a/src/joystick/hidapi/SDL_hidapi_steam.c b/src/joystick/hidapi/SDL_hidapi_steam.c index 5e18c2bc0..006cb7412 100644 --- a/src/joystick/hidapi/SDL_hidapi_steam.c +++ b/src/joystick/hidapi/SDL_hidapi_steam.c @@ -248,7 +248,7 @@ static int WriteSegmentToSteamControllerPacketAssembler(SteamControllerPacketAss DPRINTF("GOT PACKET HEADER = 0x%x\n", uSegmentHeader); - if ((uSegmentHeader & REPORT_SEGMENT_DATA_FLAG) == 0) { + if (!(uSegmentHeader & REPORT_SEGMENT_DATA_FLAG)) { // We get empty segments, just ignore them return 0; } diff --git a/src/joystick/hidapi/SDL_hidapi_xboxone.c b/src/joystick/hidapi/SDL_hidapi_xboxone.c index 36dcac4ec..8d6c5fdfe 100644 --- a/src/joystick/hidapi/SDL_hidapi_xboxone.c +++ b/src/joystick/hidapi/SDL_hidapi_xboxone.c @@ -791,13 +791,13 @@ static void HIDAPI_DriverXboxOne_HandleStatePacket(SDL_Joystick *joystick, SDL_D if (axis == 32704) { axis = 32767; } - if (axis == -32768 && size == 30 && (data[22] & 0x80) != 0) { + if (axis == -32768 && size == 30 && (data[22] & 0x80)) { axis = 32767; } SDL_SendJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFT_TRIGGER, axis); axis = ((int)SDL_SwapLE16(*(Sint16 *)(&data[8])) * 64) - 32768; - if (axis == -32768 && size == 30 && (data[22] & 0x40) != 0) { + if (axis == -32768 && size == 30 && (data[22] & 0x40)) { axis = 32767; } if (axis == 32704) { diff --git a/src/joystick/windows/SDL_dinputjoystick.c b/src/joystick/windows/SDL_dinputjoystick.c index dfd578486..69c83bce9 100644 --- a/src/joystick/windows/SDL_dinputjoystick.c +++ b/src/joystick/windows/SDL_dinputjoystick.c @@ -453,7 +453,7 @@ static BOOL CALLBACK EnumJoystickDetectCallback(LPCDIDEVICEINSTANCE pDeviceInsta LPDIRECTINPUTDEVICE8 device = NULL; /* We are only supporting HID devices. */ - CHECK((pDeviceInstance->dwDevType & DIDEVTYPE_HID) != 0); + CHECK(pDeviceInstance->dwDevType & DIDEVTYPE_HID); CHECK(SUCCEEDED(IDirectInput8_CreateDevice(dinput, &pDeviceInstance->guidInstance, &device, NULL))); CHECK(QueryDeviceName(device, &name)); @@ -564,7 +564,7 @@ static BOOL CALLBACK EnumJoystickPresentCallback(LPCDIDEVICEINSTANCE pDeviceInst BOOL result = DIENUM_CONTINUE; /* We are only supporting HID devices. */ - CHECK((pDeviceInstance->dwDevType & DIDEVTYPE_HID) != 0); + CHECK(pDeviceInstance->dwDevType & DIDEVTYPE_HID); CHECK(SUCCEEDED(IDirectInput8_CreateDevice(dinput, &pDeviceInstance->guidInstance, &device, NULL))); CHECK(QueryDeviceInfo(device, &vendor, &product)); diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index 04c3e4200..7b75532d7 100755 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -868,10 +868,10 @@ SDL_Renderer *SDL_CreateRenderer(SDL_Window *window, const char *name, Uint32 fl goto error; } - if ((flags & SDL_RENDERER_PRESENTVSYNC) != 0) { + if (flags & SDL_RENDERER_PRESENTVSYNC) { renderer->wanted_vsync = SDL_TRUE; - if ((renderer->info.flags & SDL_RENDERER_PRESENTVSYNC) == 0) { + if (!(renderer->info.flags & SDL_RENDERER_PRESENTVSYNC)) { renderer->simulate_vsync = SDL_TRUE; renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; } diff --git a/src/render/direct3d/SDL_render_d3d.c b/src/render/direct3d/SDL_render_d3d.c index 7e7674848..6b22ee2d0 100644 --- a/src/render/direct3d/SDL_render_d3d.c +++ b/src/render/direct3d/SDL_render_d3d.c @@ -294,7 +294,7 @@ static int D3D_ActivateRenderer(SDL_Renderer *renderer) SDL_GetWindowSizeInPixels(window, &w, &h); data->pparams.BackBufferWidth = w; data->pparams.BackBufferHeight = h; - if ((SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN) != 0) { + if (SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN) { fullscreen_mode = SDL_GetWindowFullscreenMode(window); } if (fullscreen_mode) { @@ -1606,7 +1606,7 @@ D3D_CreateRenderer(SDL_Window *window, Uint32 flags) renderer->driverdata = data; SDL_GetWindowSizeInPixels(window, &w, &h); - if ((SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN) != 0) { + if (SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN) { fullscreen_mode = SDL_GetWindowFullscreenMode(window); } diff --git a/src/render/direct3d11/SDL_render_d3d11.c b/src/render/direct3d11/SDL_render_d3d11.c index fe77cfa94..0c1e49cdc 100644 --- a/src/render/direct3d11/SDL_render_d3d11.c +++ b/src/render/direct3d11/SDL_render_d3d11.c @@ -2355,7 +2355,7 @@ D3D11_CreateRenderer(SDL_Window *window, Uint32 flags) */ renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; #else - if ((flags & SDL_RENDERER_PRESENTVSYNC)) { + if (flags & SDL_RENDERER_PRESENTVSYNC) { renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; } renderer->SetVSync = D3D11_SetVSync; diff --git a/src/render/direct3d12/SDL_render_d3d12.c b/src/render/direct3d12/SDL_render_d3d12.c index 03df5a81e..b868f87ef 100644 --- a/src/render/direct3d12/SDL_render_d3d12.c +++ b/src/render/direct3d12/SDL_render_d3d12.c @@ -2991,7 +2991,7 @@ D3D12_CreateRenderer(SDL_Window *window, Uint32 flags) renderer->info.flags = SDL_RENDERER_ACCELERATED; renderer->driverdata = data; - if ((flags & SDL_RENDERER_PRESENTVSYNC)) { + if (flags & SDL_RENDERER_PRESENTVSYNC) { renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; } renderer->SetVSync = D3D12_SetVSync; diff --git a/src/stdlib/SDL_iconv.c b/src/stdlib/SDL_iconv.c index e75d74123..b22994659 100644 --- a/src/stdlib/SDL_iconv.c +++ b/src/stdlib/SDL_iconv.c @@ -387,7 +387,7 @@ SDL_iconv(SDL_iconv_t cd, left = 1; } } else { - if ((p[0] & 0x80) != 0x00) { + if (p[0] & 0x80) { /* Skip illegal sequences return SDL_ICONV_EILSEQ; */ diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c index e543bdb84..f7f0c6f9f 100644 --- a/src/test/SDL_test_common.c +++ b/src/test/SDL_test_common.c @@ -254,7 +254,7 @@ int SDLTest_CommonArg(SDLTest_CommonState *state, int index) if (!argv[index] || !SDL_isdigit((unsigned char)*argv[index])) { return -1; } - if ((state->window_flags & SDL_WINDOW_FULLSCREEN) == 0) { + if (!(state->window_flags & SDL_WINDOW_FULLSCREEN)) { state->num_windows = SDL_atoi(argv[index]); } return 2; @@ -1359,7 +1359,7 @@ SDLTest_CommonInit(SDLTest_CommonState *state) state->window_w = w; state->window_h = h; } - if ((state->window_flags & SDL_WINDOW_FULLSCREEN) != 0) { + if (state->window_flags & SDL_WINDOW_FULLSCREEN) { if (state->fullscreen_exclusive) { SDL_SetWindowFullscreenMode(state->windows[i], &state->fullscreen_mode); } @@ -1835,7 +1835,7 @@ static void FullscreenTo(SDLTest_CommonState *state, int index, int windowId) SDL_GetDisplayBounds(displays[index], &rect); flags = SDL_GetWindowFlags(window); - if ((flags & SDL_WINDOW_FULLSCREEN) != 0) { + if (flags & SDL_WINDOW_FULLSCREEN) { SDL_SetWindowFullscreen(window, SDL_FALSE); SDL_Delay(15); } @@ -1870,7 +1870,7 @@ void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done if (state->verbose & VERBOSE_EVENT) { if (((event->type != SDL_EVENT_MOUSE_MOTION) && (event->type != SDL_EVENT_FINGER_MOTION)) || - ((state->verbose & VERBOSE_MOTION) != 0)) { + (state->verbose & VERBOSE_MOTION)) { SDLTest_PrintEvent(event); } } @@ -2055,7 +2055,7 @@ void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done if (withShift) { SDL_Window *current_win = SDL_GetKeyboardFocus(); if (current_win) { - const SDL_bool shouldCapture = (SDL_GetWindowFlags(current_win) & SDL_WINDOW_MOUSE_CAPTURE) == 0; + const SDL_bool shouldCapture = !(SDL_GetWindowFlags(current_win) & SDL_WINDOW_MOUSE_CAPTURE); const int rc = SDL_CaptureMouse(shouldCapture); SDL_Log("%sapturing mouse %s!\n", shouldCapture ? "C" : "Unc", (rc == 0) ? "succeeded" : "failed"); } @@ -2149,7 +2149,7 @@ void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); if (window) { Uint32 flags = SDL_GetWindowFlags(window); - if ((flags & SDL_WINDOW_FULLSCREEN) != 0) { + if (flags & SDL_WINDOW_FULLSCREEN) { SDL_SetWindowFullscreen(window, SDL_FALSE); } else { SDL_SetWindowFullscreen(window, SDL_TRUE); @@ -2160,7 +2160,7 @@ void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); if (window) { Uint32 flags = SDL_GetWindowFlags(window); - if ((flags & SDL_WINDOW_FULLSCREEN) != 0) { + if (flags & SDL_WINDOW_FULLSCREEN) { SDL_SetWindowFullscreen(window, SDL_FALSE); } else { SDL_SetWindowFullscreenMode(window, NULL); @@ -2187,7 +2187,7 @@ void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); if (window) { const Uint32 flags = SDL_GetWindowFlags(window); - const SDL_bool b = ((flags & SDL_WINDOW_BORDERLESS) != 0) ? SDL_TRUE : SDL_FALSE; + const SDL_bool b = (flags & SDL_WINDOW_BORDERLESS) ? SDL_TRUE : SDL_FALSE; SDL_SetWindowBordered(window, b); } } diff --git a/src/test/SDL_test_font.c b/src/test/SDL_test_font.c index 1b1296657..9dfbad359 100644 --- a/src/test/SDL_test_font.c +++ b/src/test/SDL_test_font.c @@ -3295,7 +3295,7 @@ static Uint32 UTF8_getch(const char *src, size_t srclen, int *inc) left = 1; } } else { - if ((p[0] & 0x80) == 0x00) { + if (!(p[0] & 0x80)) { ch = (Uint32)p[0]; } } diff --git a/src/thread/ngage/SDL_systhread.cpp b/src/thread/ngage/SDL_systhread.cpp index 65048e0ae..4f795a37e 100644 --- a/src/thread/ngage/SDL_systhread.cpp +++ b/src/thread/ngage/SDL_systhread.cpp @@ -63,7 +63,7 @@ int SDL_SYS_CreateThread(SDL_Thread *thread) TInt status = CreateUnique(NewThread, &rthread, thread); if (status != KErrNone) { - delete (((RThread *)(thread->handle))); + delete (RThread *)thread->handle; thread->handle = NULL; return SDL_SetError("Not enough resources to create thread"); } diff --git a/src/video/SDL_blit_0.c b/src/video/SDL_blit_0.c index bc164ea09..9851737bd 100644 --- a/src/video/SDL_blit_0.c +++ b/src/video/SDL_blit_0.c @@ -47,7 +47,7 @@ static void BlitBto1(SDL_BlitInfo *info) while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if ((c & 7) == 0) { + if (!(c & 7)) { byte = *src++; } bit = (byte & 0x80) >> 7; @@ -64,7 +64,7 @@ static void BlitBto1(SDL_BlitInfo *info) while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if ((c & 7) == 0) { + if (!(c & 7)) { byte = *src++; } bit = (byte & 0x80) >> 7; @@ -101,7 +101,7 @@ static void BlitBto2(SDL_BlitInfo *info) while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if ((c & 7) == 0) { + if (!(c & 7)) { byte = *src++; } bit = (byte & 0x80) >> 7; @@ -136,7 +136,7 @@ static void BlitBto3(SDL_BlitInfo *info) while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if ((c & 7) == 0) { + if (!(c & 7)) { byte = *src++; } bit = (byte & 0x80) >> 7; @@ -175,7 +175,7 @@ static void BlitBto4(SDL_BlitInfo *info) while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if ((c & 7) == 0) { + if (!(c & 7)) { byte = *src++; } bit = (byte & 0x80) >> 7; @@ -209,7 +209,7 @@ static void BlitBto1Key(SDL_BlitInfo *info) while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if ((c & 7) == 0) { + if (!(c & 7)) { byte = *src++; } bit = (byte & 0x80) >> 7; @@ -226,7 +226,7 @@ static void BlitBto1Key(SDL_BlitInfo *info) while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if ((c & 7) == 0) { + if (!(c & 7)) { byte = *src++; } bit = (byte & 0x80) >> 7; @@ -261,7 +261,7 @@ static void BlitBto2Key(SDL_BlitInfo *info) while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if ((c & 7) == 0) { + if (!(c & 7)) { byte = *src++; } bit = (byte & 0x80) >> 7; @@ -294,7 +294,7 @@ static void BlitBto3Key(SDL_BlitInfo *info) while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if ((c & 7) == 0) { + if (!(c & 7)) { byte = *src++; } bit = (byte & 0x80) >> 7; @@ -328,7 +328,7 @@ static void BlitBto4Key(SDL_BlitInfo *info) while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if ((c & 7) == 0) { + if (!(c & 7)) { byte = *src++; } bit = (byte & 0x80) >> 7; @@ -367,7 +367,7 @@ static void BlitBtoNAlpha(SDL_BlitInfo *info) while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if ((c & 7) == 0) { + if (!(c & 7)) { byte = *src++; } bit = (byte & 0x80) >> 7; @@ -413,7 +413,7 @@ static void BlitBtoNAlphaKey(SDL_BlitInfo *info) while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if ((c & 7) == 0) { + if (!(c & 7)) { byte = *src++; } bit = (byte & 0x80) >> 7; @@ -458,7 +458,7 @@ static void Blit4bto4(SDL_BlitInfo *info) while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if ((c & 0x1) == 0) { + if (!(c & 0x1)) { byte = *src++; } bit = (byte & 0xF0) >> 4; @@ -491,7 +491,7 @@ static void Blit4bto4Key(SDL_BlitInfo *info) while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if ((c & 0x1) == 0) { + if (!(c & 0x1)) { byte = *src++; } bit = (byte & 0xF0) >> 4; diff --git a/src/video/SDL_egl.c b/src/video/SDL_egl.c index f00b7db38..09ad9728d 100644 --- a/src/video/SDL_egl.c +++ b/src/video/SDL_egl.c @@ -972,7 +972,7 @@ SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface) } #if SDL_VIDEO_DRIVER_ANDROID - if ((_this->gl_config.flags & SDL_GL_CONTEXT_DEBUG_FLAG) != 0) { + if (_this->gl_config.flags & SDL_GL_CONTEXT_DEBUG_FLAG) { /* If SDL_GL_CONTEXT_DEBUG_FLAG is set but EGL_KHR_debug unsupported, unset. * This is required because some Android devices like to complain about it * by "silently" failing, logging a hint which could be easily overlooked: diff --git a/src/video/SDL_surface.c b/src/video/SDL_surface.c index 37157ae96..bdc6f82ea 100644 --- a/src/video/SDL_surface.c +++ b/src/video/SDL_surface.c @@ -1324,7 +1324,7 @@ end: (copy_flags & SDL_COPY_MODULATE_ALPHA)) { SDL_SetSurfaceBlendMode(convert, SDL_BLENDMODE_BLEND); } - if ((copy_flags & SDL_COPY_RLE_DESIRED)) { + if (copy_flags & SDL_COPY_RLE_DESIRED) { SDL_SetSurfaceRLE(convert, SDL_RLEACCEL); } diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index ea81e12d1..4a8006acc 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -1257,7 +1257,7 @@ SDL_DisplayID SDL_GetDisplayForWindow(SDL_Window *window) * (for example if the window is off-screen), but other code may expect it * to succeed in that situation, so we fall back to a generic position- * based implementation in that case. */ - if (!displayID && (window->flags & SDL_WINDOW_FULLSCREEN) != 0) { + if (!displayID && (window->flags & SDL_WINDOW_FULLSCREEN)) { displayID = window->fullscreen_mode.displayID; } if (!displayID) { @@ -1651,7 +1651,7 @@ SDL_Window *SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint /* ensure no more than one of these flags is set */ type_flags = flags & (SDL_WINDOW_UTILITY | SDL_WINDOW_TOOLTIP | SDL_WINDOW_POPUP_MENU); - if ((type_flags & (type_flags - 1)) != 0) { + if (type_flags & (type_flags - 1)) { SDL_SetError("Conflicting window flags specified"); return NULL; } @@ -1672,7 +1672,7 @@ SDL_Window *SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint /* ensure no more than one of these flags is set */ graphics_flags = flags & (SDL_WINDOW_OPENGL | SDL_WINDOW_METAL | SDL_WINDOW_VULKAN); - if ((graphics_flags & (graphics_flags - 1)) != 0) { + if (graphics_flags & (graphics_flags - 1)) { SDL_SetError("Conflicting window flags specified"); return NULL; } @@ -1876,7 +1876,7 @@ int SDL_RecreateWindow(SDL_Window *window, Uint32 flags) /* ensure no more than one of these flags is set */ graphics_flags = flags & (SDL_WINDOW_OPENGL | SDL_WINDOW_METAL | SDL_WINDOW_VULKAN); - if ((graphics_flags & (graphics_flags - 1)) != 0) { + if (graphics_flags & (graphics_flags - 1)) { return SDL_SetError("Conflicting window flags specified"); } @@ -2172,7 +2172,7 @@ void SDL_SetWindowPosition(SDL_Window *window, int x, int y) } } - if ((window->flags & SDL_WINDOW_FULLSCREEN) != 0) { + if (window->flags & SDL_WINDOW_FULLSCREEN) { if (!SDL_WINDOWPOS_ISUNDEFINED(x)) { window->windowed.x = x; } @@ -2198,7 +2198,7 @@ void SDL_GetWindowPosition(SDL_Window *window, int *x, int *y) CHECK_WINDOW_MAGIC(window, ); /* Fullscreen windows are always at their display's origin */ - if ((window->flags & SDL_WINDOW_FULLSCREEN) != 0) { + if (window->flags & SDL_WINDOW_FULLSCREEN) { SDL_DisplayID displayID; if (x) { @@ -2237,9 +2237,9 @@ void SDL_GetWindowPosition(SDL_Window *window, int *x, int *y) void SDL_SetWindowBordered(SDL_Window *window, SDL_bool bordered) { CHECK_WINDOW_MAGIC(window, ); - if ((window->flags & SDL_WINDOW_FULLSCREEN) == 0) { + if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { const int want = (bordered != SDL_FALSE); /* normalize the flag. */ - const int have = ((window->flags & SDL_WINDOW_BORDERLESS) == 0); + const int have = !(window->flags & SDL_WINDOW_BORDERLESS); if ((want != have) && (_this->SetWindowBordered)) { if (want) { window->flags &= ~SDL_WINDOW_BORDERLESS; @@ -2254,7 +2254,7 @@ void SDL_SetWindowBordered(SDL_Window *window, SDL_bool bordered) void SDL_SetWindowResizable(SDL_Window *window, SDL_bool resizable) { CHECK_WINDOW_MAGIC(window, ); - if ((window->flags & SDL_WINDOW_FULLSCREEN) == 0) { + if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { const int want = (resizable != SDL_FALSE); /* normalize the flag. */ const int have = ((window->flags & SDL_WINDOW_RESIZABLE) != 0); if ((want != have) && (_this->SetWindowResizable)) { @@ -2271,7 +2271,7 @@ void SDL_SetWindowResizable(SDL_Window *window, SDL_bool resizable) void SDL_SetWindowAlwaysOnTop(SDL_Window *window, SDL_bool on_top) { CHECK_WINDOW_MAGIC(window, ); - if ((window->flags & SDL_WINDOW_FULLSCREEN) == 0) { + if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { const int want = (on_top != SDL_FALSE); /* normalize the flag. */ const int have = ((window->flags & SDL_WINDOW_ALWAYS_ON_TOP) != 0); if ((want != have) && (_this->SetWindowAlwaysOnTop)) { @@ -2424,7 +2424,7 @@ void SDL_SetWindowMinimumSize(SDL_Window *window, int min_w, int min_h) window->min_w = min_w; window->min_h = min_h; - if ((window->flags & SDL_WINDOW_FULLSCREEN) == 0) { + if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { if (_this->SetWindowMinimumSize) { _this->SetWindowMinimumSize(_this, window); } @@ -2464,7 +2464,7 @@ void SDL_SetWindowMaximumSize(SDL_Window *window, int max_w, int max_h) window->max_w = max_w; window->max_h = max_h; - if ((window->flags & SDL_WINDOW_FULLSCREEN) == 0) { + if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { if (_this->SetWindowMaximumSize) { _this->SetWindowMaximumSize(_this, window); } @@ -2884,13 +2884,13 @@ SDL_bool SDL_GetWindowGrab(SDL_Window *window) SDL_bool SDL_GetWindowKeyboardGrab(SDL_Window *window) { CHECK_WINDOW_MAGIC(window, SDL_FALSE); - return window == _this->grabbed_window && ((_this->grabbed_window->flags & SDL_WINDOW_KEYBOARD_GRABBED) != 0); + return window == _this->grabbed_window && (_this->grabbed_window->flags & SDL_WINDOW_KEYBOARD_GRABBED); } SDL_bool SDL_GetWindowMouseGrab(SDL_Window *window) { CHECK_WINDOW_MAGIC(window, SDL_FALSE); - return window == _this->grabbed_window && ((_this->grabbed_window->flags & SDL_WINDOW_MOUSE_GRABBED) != 0); + return window == _this->grabbed_window && (_this->grabbed_window->flags & SDL_WINDOW_MOUSE_GRABBED); } SDL_Window *SDL_GetGrabbedWindow(void) @@ -2953,7 +2953,7 @@ void SDL_OnWindowHidden(SDL_Window *window) void SDL_OnWindowDisplayChanged(SDL_Window *window) { - if ((window->flags & SDL_WINDOW_FULLSCREEN) != 0) { + if (window->flags & SDL_WINDOW_FULLSCREEN) { SDL_Rect rect; if (SDL_WINDOW_FULLSCREEN_VISIBLE(window) && window->fullscreen_exclusive) { @@ -3063,7 +3063,7 @@ static SDL_bool SDL_ShouldMinimizeOnFocusLoss(SDL_Window *window) { const char *hint; - if ((window->flags & SDL_WINDOW_FULLSCREEN) == 0 || window->is_destroying) { + if (!(window->flags & SDL_WINDOW_FULLSCREEN) || window->is_destroying) { return SDL_FALSE; } diff --git a/src/video/android/SDL_androidwindow.c b/src/video/android/SDL_androidwindow.c index 838d9d541..c932c34c5 100644 --- a/src/video/android/SDL_androidwindow.c +++ b/src/video/android/SDL_androidwindow.c @@ -78,7 +78,7 @@ int Android_CreateWindow(_THIS, SDL_Window *window) /* Do not create EGLSurface for Vulkan window since it will then make the window incompatible with vkCreateAndroidSurfaceKHR */ #if SDL_VIDEO_OPENGL_EGL - if ((window->flags & SDL_WINDOW_OPENGL) != 0) { + if (window->flags & SDL_WINDOW_OPENGL) { data->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType)data->native_window); if (data->egl_surface == EGL_NO_SURFACE) { diff --git a/src/video/cocoa/SDL_cocoakeyboard.m b/src/video/cocoa/SDL_cocoakeyboard.m index ab8fde76d..d4b1567cc 100644 --- a/src/video/cocoa/SDL_cocoakeyboard.m +++ b/src/video/cocoa/SDL_cocoakeyboard.m @@ -307,7 +307,7 @@ void Cocoa_InitKeyboard(_THIS) SDL_SetScancodeName(SDL_SCANCODE_RGUI, "Right Command"); data.modifierFlags = (unsigned int)[NSEvent modifierFlags]; - SDL_ToggleModState(SDL_KMOD_CAPS, (data.modifierFlags & NSEventModifierFlagCapsLock) != 0); + SDL_ToggleModState(SDL_KMOD_CAPS, (data.modifierFlags & NSEventModifierFlagCapsLock) ? SDL_TRUE : SDL_FALSE); } void Cocoa_StartTextInput(_THIS) diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index 546f2960b..3b58e58f7 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -103,7 +103,7 @@ SDL_Window *window = [self findSDLWindow]; if (window == NULL) { return NO; - } else if ((window->flags & SDL_WINDOW_FULLSCREEN) != 0) { + } else if (window->flags & SDL_WINDOW_FULLSCREEN) { return NO; } else if ((window->flags & SDL_WINDOW_RESIZABLE) == 0) { return NO; @@ -323,7 +323,7 @@ static NSUInteger GetWindowStyle(SDL_Window *window) { NSUInteger style = 0; - if ((window->flags & SDL_WINDOW_FULLSCREEN) != 0) { + if (window->flags & SDL_WINDOW_FULLSCREEN) { style = NSWindowStyleMaskBorderless; } else { style = GetWindowWindowedStyle(window); @@ -394,7 +394,7 @@ static SDL_bool AdjustCoordinatesForGrab(SDL_Window *window, float x, float y, C } } - if ((window->flags & SDL_WINDOW_MOUSE_GRABBED) != 0) { + if (window->flags & SDL_WINDOW_MOUSE_GRABBED) { float left = (float)window->x; float right = left + window->w - 1; float top = (float)window->y; @@ -663,7 +663,7 @@ static void Cocoa_UpdateClipCursor(SDL_Window *window) - (void)clearFocusClickPending:(NSInteger)button { - if ((focusClickPending & (1 << button)) != 0) { + if (focusClickPending & (1 << button)) { focusClickPending &= ~(1 << button); if (focusClickPending == 0) { [self onMovingOrFocusClickPendingStateCleared]; @@ -869,7 +869,7 @@ static void Cocoa_UpdateClipCursor(SDL_Window *window) { const unsigned int newflags = [NSEvent modifierFlags] & NSEventModifierFlagCapsLock; _data.videodata.modifierFlags = (_data.videodata.modifierFlags & ~NSEventModifierFlagCapsLock) | newflags; - SDL_ToggleModState(SDL_KMOD_CAPS, newflags != 0); + SDL_ToggleModState(SDL_KMOD_CAPS, newflags ? SDL_TRUE : SDL_FALSE); } } diff --git a/src/video/emscripten/SDL_emscriptenevents.c b/src/video/emscripten/SDL_emscriptenevents.c index 1a3b1474c..b913dc93d 100644 --- a/src/video/emscripten/SDL_emscriptenevents.c +++ b/src/video/emscripten/SDL_emscriptenevents.c @@ -866,7 +866,7 @@ static EM_BOOL Emscripten_HandleResize(int eventType, const EmscriptenUiEvent *u } } - if ((window_data->window->flags & SDL_WINDOW_FULLSCREEN) == 0) { + if (!(window_data->window->flags & SDL_WINDOW_FULLSCREEN)) { /* this will only work if the canvas size is set through css */ if (window_data->window->flags & SDL_WINDOW_RESIZABLE) { double w = window_data->window->w; diff --git a/src/video/haiku/SDL_bwindow.cc b/src/video/haiku/SDL_bwindow.cc index e182caa74..852db3da8 100644 --- a/src/video/haiku/SDL_bwindow.cc +++ b/src/video/haiku/SDL_bwindow.cc @@ -52,7 +52,7 @@ static int _InitWindow(_THIS, SDL_Window *window) { window->y + window->h - 1 ); - if ((window->flags & SDL_WINDOW_FULLSCREEN) != 0) { + if (window->flags & SDL_WINDOW_FULLSCREEN) { /* TODO: Add support for this flag */ printf(__FILE__": %d!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n",__LINE__); } diff --git a/src/video/riscos/SDL_riscosevents.c b/src/video/riscos/SDL_riscosevents.c index c134c3ca4..42e6e825e 100644 --- a/src/video/riscos/SDL_riscosevents.c +++ b/src/video/riscos/SDL_riscosevents.c @@ -148,9 +148,9 @@ int RISCOS_InitEvents(_THIS) } status = (_kernel_osbyte(202, 0, 255) & 0xFF); - SDL_ToggleModState(SDL_KMOD_NUM, (status & (1 << 2)) == 0); - SDL_ToggleModState(SDL_KMOD_CAPS, (status & (1 << 4)) == 0); - SDL_ToggleModState(SDL_KMOD_SCROLL, (status & (1 << 1)) != 0); + SDL_ToggleModState(SDL_KMOD_NUM, (status & (1 << 2)) ? SDL_FALSE : SDL_TRUE); + SDL_ToggleModState(SDL_KMOD_CAPS, (status & (1 << 4)) ? SDL_FALSE : SDL_TRUE); + SDL_ToggleModState(SDL_KMOD_SCROLL, (status & (1 << 1)) ? SDL_TRUE : SDL_FALSE); _kernel_swi(OS_Mouse, ®s, ®s); driverdata->last_mouse_buttons = regs.r[2]; diff --git a/src/video/uikit/SDL_uikitview.m b/src/video/uikit/SDL_uikitview.m index 59bd9e1b8..c28dc6516 100644 --- a/src/video/uikit/SDL_uikitview.m +++ b/src/video/uikit/SDL_uikitview.m @@ -233,7 +233,7 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick; int i; for (i = 1; i <= MAX_MOUSE_BUTTONS; ++i) { - if ((event.buttonMask & SDL_BUTTON(i)) != 0) { + if (event.buttonMask & SDL_BUTTON(i)) { Uint8 button; switch (i) { @@ -289,7 +289,7 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick; int i; for (i = 1; i <= MAX_MOUSE_BUTTONS; ++i) { - if ((event.buttonMask & SDL_BUTTON(i)) != 0) { + if (event.buttonMask & SDL_BUTTON(i)) { Uint8 button; switch (i) { diff --git a/src/video/vita/SDL_vitavideo.c b/src/video/vita/SDL_vitavideo.c index f71d69ab6..7b806d815 100644 --- a/src/video/vita/SDL_vitavideo.c +++ b/src/video/vita/SDL_vitavideo.c @@ -265,7 +265,7 @@ int VITA_CreateWindow(_THIS, SDL_Window *window) else { win.windowSize = PSP2_WINDOW_960X544; } - if ((window->flags & SDL_WINDOW_OPENGL) != 0) { + if (window->flags & SDL_WINDOW_OPENGL) { if (SDL_getenv("VITA_PVR_OGL") != NULL) { /* Set version to 2.1 and PROFILE to ES */ temp_major = _this->gl_config.major_version; @@ -362,9 +362,9 @@ static void utf16_to_utf8(const uint16_t *src, uint8_t *dst) { int i; for (i = 0; src[i]; i++) { - if ((src[i] & 0xFF80) == 0) { + if (!(src[i] & 0xFF80)) { *(dst++) = src[i] & 0xFF; - } else if ((src[i] & 0xF800) == 0) { + } else if (!(src[i] & 0xF800)) { *(dst++) = ((src[i] >> 6) & 0xFF) | 0xC0; *(dst++) = (src[i] & 0x3F) | 0x80; } else if ((src[i] & 0xFC00) == 0xD800 && (src[i + 1] & 0xFC00) == 0xDC00) { diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c index 1575f7827..2246e20b8 100644 --- a/src/video/wayland/SDL_waylandvideo.c +++ b/src/video/wayland/SDL_waylandvideo.c @@ -634,7 +634,7 @@ static void display_handle_done(void *data, /* Add emulated modes if wp_viewporter is supported and mode emulation is enabled. */ if (video->viewporter && mode_emulation_enabled) { - const SDL_bool rot_90 = ((driverdata->transform & WL_OUTPUT_TRANSFORM_90) != 0) || + const SDL_bool rot_90 = (driverdata->transform & WL_OUTPUT_TRANSFORM_90) || (driverdata->screen_width < driverdata->screen_height); AddEmulatedModes(driverdata, rot_90); } diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index 5282554c3..452a5f0e2 100644 --- a/src/video/wayland/SDL_waylandwindow.c +++ b/src/video/wayland/SDL_waylandwindow.c @@ -276,7 +276,7 @@ static void SetMinMaxDimensions(SDL_Window *window, SDL_bool commit) min_height = 0; max_width = 0; max_height = 0; - } else if ((window->flags & SDL_WINDOW_RESIZABLE) != 0) { + } else if (window->flags & SDL_WINDOW_RESIZABLE) { min_width = window->min_w; min_height = window->min_h; max_width = window->max_w; @@ -508,7 +508,7 @@ static void handle_configure_xdg_toplevel(void *data, /* xdg_toplevel spec states that this is a suggestion. * Ignore if less than or greater than max/min size. */ - if ((window->flags & SDL_WINDOW_RESIZABLE)) { + if (window->flags & SDL_WINDOW_RESIZABLE) { if ((floating && !wind->floating) || width == 0 || height == 0) { /* This happens when we're being restored from a * non-floating state, so use the cached floating size here. diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c index 84866f757..06d9e1c03 100644 --- a/src/video/windows/SDL_windowsevents.c +++ b/src/video/windows/SDL_windowsevents.c @@ -412,34 +412,34 @@ static void WIN_CheckRawMouseButtons(ULONG rawButtons, SDL_WindowData *data, SDL if (rawButtons != data->mouse_button_flags) { Uint32 mouseFlags = SDL_GetMouseState(NULL, NULL); SDL_bool swapButtons = GetSystemMetrics(SM_SWAPBUTTON) != 0; - if ((rawButtons & RI_MOUSE_BUTTON_1_DOWN)) { + if (rawButtons & RI_MOUSE_BUTTON_1_DOWN) { WIN_CheckWParamMouseButton((rawButtons & RI_MOUSE_BUTTON_1_DOWN), mouseFlags, swapButtons, data, SDL_BUTTON_LEFT, mouseID); } - if ((rawButtons & RI_MOUSE_BUTTON_1_UP)) { + if (rawButtons & RI_MOUSE_BUTTON_1_UP) { WIN_CheckWParamMouseButton(!(rawButtons & RI_MOUSE_BUTTON_1_UP), mouseFlags, swapButtons, data, SDL_BUTTON_LEFT, mouseID); } - if ((rawButtons & RI_MOUSE_BUTTON_2_DOWN)) { + if (rawButtons & RI_MOUSE_BUTTON_2_DOWN) { WIN_CheckWParamMouseButton((rawButtons & RI_MOUSE_BUTTON_2_DOWN), mouseFlags, swapButtons, data, SDL_BUTTON_RIGHT, mouseID); } - if ((rawButtons & RI_MOUSE_BUTTON_2_UP)) { + if (rawButtons & RI_MOUSE_BUTTON_2_UP) { WIN_CheckWParamMouseButton(!(rawButtons & RI_MOUSE_BUTTON_2_UP), mouseFlags, swapButtons, data, SDL_BUTTON_RIGHT, mouseID); } - if ((rawButtons & RI_MOUSE_BUTTON_3_DOWN)) { + if (rawButtons & RI_MOUSE_BUTTON_3_DOWN) { WIN_CheckWParamMouseButton((rawButtons & RI_MOUSE_BUTTON_3_DOWN), mouseFlags, swapButtons, data, SDL_BUTTON_MIDDLE, mouseID); } - if ((rawButtons & RI_MOUSE_BUTTON_3_UP)) { + if (rawButtons & RI_MOUSE_BUTTON_3_UP) { WIN_CheckWParamMouseButton(!(rawButtons & RI_MOUSE_BUTTON_3_UP), mouseFlags, swapButtons, data, SDL_BUTTON_MIDDLE, mouseID); } - if ((rawButtons & RI_MOUSE_BUTTON_4_DOWN)) { + if (rawButtons & RI_MOUSE_BUTTON_4_DOWN) { WIN_CheckWParamMouseButton((rawButtons & RI_MOUSE_BUTTON_4_DOWN), mouseFlags, swapButtons, data, SDL_BUTTON_X1, mouseID); } - if ((rawButtons & RI_MOUSE_BUTTON_4_UP)) { + if (rawButtons & RI_MOUSE_BUTTON_4_UP) { WIN_CheckWParamMouseButton(!(rawButtons & RI_MOUSE_BUTTON_4_UP), mouseFlags, swapButtons, data, SDL_BUTTON_X1, mouseID); } - if ((rawButtons & RI_MOUSE_BUTTON_5_DOWN)) { + if (rawButtons & RI_MOUSE_BUTTON_5_DOWN) { WIN_CheckWParamMouseButton((rawButtons & RI_MOUSE_BUTTON_5_DOWN), mouseFlags, swapButtons, data, SDL_BUTTON_X2, mouseID); } - if ((rawButtons & RI_MOUSE_BUTTON_5_UP)) { + if (rawButtons & RI_MOUSE_BUTTON_5_UP) { WIN_CheckWParamMouseButton(!(rawButtons & RI_MOUSE_BUTTON_5_UP), mouseFlags, swapButtons, data, SDL_BUTTON_X2, mouseID); } data->mouse_button_flags = rawButtons; @@ -531,9 +531,9 @@ static void WIN_UpdateFocus(SDL_Window *window, SDL_bool expect_focus) */ WIN_CheckClipboardUpdate(data->videodata); - SDL_ToggleModState(SDL_KMOD_CAPS, (GetKeyState(VK_CAPITAL) & 0x0001) != 0); - SDL_ToggleModState(SDL_KMOD_NUM, (GetKeyState(VK_NUMLOCK) & 0x0001) != 0); - SDL_ToggleModState(SDL_KMOD_SCROLL, (GetKeyState(VK_SCROLL) & 0x0001) != 0); + SDL_ToggleModState(SDL_KMOD_CAPS, (GetKeyState(VK_CAPITAL) & 0x0001) ? SDL_TRUE : SDL_FALSE); + SDL_ToggleModState(SDL_KMOD_NUM, (GetKeyState(VK_NUMLOCK) & 0x0001) ? SDL_TRUE : SDL_FALSE); + SDL_ToggleModState(SDL_KMOD_SCROLL, (GetKeyState(VK_SCROLL) & 0x0001) ? SDL_TRUE : SDL_FALSE); WIN_UpdateWindowICCProfile(data->window, SDL_TRUE); } else { @@ -907,7 +907,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) */ SDL_bool remote_desktop = GetSystemMetrics(SM_REMOTESESSION) ? SDL_TRUE : SDL_FALSE; SDL_bool virtual_desktop = (rawmouse->usFlags & MOUSE_VIRTUAL_DESKTOP) ? SDL_TRUE : SDL_FALSE; - SDL_bool normalized_coordinates = ((rawmouse->usFlags & 0x40) == 0) ? SDL_TRUE : SDL_FALSE; + SDL_bool normalized_coordinates = !(rawmouse->usFlags & 0x40) ? SDL_TRUE : SDL_FALSE; int w = GetSystemMetrics(virtual_desktop ? SM_CXVIRTUALSCREEN : SM_CXSCREEN); int h = GetSystemMetrics(virtual_desktop ? SM_CYVIRTUALSCREEN : SM_CYSCREEN); int x = normalized_coordinates ? (int)(((float)rawmouse->lLastX / 65535.0f) * w) : (int)rawmouse->lLastX; @@ -1491,7 +1491,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_NCCALCSIZE: { Uint32 window_flags = SDL_GetWindowFlags(data->window); - if (wParam == TRUE && (window_flags & SDL_WINDOW_BORDERLESS) != 0 && (window_flags & SDL_WINDOW_FULLSCREEN) == 0) { + if (wParam == TRUE && (window_flags & SDL_WINDOW_BORDERLESS) && !(window_flags & SDL_WINDOW_FULLSCREEN)) { /* When borderless, need to tell windows that the size of the non-client area is 0 */ if (!(window_flags & SDL_WINDOW_RESIZABLE)) { int w, h; diff --git a/src/video/windows/SDL_windowskeyboard.c b/src/video/windows/SDL_windowskeyboard.c index e66b42044..9eb77cdf2 100644 --- a/src/video/windows/SDL_windowskeyboard.c +++ b/src/video/windows/SDL_windowskeyboard.c @@ -108,9 +108,9 @@ void WIN_InitKeyboard(_THIS) SDL_SetScancodeName(SDL_SCANCODE_RGUI, "Right Windows"); /* Are system caps/num/scroll lock active? Set our state to match. */ - SDL_ToggleModState(SDL_KMOD_CAPS, (GetKeyState(VK_CAPITAL) & 0x0001) != 0); - SDL_ToggleModState(SDL_KMOD_NUM, (GetKeyState(VK_NUMLOCK) & 0x0001) != 0); - SDL_ToggleModState(SDL_KMOD_SCROLL, (GetKeyState(VK_SCROLL) & 0x0001) != 0); + SDL_ToggleModState(SDL_KMOD_CAPS, (GetKeyState(VK_CAPITAL) & 0x0001) ? SDL_TRUE : SDL_FALSE); + SDL_ToggleModState(SDL_KMOD_NUM, (GetKeyState(VK_NUMLOCK) & 0x0001) ? SDL_TRUE : SDL_FALSE); + SDL_ToggleModState(SDL_KMOD_SCROLL, (GetKeyState(VK_SCROLL) & 0x0001) ? SDL_TRUE : SDL_FALSE); } void WIN_UpdateKeymap(SDL_bool send_event) diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c index eeeae79e0..5a8458790 100644 --- a/src/video/windows/SDL_windowswindow.c +++ b/src/video/windows/SDL_windowswindow.c @@ -73,27 +73,27 @@ static DWORD GetWindowStyle(SDL_Window *window) { DWORD style = 0; - if ((window->flags & SDL_WINDOW_FULLSCREEN) != 0) { + if (window->flags & SDL_WINDOW_FULLSCREEN) { style |= STYLE_FULLSCREEN; } else { - if ((window->flags & SDL_WINDOW_BORDERLESS) != 0) { + if (window->flags & SDL_WINDOW_BORDERLESS) { style |= STYLE_BORDERLESS_WINDOWED; } else { style |= STYLE_NORMAL; } - if ((window->flags & SDL_WINDOW_RESIZABLE) != 0) { + if (window->flags & SDL_WINDOW_RESIZABLE) { /* You can have a borderless resizable window, but Windows doesn't always draw it correctly, see https://bugzilla.libsdl.org/show_bug.cgi?id=4466 */ - if ((window->flags & SDL_WINDOW_BORDERLESS) == 0 || + if (!(window->flags & SDL_WINDOW_BORDERLESS) || SDL_GetHintBoolean("SDL_BORDERLESS_RESIZABLE_STYLE", SDL_FALSE)) { style |= STYLE_RESIZABLE; } } /* Need to set initialize minimize style, or when we call ShowWindow with WS_MINIMIZE it will activate a random window */ - if ((window->flags & SDL_WINDOW_MINIMIZED) != 0) { + if (window->flags & SDL_WINDOW_MINIMIZED) { style |= WS_MINIMIZE; } } @@ -908,7 +908,7 @@ void WIN_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *displa int x, y; int w, h; - if (!fullscreen && (window->flags & SDL_WINDOW_FULLSCREEN) != 0) { + if (!fullscreen && (window->flags & SDL_WINDOW_FULLSCREEN)) { /* Resizing the window on hide causes problems restoring it in Wine, and it's unnecessary. * Also, Windows would preview the minimized window with the wrong size. */ @@ -1261,7 +1261,7 @@ void WIN_UpdateClipCursor(SDL_Window *window) mouse_rect.bottom = mouse_rect.top + mouse_rect_win_client.h; if (IntersectRect(&intersection, &rect, &mouse_rect)) { SDL_memcpy(&rect, &intersection, sizeof(rect)); - } else if ((window->flags & SDL_WINDOW_MOUSE_GRABBED) != 0) { + } else if (window->flags & SDL_WINDOW_MOUSE_GRABBED) { /* Mouse rect was invalid, just do the normal grab */ } else { SDL_zero(rect); @@ -1322,7 +1322,7 @@ int WIN_SetWindowOpacity(_THIS, SDL_Window *window, float opacity) } else { const BYTE alpha = (BYTE)((int)(opacity * 255.0f)); /* want it transparent, mark it layered if necessary. */ - if ((style & WS_EX_LAYERED) == 0) { + if (!(style & WS_EX_LAYERED)) { if (SetWindowLong(hwnd, GWL_EXSTYLE, style | WS_EX_LAYERED) == 0) { return WIN_SetError("SetWindowLong()"); } diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c index 2bca51f62..152578a0e 100644 --- a/src/video/x11/SDL_x11events.c +++ b/src/video/x11/SDL_x11events.c @@ -412,9 +412,9 @@ void X11_ReconcileKeyboardState(_THIS) /* Sync up the keyboard modifier state */ if (X11_XQueryPointer(display, DefaultRootWindow(display), &junk_window, &junk_window, &x, &y, &x, &y, &mask)) { - SDL_ToggleModState(SDL_KMOD_CAPS, (mask & LockMask) != 0); - SDL_ToggleModState(SDL_KMOD_NUM, (mask & X11_GetNumLockModifierMask(_this)) != 0); - SDL_ToggleModState(SDL_KMOD_SCROLL, (mask & X11_GetScrollLockModifierMask(_this)) != 0); + SDL_ToggleModState(SDL_KMOD_CAPS, (mask & LockMask) ? SDL_TRUE : SDL_FALSE); + SDL_ToggleModState(SDL_KMOD_NUM, (mask & X11_GetNumLockModifierMask(_this)) ? SDL_TRUE : SDL_FALSE); + SDL_ToggleModState(SDL_KMOD_SCROLL, (mask & X11_GetScrollLockModifierMask(_this)) ? SDL_TRUE : SDL_FALSE); } keyboardState = SDL_GetKeyboardState(0); @@ -962,7 +962,7 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent) /* In order for interaction with the window decorations and menu to work properly on Mutter, we need to ungrab the keyboard when the the mouse leaves. */ - if ((data->window->flags & SDL_WINDOW_FULLSCREEN) == 0) { + if (!(data->window->flags & SDL_WINDOW_FULLSCREEN)) { X11_SetWindowKeyboardGrab(_this, data->window, SDL_FALSE); } @@ -1465,15 +1465,15 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent) const Uint32 changed = flags ^ data->window->flags; if ((changed & (SDL_WINDOW_HIDDEN | SDL_WINDOW_FULLSCREEN)) != 0) { - if ((flags & SDL_WINDOW_HIDDEN) != 0) { + if (flags & SDL_WINDOW_HIDDEN) { X11_DispatchUnmapNotify(data); } else { X11_DispatchMapNotify(data); } } - if ((changed & SDL_WINDOW_MAXIMIZED) != 0) { - if ((flags & SDL_WINDOW_MAXIMIZED) != 0) { + if (changed & SDL_WINDOW_MAXIMIZED) { + if (flags & SDL_WINDOW_MAXIMIZED) { SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_MAXIMIZED, 0, 0); } else { SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_RESTORED, 0, 0); diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c index 4fffe7ada..31651e510 100644 --- a/src/video/x11/SDL_x11window.c +++ b/src/video/x11/SDL_x11window.c @@ -138,21 +138,21 @@ void X11_SetNetWMState(_THIS, Window xwindow, Uint32 flags) } */ - if ((flags & SDL_WINDOW_ALWAYS_ON_TOP) != 0) { + if (flags & SDL_WINDOW_ALWAYS_ON_TOP) { atoms[count++] = _NET_WM_STATE_ABOVE; } - if ((flags & SDL_WINDOW_SKIP_TASKBAR) != 0) { + if (flags & SDL_WINDOW_SKIP_TASKBAR) { atoms[count++] = _NET_WM_STATE_SKIP_TASKBAR; atoms[count++] = _NET_WM_STATE_SKIP_PAGER; } - if ((flags & SDL_WINDOW_INPUT_FOCUS) != 0) { + if (flags & SDL_WINDOW_INPUT_FOCUS) { atoms[count++] = _NET_WM_STATE_FOCUSED; } - if ((flags & SDL_WINDOW_MAXIMIZED) != 0) { + if (flags & SDL_WINDOW_MAXIMIZED) { atoms[count++] = _NET_WM_STATE_MAXIMIZED_VERT; atoms[count++] = _NET_WM_STATE_MAXIMIZED_HORZ; } - if ((flags & SDL_WINDOW_FULLSCREEN) != 0) { + if (flags & SDL_WINDOW_FULLSCREEN) { atoms[count++] = _NET_WM_STATE_FULLSCREEN; } @@ -207,7 +207,7 @@ X11_GetNetWMState(_THIS, SDL_Window *window, Window xwindow) } if (fullscreen == 1) { - if ((window->flags & SDL_WINDOW_FULLSCREEN) != 0) { + if (window->flags & SDL_WINDOW_FULLSCREEN) { /* Pick whatever state the window expects */ flags |= (window->flags & SDL_WINDOW_FULLSCREEN); } else { @@ -544,7 +544,7 @@ int X11_CreateWindow(_THIS, SDL_Window *window) } SetWindowBordered(display, screen, w, - (window->flags & SDL_WINDOW_BORDERLESS) == 0); + !(window->flags & SDL_WINDOW_BORDERLESS)); sizehints = X11_XAllocSizeHints(); /* Setup the normal size hints */ @@ -1042,8 +1042,8 @@ int X11_SetWindowInputFocus(_THIS, SDL_Window *window) void X11_SetWindowBordered(_THIS, SDL_Window *window, SDL_bool bordered) { - const SDL_bool focused = ((window->flags & SDL_WINDOW_INPUT_FOCUS) != 0); - const SDL_bool visible = ((window->flags & SDL_WINDOW_HIDDEN) == 0); + const SDL_bool focused = (window->flags & SDL_WINDOW_INPUT_FOCUS) ? SDL_TRUE : SDL_FALSE; + const SDL_bool visible = (!(window->flags & SDL_WINDOW_HIDDEN)) ? SDL_TRUE : SDL_FALSE; SDL_WindowData *data = window->driverdata; SDL_DisplayData *displaydata = SDL_GetDisplayDriverDataForWindow(window); Display *display = data->videodata->display; @@ -1234,7 +1234,7 @@ static void X11_SetWindowMaximized(_THIS, SDL_Window *window, SDL_bool maximized } else { window->flags &= ~SDL_WINDOW_MAXIMIZED; - if ((window->flags & SDL_WINDOW_FULLSCREEN) != 0) { + if (window->flags & SDL_WINDOW_FULLSCREEN) { /* Fullscreen windows are maximized on some window managers, and this is functional behavior, so don't remove that state now, we'll take care of it when we leave fullscreen mode. @@ -1356,7 +1356,7 @@ static void X11_SetWindowFullscreenViaWM(_THIS, SDL_Window *window, SDL_VideoDis e.xclient.message_type = _NET_WM_STATE; e.xclient.format = 32; e.xclient.window = data->xwindow; - if ((window->flags & SDL_WINDOW_MAXIMIZED) != 0) { + if (window->flags & SDL_WINDOW_MAXIMIZED) { e.xclient.data.l[0] = _NET_WM_STATE_ADD; } else { e.xclient.data.l[0] = _NET_WM_STATE_REMOVE; diff --git a/test/gamepadmap.c b/test/gamepadmap.c index ed7d8c769..fbbfd8eb1 100644 --- a/test/gamepadmap.c +++ b/test/gamepadmap.c @@ -532,7 +532,7 @@ WatchJoystick(SDL_Joystick *joystick) break; } - if ((event.key.keysym.sym != SDLK_ESCAPE)) { + if (event.key.keysym.sym != SDLK_ESCAPE) { break; } SDL_FALLTHROUGH; @@ -766,7 +766,7 @@ int main(int argc, char *argv[]) while (SDL_PollEvent(&event) > 0) { switch (event.type) { case SDL_EVENT_KEY_DOWN: - if ((event.key.keysym.sym != SDLK_ESCAPE)) { + if (event.key.keysym.sym != SDLK_ESCAPE) { break; } SDL_FALLTHROUGH; diff --git a/test/testgamepad.c b/test/testgamepad.c index d2e608a08..2c9ae7603 100644 --- a/test/testgamepad.c +++ b/test/testgamepad.c @@ -349,7 +349,7 @@ static SDL_bool ShowingFront() } } } - if ((SDL_GetModState() & SDL_KMOD_SHIFT) != 0) { + if (SDL_GetModState() & SDL_KMOD_SHIFT) { showing_front = SDL_FALSE; } return showing_front; diff --git a/test/testime.c b/test/testime.c index 59d464761..16340ec90 100644 --- a/test/testime.c +++ b/test/testime.c @@ -731,7 +731,7 @@ int main(int argc, char *argv[]) if (textlen == 0) { break; } - if ((text[textlen - 1] & 0x80) == 0x00) { + if (!(text[textlen - 1] & 0x80)) { /* One byte */ text[textlen - 1] = 0x00; break;