SDL: Use SDL_bool instead an int return code in the SDL API

From 9ff3446f036094bc005ef119e0cf07fc9b503b8e Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 22 Aug 2024 17:33:49 -0700
Subject: [PATCH] Use SDL_bool instead an int return code in the SDL API

Most SDL functions used to indicate success or failure using an int return code. These functions have been changed to return SDL_bool.

Here is a coccinelle patch to change code that previously compared the return value to 0 and changes it to a boolean test:
@ bool_return_type  @
identifier func =~ "^(SDL_AddEventWatch|SDL_AddHintCallback|SDL_AddSurfaceAlternateImage|SDL_AddVulkanRenderSemaphores|SDL_BindAudioStream|SDL_BindAudioStreams|SDL_BlitSurface|SDL_BlitSurface9Grid|SDL_BlitSurfaceScaled|SDL_BlitSurfaceTiled|SDL_BlitSurfaceTiledWithScale|SDL_BlitSurfaceUnchecked|SDL_BlitSurfaceUncheckedScaled|SDL_CaptureMouse|SDL_ClearAudioStream|SDL_ClearClipboardData|SDL_ClearComposition|SDL_ClearError|SDL_ClearProperty|SDL_ClearSurface|SDL_CloseIO|SDL_CloseStorage|SDL_ConvertAudioSamples|SDL_ConvertEventToRenderCoordinates|SDL_ConvertPixels|SDL_ConvertPixelsAndColorspace|SDL_CopyFile|SDL_CopyProperties|SDL_CopyStorageFile|SDL_CreateDirectory|SDL_CreateStorageDirectory|SDL_CreateWindowAndRenderer|SDL_DateTimeToTime|SDL_DestroyWindowSurface|SDL_DetachVirtualJoystick|SDL_DisableScreenSaver|SDL_EnableScreenSaver|SDL_EnumerateDirectory|SDL_EnumerateProperties|SDL_EnumerateStorageDirectory|SDL_FillSurfaceRect|SDL_FillSurfaceRects|SDL_FlashWindow|SDL_FlipSurface|SDL_FlushAudioStream|SDL_FlushRenderer|SDL_GL_DestroyContext|SDL_GL_GetAttribute|SDL_GL_GetSwapInterval|SDL_GL_LoadLibrary|SDL_GL_MakeCurrent|SDL_GL_SetAttribute|SDL_GL_SetSwapInterval|SDL_GL_SwapWindow|SDL_GetAudioDeviceFormat|SDL_GetAudioStreamFormat|SDL_GetCameraFormat|SDL_GetClosestFullscreenDisplayMode|SDL_GetCurrentRenderOutputSize|SDL_GetCurrentTime|SDL_GetDXGIOutputInfo|SDL_GetDateTimeLocalePreferences|SDL_GetDisplayBounds|SDL_GetDisplayUsableBounds|SDL_GetGDKDefaultUser|SDL_GetGDKTaskQueue|SDL_GetGamepadSensorData|SDL_GetGamepadTouchpadFinger|SDL_GetHapticEffectStatus|SDL_GetJoystickBall|SDL_GetMasksForPixelFormat|SDL_GetPathInfo|SDL_GetRectUnion|SDL_GetRectUnionFloat|SDL_GetRenderClipRect|SDL_GetRenderColorScale|SDL_GetRenderDrawBlendMode|SDL_GetRenderDrawColor|SDL_GetRenderDrawColorFloat|SDL_GetRenderLogicalPresentation|SDL_GetRenderLogicalPresentationRect|SDL_GetRenderOutputSize|SDL_GetRenderSafeArea|SDL_GetRenderScale|SDL_GetRenderVSync|SDL_GetRenderViewport|SDL_GetSensorData|SDL_GetStorageFileSize|SDL_GetStoragePathInfo|SDL_GetSurfaceAlphaMod|SDL_GetSurfaceBlendMode|SDL_GetSurfaceClipRect|SDL_GetSurfaceColorKey|SDL_GetSurfaceColorMod|SDL_GetTextInputArea|SDL_GetTextureAlphaMod|SDL_GetTextureAlphaModFloat|SDL_GetTextureBlendMode|SDL_GetTextureColorMod|SDL_GetTextureColorModFloat|SDL_GetTextureScaleMode|SDL_GetTextureSize|SDL_GetWindowAspectRatio|SDL_GetWindowBordersSize|SDL_GetWindowMaximumSize|SDL_GetWindowMinimumSize|SDL_GetWindowPosition|SDL_GetWindowRelativeMouseMode|SDL_GetWindowSafeArea|SDL_GetWindowSize|SDL_GetWindowSizeInPixels|SDL_GetWindowSurfaceVSync|SDL_HideCursor|SDL_HideWindow|SDL_Init|SDL_InitHapticRumble|SDL_InitSubSystem|SDL_LoadWAV|SDL_LoadWAV_IO|SDL_LockAudioStream|SDL_LockProperties|SDL_LockSurface|SDL_LockTexture|SDL_LockTextureToSurface|SDL_MaximizeWindow|SDL_MinimizeWindow|SDL_MixAudio|SDL_OpenURL|SDL_OutOfMemory|SDL_PauseAudioDevice|SDL_PauseAudioStreamDevice|SDL_PauseHaptic|SDL_PlayHapticRumble|SDL_PremultiplyAlpha|SDL_PremultiplySurfaceAlpha|SDL_PushEvent|SDL_PutAudioStreamData|SDL_RaiseWindow|SDL_ReadStorageFile|SDL_ReadSurfacePixel|SDL_ReadSurfacePixelFloat|SDL_RegisterApp|SDL_ReloadGamepadMappings|SDL_RemovePath|SDL_RemoveStoragePath|SDL_RemoveTimer|SDL_RenamePath|SDL_RenameStoragePath|SDL_RenderClear|SDL_RenderCoordinatesFromWindow|SDL_RenderCoordinatesToWindow|SDL_RenderFillRect|SDL_RenderFillRects|SDL_RenderGeometry|SDL_RenderGeometryRaw|SDL_RenderLine|SDL_RenderLines|SDL_RenderPoint|SDL_RenderPoints|SDL_RenderPresent|SDL_RenderRect|SDL_RenderRects|SDL_RenderTexture|SDL_RenderTexture9Grid|SDL_RenderTextureRotated|SDL_RenderTextureTiled|SDL_RequestAndroidPermission|SDL_RestoreWindow|SDL_ResumeAudioDevice|SDL_ResumeAudioStreamDevice|SDL_ResumeHaptic|SDL_RumbleGamepad|SDL_RumbleGamepadTriggers|SDL_RumbleJoystick|SDL_RumbleJoystickTriggers|SDL_RunHapticEffect|SDL_SaveBMP|SDL_SaveBMP_IO|SDL_SendAndroidMessage|SDL_SendGamepadEffect|SDL_SendJoystickEffect|SDL_SendJoystickVirtualSensorData|SDL_SetAppMetadata|SDL_SetAppMetadataProperty|SDL_SetAudioDeviceGain|SDL_SetAudioPostmixCallback|SDL_SetAudioStreamFormat|SDL_SetAudioStreamFrequencyRatio|SDL_SetAudioStreamGain|SDL_SetAudioStreamGetCallback|SDL_SetAudioStreamInputChannelMap|SDL_SetAudioStreamOutputChannelMap|SDL_SetAudioStreamPutCallback|SDL_SetBooleanProperty|SDL_SetClipboardData|SDL_SetClipboardText|SDL_SetCursor|SDL_SetFloatProperty|SDL_SetGamepadLED|SDL_SetGamepadMapping|SDL_SetGamepadPlayerIndex|SDL_SetGamepadSensorEnabled|SDL_SetHapticAutocenter|SDL_SetHapticGain|SDL_SetJoystickLED|SDL_SetJoystickPlayerIndex|SDL_SetJoystickVirtualAxis|SDL_SetJoystickVirtualBall|SDL_SetJoystickVirtualButton|SDL_SetJoystickVirtualHat|SDL_SetJoystickVirtualTouchpad|SDL_SetLinuxThreadPriority|SDL_SetLinuxThreadPriorityAndPolicy|SDL_SetLogPriorityPrefix|SDL_SetMemoryFunctions|SDL_SetNumberProperty|SDL_SetPaletteColors|SDL_SetPointerProperty|SDL_SetPointerPropertyWithCleanup|SDL_SetPrimarySelectionText|SDL_SetRenderClipRect|SDL_SetRenderColorScale|SDL_SetRenderDrawBlendMode|SDL_SetRenderDrawColor|SDL_SetRenderDrawColorFloat|SDL_SetRenderLogicalPresentation|SDL_SetRenderScale|SDL_SetRenderTarget|SDL_SetRenderVSync|SDL_SetRenderViewport|SDL_SetScancodeName|SDL_SetStringProperty|SDL_SetSurfaceAlphaMod|SDL_SetSurfaceBlendMode|SDL_SetSurfaceColorKey|SDL_SetSurfaceColorMod|SDL_SetSurfaceColorspace|SDL_SetSurfacePalette|SDL_SetSurfaceRLE|SDL_SetTLS|SDL_SetTextInputArea|SDL_SetTextureAlphaMod|SDL_SetTextureAlphaModFloat|SDL_SetTextureBlendMode|SDL_SetTextureColorMod|SDL_SetTextureColorModFloat|SDL_SetTextureScaleMode|SDL_SetThreadPriority|SDL_SetWindowAlwaysOnTop|SDL_SetWindowAspectRatio|SDL_SetWindowBordered|SDL_SetWindowFocusable|SDL_SetWindowFullscreen|SDL_SetWindowFullscreenMode|SDL_SetWindowHitTest|SDL_SetWindowIcon|SDL_SetWindowKeyboardGrab|SDL_SetWindowMaximumSize|SDL_SetWindowMinimumSize|SDL_SetWindowModalFor|SDL_SetWindowMouseGrab|SDL_SetWindowMouseRect|SDL_SetWindowOpacity|SDL_SetWindowPosition|SDL_SetWindowRelativeMouseMode|SDL_SetWindowResizable|SDL_SetWindowShape|SDL_SetWindowSize|SDL_SetWindowSurfaceVSync|SDL_SetWindowTitle|SDL_SetiOSAnimationCallback|SDL_ShowAndroidToast|SDL_ShowCursor|SDL_ShowMessageBox|SDL_ShowSimpleMessageBox|SDL_ShowWindow|SDL_ShowWindowSystemMenu|SDL_StartTextInput|SDL_StartTextInputWithProperties|SDL_StopHapticEffect|SDL_StopHapticEffects|SDL_StopHapticRumble|SDL_StopTextInput|SDL_SyncWindow|SDL_TimeToDateTime|SDL_TryLockMutex|SDL_TryLockRWLockForReading|SDL_TryLockRWLockForWriting|SDL_TryWaitSemaphore|SDL_UnlockAudioStream|SDL_UpdateHapticEffect|SDL_UpdateNVTexture|SDL_UpdateTexture|SDL_UpdateWindowSurface|SDL_UpdateWindowSurfaceRects|SDL_UpdateYUVTexture|SDL_Vulkan_CreateSurface|SDL_Vulkan_LoadLibrary|SDL_WaitConditionTimeout|SDL_WaitSemaphoreTimeout|SDL_WarpMouseGlobal|SDL_WriteStorageFile|SDL_WriteSurfacePixel|SDL_WriteSurfacePixelFloat)$";
@@
(
  func(
  ...
  )
- == 0
|
- func(
+ !func(
  ...
  )
- < 0
|
- func(
+ !func(
  ...
  )
- != 0
|
- func(
+ !func(
  ...
  )
- == -1
)
---
 VisualC-GDK/tests/testgdk/src/testgdk.cpp     |   4 +-
 android-project/app/jni/src/YourSourceHere.c  |   6 +-
 .../main/java/org/libsdl/app/SDLActivity.java |  18 +-
 .../org/libsdl/app/SDLControllerManager.java  |  18 +-
 build-scripts/SDL_migration.cocci             |  30 +-
 cmake/test/main.swift                         |   2 +-
 cmake/test/main_cli.c                         |   2 +-
 cmake/test/main_gui.c                         |   2 +-
 cmake/test/main_lib.c                         |   2 +-
 docs/README-cmake.md                          |   4 +-
 docs/README-dynapi.md                         |   4 +-
 docs/README-ios.md                            |   2 +-
 docs/README-macos.md                          |   4 +-
 docs/README-migration.md                      |  92 +-
 docs/README-winrt.md                          |   4 +-
 .../01-simple-playback/simple-playback.c      |   4 +-
 .../simple-playback-callback.c                |   4 +-
 examples/audio/03-load-wav/load-wav.c         |   6 +-
 .../camera/01-read-and-draw/read-and-draw.c   |   4 +-
 examples/game/01-snake/main.c                 |  18 +-
 examples/pen/01-drawing-lines/drawing-lines.c |   4 +-
 examples/renderer/01-clear/renderer-clear.c   |   4 +-
 .../02-primitives/renderer-primitives.c       |   4 +-
 examples/template.c                           |   4 +-
 include/SDL3/SDL_audio.h                      | 132 ++-
 include/SDL3/SDL_camera.h                     |  10 +-
 include/SDL3/SDL_clipboard.h                  |  16 +-
 include/SDL3/SDL_error.h                      |  12 +-
 include/SDL3/SDL_events.h                     |  11 +-
 include/SDL3/SDL_filesystem.h                 |  24 +-
 include/SDL3/SDL_gamepad.h                    |  41 +-
 include/SDL3/SDL_haptic.h                     |  75 +-
 include/SDL3/SDL_hints.h                      |  20 +-
 include/SDL3/SDL_init.h                       |  16 +-
 include/SDL3/SDL_iostream.h                   |  11 +-
 include/SDL3/SDL_joystick.h                   |  72 +-
 include/SDL3/SDL_keyboard.h                   |  28 +-
 include/SDL3/SDL_log.h                        |   4 +-
 include/SDL3/SDL_main.h                       |   6 +-
 include/SDL3/SDL_messagebox.h                 |   8 +-
 include/SDL3/SDL_misc.h                       |   4 +-
 include/SDL3/SDL_mouse.h                      |  24 +-
 include/SDL3/SDL_mutex.h                      | 115 +--
 include/SDL3/SDL_pixels.h                     |   8 +-
 include/SDL3/SDL_properties.h                 |  40 +-
 include/SDL3/SDL_rect.h                       |  46 +-
 include/SDL3/SDL_render.h                     | 265 +++--
 include/SDL3/SDL_sensor.h                     |   4 +-
 include/SDL3/SDL_stdinc.h                     |  10 +-
 include/SDL3/SDL_storage.h                    |  58 +-
 include/SDL3/SDL_surface.h                    | 142 +--
 include/SDL3/SDL_system.h                     |  38 +-
 include/SDL3/SDL_test_font.h                  |   8 +-
 include/SDL3/SDL_thread.h                     |   8 +-
 include/SDL3/SDL_time.h                       |  26 +-
 include/SDL3/SDL_timer.h                      |   4 +-
 include/SDL3/SDL_video.h                      | 233 +++--
 include/SDL3/SDL_vulkan.h                     |  14 +-
 src/SDL.c                                     |  38 +-
 src/SDL_assert.c                              |   2 +-
 src/SDL_error.c                               |  12 +-
 src/SDL_hints.c                               |  48 +-
 src/SDL_internal.h                            |   4 +-
 src/SDL_list.c                                |   6 +-
 src/SDL_list.h                                |   2 +-
 src/SDL_log.c                                 |   6 +-
 src/SDL_properties.c                          |  70 +-
 src/SDL_properties_c.h                        |   8 +-
 src/SDL_utils.c                               |  24 +-
 src/SDL_utils_c.h                             |   2 +
 src/atomic/SDL_atomic.c                       |  12 +-
 src/audio/SDL_audio.c                         | 208 ++--
 src/audio/SDL_audiocvt.c                      | 195 ++--
 src/audio/SDL_audioqueue.c                    |  26 +-
 src/audio/SDL_audioqueue.h                    |  38 +-
 src/audio/SDL_audioresample.c                 |  20 +-
 src/audio/SDL_mixer.c                         |   7 +-
 src/audio/SDL_sysaudio.h                      |  22 +-
 src/audio/SDL_wave.c                          | 201 ++--
 src/audio/aaudio/SDL_aaudio.c                 |  57 +-
 src/audio/alsa/SDL_alsa_audio.c               |  48 +-
 src/audio/coreaudio/SDL_coreaudio.m           |  40 +-
 src/audio/directsound/SDL_directsound.c       |  50 +-
 src/audio/disk/SDL_diskaudio.c                |  20 +-
 src/audio/dsp/SDL_dspaudio.c                  |  20 +-
 src/audio/dummy/SDL_dummyaudio.c              |  12 +-
 src/audio/emscripten/SDL_emscriptenaudio.c    |  18 +-
 src/audio/haiku/SDL_haikuaudio.cc             |  14 +-
 src/audio/jack/SDL_jackaudio.c                |  53 +-
 src/audio/n3ds/SDL_n3dsaudio.c                |  23 +-
 src/audio/netbsd/SDL_netbsdaudio.c            |  20 +-
 src/audio/openslES/SDL_openslES.c             |  49 +-
 src/audio/pipewire/SDL_pipewire.c             |  55 +-
 src/audio/ps2/SDL_ps2audio.c                  |  14 +-
 src/audio/psp/SDL_pspaudio.c                  |  14 +-
 src/audio/pulseaudio/SDL_pulseaudio.c         |  82 +-
 src/audio/qnx/SDL_qsa_audio.c                 |  30 +-
 src/audio/sndio/SDL_sndioaudio.c              |  56 +-
 src/audio/vita/SDL_vitaaudio.c                |  29 +-
 src/audio/wasapi/SDL_wasapi.c                 | 132 +--
 src/audio/wasapi/SDL_wasapi.h                 |  10 +-
 src/audio/wasapi/SDL_wasapi_win32.c           |  28 +-
 src/audio/wasapi/SDL_wasapi_winrt.cpp         |  12 +-
 src/camera/SDL_camera.c                       | 127 ++-
 src/camera/SDL_camera_c.h                     |   4 +-
 src/camera/SDL_syscamera.h                    |  19 +-
 src/camera/android/SDL_camera_android.c       |  43 +-
 src/camera/coremedia/SDL_camera_coremedia.m   |  18 +-
 src/camera/dummy/SDL_camera_dummy.c           |   9 +-
 src/camera/emscripten/SDL_camera_emscripten.c |  16 +-
 .../SDL_camera_mediafoundation.c              |  80 +-
 src/camera/pipewire/SDL_camera_pipewire.c     |  99 +-
 src/camera/v4l2/SDL_camera_v4l2.c             | 146 +--
 src/core/SDL_core_unsupported.c               |  28 +-
 src/core/android/SDL_android.c                | 155 ++-
 src/core/android/SDL_android.h                |  20 +-
 src/core/freebsd/SDL_evdev_kbd_freebsd.c      |   4 +-
 src/core/gdk/SDL_gdk.cpp                      |  21 +-
 src/core/gdk/SDL_gdk.h                        |   3 +-
 src/core/haiku/SDL_BeApp.cc                   |  12 +-
 src/core/haiku/SDL_BeApp.h                    |   2 +-
 src/core/linux/SDL_dbus.c                     |  63 +-
 src/core/linux/SDL_evdev.c                    |  82 +-
 src/core/linux/SDL_evdev.h                    |   2 +-
 src/core/linux/SDL_evdev_kbd.c                |  10 +-
 src/core/linux/SDL_fcitx.c                    |   6 +-
 src/core/linux/SDL_threadprio.c               |  14 +-
 src/core/linux/SDL_udev.c                     |  57 +-
 src/core/linux/SDL_udev.h                     |   8 +-
 src/core/windows/SDL_hid.c                    |  10 +-
 src/core/windows/SDL_hid.h                    |   2 +-
 src/core/windows/SDL_immdevice.c              |  18 +-
 src/core/windows/SDL_immdevice.h              |   4 +-
 src/core/windows/SDL_windows.c                |  18 +-
 src/core/windows/SDL_windows.h                |   4 +-
 src/core/windows/SDL_xinput.c                 |  14 +-
 src/core/windows/SDL_xinput.h                 |   2 +-
 src/core/winrt/SDL_winrtapp_direct3d.cpp      |   4 +-
 src/core/winrt/SDL_winrtapp_direct3d.h        |   2 +-
 src/core/winrt/SDL_winrtapp_xaml.cpp          |   8 +-
 src/core/winrt/SDL_winrtapp_xaml.h            |   2 +-
 src/dialog/haiku/SDL_haikudialog.cc           |  10 +-
 src/dialog/unix/SDL_portaldialog.c            |  12 +-
 src/dialog/unix/SDL_portaldialog.h            |   2 +-
 src/dialog/unix/SDL_zenitydialog.c            |   8 +-
 src/dialog/unix/SDL_zenitydialog.h            |   8 +-
 src/dynapi/SDL_dynapi.c                       |  84 +-
 src/dynapi/SDL_dynapi_procs.h                 | 626 ++++++------
 src/events/SDL_categories.c                   |   3 +-
 src/events/SDL_categories_c.h                 |   1 +
 src/events/SDL_clipboardevents.c              |   9 +-
 src/events/SDL_clipboardevents_c.h            |   2 +-
 src/events/SDL_displayevents.c                |  13 +-
 src/events/SDL_displayevents_c.h              |   2 +-
 src/events/SDL_dropevents.c                   |  22 +-
 src/events/SDL_dropevents_c.h                 |   8 +-
 src/events/SDL_events.c                       |  61 +-
 src/events/SDL_events_c.h                     |  16 +-
 src/events/SDL_keyboard.c                     |  73 +-
 src/events/SDL_keyboard_c.h                   |  20 +-
 src/events/SDL_keymap.c                       |   4 +-
 src/events/SDL_mouse.c                        | 104 +-
 src/events/SDL_mouse_c.h                      |  28 +-
 src/events/SDL_pen.c                          | 133 ++-
 src/events/SDL_pen_c.h                        |  10 +-
 src/events/SDL_quit.c                         |  13 +-
 src/events/SDL_touch.c                        |  63 +-
 src/events/SDL_touch_c.h                      |   6 +-
 src/events/SDL_windowevents.c                 |  44 +-
 src/events/SDL_windowevents_c.h               |   3 +-
 src/file/SDL_iostream.c                       |  62 +-
 src/filesystem/SDL_filesystem.c               |  61 +-
 src/filesystem/SDL_sysfilesystem.h            |  20 +-
 src/filesystem/cocoa/SDL_sysfilesystem.m      |  44 +-
 src/filesystem/dummy/SDL_sysfsops.c           |  13 +-
 src/filesystem/emscripten/SDL_sysfilesystem.c |  32 +-
 src/filesystem/gdk/SDL_sysfilesystem.cpp      |   2 +-
 src/filesystem/haiku/SDL_sysfilesystem.cc     |  46 +-
 src/filesystem/n3ds/SDL_sysfilesystem.c       |   8 +-
 src/filesystem/posix/SDL_sysfsops.c           |  43 +-
 src/filesystem/ps2/SDL_sysfilesystem.c        |  24 +-
 src/filesystem/psp/SDL_sysfilesystem.c        |  24 +-
 src/filesystem/riscos/SDL_sysfilesystem.c     |  12 +-
 src/filesystem/unix/SDL_sysfilesystem.c       | 106 +-
 src/filesystem/vita/SDL_sysfilesystem.c       |  18 +-
 src/filesystem/windows/SDL_sysfilesystem.c    |  52 +-
 src/filesystem/windows/SDL_sysfsops.c         |  65 +-
 src/filesystem/winrt/SDL_sysfilesystem.cpp    |   6 +-
 src/haptic/SDL_haptic.c                       | 141 ++-
 src/haptic/SDL_haptic_c.h                     |   2 +-
 src/haptic/SDL_syshaptic.h                    |  62 +-
 src/haptic/android/SDL_syshaptic.c            |  62 +-
 src/haptic/android/SDL_syshaptic_c.h          |   4 +-
 src/haptic/darwin/SDL_syshaptic.c             | 163 ++-
 src/haptic/darwin/SDL_syshaptic_c.h           |   4 +-
 src/haptic/dummy/SDL_syshaptic.c              |  31 +-
 src/haptic/linux/SDL_syshaptic.c              | 167 ++--
 src/haptic/windows/SDL_dinputhaptic.c         | 191 ++--
 src/haptic/windows/SDL_dinputhaptic_c.h       |  30 +-
 src/haptic/windows/SDL_windowshaptic.c        |  48 +-
 src/haptic/windows/SDL_windowshaptic_c.h      |   4 +-
 src/hidapi/SDL_hidapi.c                       |   4 +-
 src/hidapi/android/hid.cpp                    |   2 +-
 src/hidapi/libusb/hidapi_thread_sdl.h         |   8 +-
 src/joystick/SDL_gamepad.c                    | 287 +++---
 src/joystick/SDL_gamepad_c.h                  |   4 +-
 src/joystick/SDL_joystick.c                   | 394 ++++----
 src/joystick/SDL_joystick_c.h                 |  14 +-
 src/joystick/SDL_sysjoystick.h                |  14 +-
 src/joystick/android/SDL_sysjoystick.c        |  56 +-
 src/joystick/android/SDL_sysjoystick_c.h      |  12 +-
 src/joystick/apple/SDL_mfijoystick.m          | 168 ++--
 src/joystick/bsd/SDL_bsdjoystick.c            |  51 +-
 src/joystick/darwin/SDL_iokitjoystick.c       |  60 +-
 src/joystick/dummy/SDL_sysjoystick.c          |  18 +-
 src/joystick/emscripten/SDL_sysjoystick.c     |  49 +-
 src/joystick/gdk/SDL_gameinputjoystick.c      |  52 +-
 src/joystick/haiku/SDL_haikujoystick.cc       |  35 +-
 src/joystick/hidapi/SDL_hidapi_combined.c     |  26 +-
 src/joystick/hidapi/SDL_hidapi_gamecube.c     |  12 +-
 src/joystick/hidapi/SDL_hidapi_luna.c         |  14 +-
 src/joystick/hidapi/SDL_hidapi_ps3.c          |  56 +-
 src/joystick/hidapi/SDL_hidapi_ps4.c          |  24 +-
 src/joystick/hidapi/SDL_hidapi_ps5.c          |  34 +-
 src/joystick/hidapi/SDL_hidapi_rumble.c       |  26 +-
 src/joystick/hidapi/SDL_hidapi_rumble.h       |   2 +-
 src/joystick/hidapi/SDL_hidapi_shield.c       |  28 +-
 src/joystick/hidapi/SDL_hidapi_stadia.c       |  14 +-
 src/joystick/hidapi/SDL_hidapi_steam.c        |  12 +-
 src/joystick/hidapi/SDL_hidapi_steamdeck.c    |  16 +-
 src/joystick/hidapi/SDL_hidapi_switch.c       |  44 +-
 src/joystick/hidapi/SDL_hidapi_wii.c          |  18 +-
 src/joystick/hidapi/SDL_hidapi_xbox360.c      |  14 +-
 src/joystick/hidapi/SDL_hidapi_xbox360w.c     |  14 +-
 src/joystick/hidapi/SDL_hidapi_xboxone.c      |  28 +-
 src/joystick/hidapi/SDL_hidapijoystick.c      |  40 +-
 src/joystick/hidapi/SDL_hidapijoystick_c.h    |  10 +-
 src/joystick/linux/SDL_sysjoystick.c          | 130 ++-
 src/joystick/n3ds/SDL_sysjoystick.c           |  18 +-
 src/joystick/ps2/SDL_sysjoystick.c            |  31 +-
 src/joystick/psp/SDL_sysjoystick.c            |  16 +-
 src/joystick/virtual/SDL_virtualjoystick.c    |  67 +-
 src/joystick/virtual/SDL_virtualjoystick_c.h  |  14 +-
 src/joystick/vita/SDL_sysjoystick.c           |  24 +-
 src/joystick/windows/SDL_dinputjoystick.c     |  34 +-
 src/joystick/windows/SDL_dinputjoystick_c.h   |   6 +-
 src/joystick/windows/SDL_rawinputjoystick.c   |  68 +-
 .../windows/SDL_windows_gaming_input.c        |  28 +-
 src/joystick/windows/SDL_windowsjoystick.c    |  71 +-
 src/joystick/windows/SDL_xinputjoystick.c     |  22 +-
 src/joystick/windows/SDL_xinputjoystick_c.h   |   6 +-
 src/locale/SDL_locale.c                       |  14 +-
 src/locale/SDL_syslocale.h                    |   2 +-
 src/locale/android/SDL_syslocale.c            |   5 +-
 src/locale/dummy/SDL_syslocale.c              |   2 +-
 src/locale/emscripten/SDL_syslocale.c         |   4 +-
 src/locale/haiku/SDL_syslocale.cc             |   4 +-
 src/locale/macos/SDL_syslocale.m              |   4 +-
 src/locale/n3ds/SDL_syslocale.c               |   4 +-
 src/locale/unix/SDL_syslocale.c               |   6 +-
 src/locale/vita/SDL_syslocale.c               |   4 +-
 src/locale/windows/SDL_syslocale.c            |  18 +-
 src/locale/winrt/SDL_syslocale.c              |  18 +-
 src/main/SDL_main_callbacks.c                 |   8 +-
 src/main/gdk/SDL_sysmain_runapp.cpp           |   4 +-
 src/main/winrt/SDL_sysmain_runapp.cpp         |   9 +-
 src/misc/SDL_sysurl.h                         |   2 +-
 src/misc/SDL_url.c                            |   2 +-
 src/misc/android/SDL_sysurl.c                 |   2 +-
 src/misc/dummy/SDL_sysurl.c                   |   2 +-
 src/misc/emscripten/SDL_sysurl.c              |   4 +-
 src/misc/haiku/SDL_sysurl.cc                  |   7 +-
 src/misc/ios/SDL_sysurl.m                     |   4 +-
 src/misc/macos/SDL_sysurl.m                   |   7 +-
 src/misc/riscos/SDL_sysurl.c                  |   7 +-
 src/misc/unix/SDL_sysurl.c                    |   4 +-
 src/misc/vita/SDL_sysurl.c                    |   4 +-
 src/misc/windows/SDL_sysurl.c                 |  11 +-
 src/misc/winrt/SDL_sysurl.cpp                 |   6 +-
 src/power/SDL_power.c                         |   6 +-
 src/power/linux/SDL_syspower.c                |   6 +-
 src/power/n3ds/SDL_syspower.c                 |  14 +-
 src/render/SDL_render.c                       | 935 +++++++++---------
 src/render/SDL_sysrender.h                    |  42 +-
 src/render/SDL_yuv_sw.c                       |  41 +-
 src/render/SDL_yuv_sw_c.h                     |  33 +-
 src/render/direct3d/SDL_render_d3d.c          | 208 ++--
 src/render/direct3d11/SDL_render_d3d11.c      | 156 +--
 src/render/direct3d11/SDL_shaders_d3d11.c     |   8 +-
 src/render/direct3d11/SDL_shaders_d3d11.h     |   4 +-
 src/render/direct3d12/SDL_render_d3d12.c      | 166 ++--
 .../direct3d12/SDL_render_d3d12_xbox.cpp      |  20 +-
 .../direct3d12/SDL_shaders_d3d12_xboxone.cpp  |  16 +-
 .../SDL_shaders_d3d12_xboxseries.cpp          |  16 +-
 src/render/metal/SDL_render_metal.m           | 126 +--
 src/render/opengl/SDL_render_gl.c             | 152 ++-
 src/render/opengles2/SDL_render_gles2.c       | 208 ++--
 src/render/ps2/SDL_render_ps2.c               |  88 +-
 src/render/psp/SDL_render_psp.c               | 142 +--
 src/render/software/SDL_blendfillrect.c       |  43 +-
 src/render/software/SDL_blendfillrect.h       |   4 +-
 src/render/software/SDL_blendline.c           |  12 +-
 src/render/software/SDL_blendline.h           |   4 +-
 src/render/software/SDL_blendpoint.c          |  43 +-
 src/render/software/SDL_blendpoint.h          |   4 +-
 src/render/software/SDL_drawline.c            |  11 +-
 src/render/software/SDL_drawline.h            |   4 +-
 src/render/software/SDL_drawpoint.c           |  11 +-
 src/render/software/SDL_drawpoint.h           |   4 +-
 src/render/software/SDL_render_sw.c           | 140 +--
 src/render/software/SDL_render_sw_c.h         |   2 +-
 src/render/software/SDL_rotate.c              |   4 +-
 src/render/software/SDL_triangle.c            |  58 +-
 src/render/software/SDL_triangle.h            |  21 +-
 src/render/vitagxm/SDL_render_vita_gxm.c      | 108 +-
 src/render/vulkan/SDL_render_vulkan.c         | 158 +--
 src/sensor/SDL_sensor.c                       |  68 +-
 src/sensor/SDL_sensor_c.h                     |   4 +-
 src/sensor/SDL_syssensor.h                    |   4 +-
 src/sensor/android/SDL_androidsensor.c        |  22 +-
 src/sensor/coremotion/SDL_coremotionsensor.m  |  12 +-
 src/sensor/dummy/SDL_dummysensor.c            |   6 +-
 src/sensor/n3ds/SDL_n3dssensor.c              |  22 +-
 src/sensor/vita/SDL_vitasensor.c              |  12 +-
 src/sensor/windows/SDL_windowssensor.c        |  26 +-
 src/stdlib/SDL_getenv.c                       |   6 +-
 src/stdlib/SDL_malloc.c                       |  10 +-
 src/stdlib/SDL_stdlib.c                       |  10 +-
 src/stdlib/SDL_string.c                       | 116 +--
 src/storage/SDL_storage.c                     |  50 +-
 src/storage/generic/SDL_genericstorage.c      |  40 +-
 src/storage/steam/SDL_steamstorage.c          |  20 +-
 src/test/SDL_test_common.c                    |  22 +-
 src/test/SDL_test_compare.c                   |   4 +-
 src/test/SDL_test_font.c                      |  20 +-
 src/test/SDL_test_harness.c                   |   4 +-
 src/thread/SDL_systhread.h                    |  10 +-
 src/thread/SDL_thread.c                       |  37 +-
 src/thread/SDL_thread_c.h                     |   2 +-
 src/thread/generic/SDL_syscond.c              |  34 +-
 src/thread/generic/SDL_syscond_c.h            |   6 +-
 src/thread/generic/SDL_sysmutex.c             |  14 +-
 src/thread/generic/SDL_sysrwlock.c            |  36 +-
 src/thread/generic/SDL_sysrwlock_c.h          |   4 +-
 src/thread/generic/SDL_syssem.c               |  69 +-
 src/thread/generic/SDL_systhread.c            |  10 +-
 src/thread/generic/SDL_systls.c               |   2 +-
 src/thread/n3ds/SDL_syscond.c                 |  21 +-
 src/thread/n3ds/SDL_sysmutex.c                |  11 +-
 src/thread/n3ds/SDL_syssem.c                  |  59 +-
 src/thread/n3ds/SDL_systhread.c               |  15 +-
 src/thread/ngage/SDL_sysmutex.cpp             |  16 +-
 src/thread/ngage/SDL_syssem.cpp               |  23 +-
 src/thread/ngage/SDL_systhread.cpp            |  12 +-
 src/thread/ps2/SDL_syssem.c                   |  34 +-
 src/thread/ps2/SDL_systhread.c                |  18 +-
 src/thread/psp/SDL_sysmutex.c                 |  26 +-
 src/thread/psp/SDL_syssem.c                   |  44 +-
 src/thread/psp/SDL_systhread.c                |  15 +-
 src/thread/pthread/SDL_syscond.c              |  51 +-
 src/thread/pthread/SDL_sysmutex.c             |  34 +-
 src/thread/pthread/SDL_sysrwlock.c            |  28 +-
 src/thread/pthread/SDL_syssem.c               |  62 +-
 src/thread/pthread/SDL_systhread.c            |  14 +-
 src/thread/pthread/SDL_systls.c               |   4 +-
 src/thread/stdcpp/SDL_syscond.cpp             |  68 +-
 src/thread/stdcpp/SDL_sysmutex.cpp            |  26 +-
 src/thread/stdcpp/SDL_sysrwlock.cpp           |  38 +-
 src/thread/stdcpp/SDL_systhread.cpp           |  32 +-
 src/thread/vita/SDL_sysmutex.c                |  39 +-
 src/thread/vita/SDL_syssem.c                  |  41 +-
 src/thread/vita/SDL_systhread.c               |  15 +-
 src/thread/windows/SDL_syscond_cv.c           |  84 +-
 src/thread/windows/SDL_sysmutex.c             |  19 +-
 src/thread/windows/SDL_sysmutex_c.h           |   2 +-
 src/thread/windows/SDL_sysrwlock_srw.c        |  73 +-
 src/thread/windows/SDL_syssem.c               |  71 +-
 src/thread/windows/SDL_systhread.c            |  12 +-
 src/thread/windows/SDL_systls.c               |   4 +-
 src/time/SDL_time.c                           |  29 +-
 src/time/n3ds/SDL_systime.c                   |   8 +-
 src/time/ps2/SDL_systime.c                    |   8 +-
 src/time/psp/SDL_systime.c                    |   8 +-
 src/time/unix/SDL_systime.c                   |  14 +-
 src/time/vita/SDL_systime.c                   |   8 +-
 src/time/windows/SDL_systime.c                |   8 +-
 src/timer/SDL_timer.c                         |  36 +-
 src/timer/SDL_timer_c.h                       |   2 +-
 src/video/SDL_RLEaccel.c                      |  70 +-
 src/video/SDL_RLEaccel_c.h                    |   2 +-
 src/video/SDL_blit.c                          |  24 +-
 src/video/SDL_blit.h                          |   4 +-
 src/video/SDL_bmp.c                           |  14 +-
 src/video/SDL_clipboard.c                     |  32 +-
 src/video/SDL_egl.c                           |  84 +-
 src/video/SDL_egl_c.h                         |  36 +-
 src/video/SDL_fillrect.c                      |  13 +-
 src/video/SDL_pixels.c                        |  47 +-
 src/video/SDL_pixels_c.h                      |   6 +-
 src/video/SDL_rect_impl.h                     |   8 +-
 src/video/SDL_stretch.c                       | 101 +-
 src/video/SDL_surface.c                       | 356 ++++---
 src/video/SDL_surface_c.h                     |   2 +-
 src/video/SDL_sysvideo.h                      |  99 +-
 src/video/SDL_video.c                         | 766 +++++++-------
 src/video/SDL_video_c.h                       |   8 +-
 src/video/SDL_video_unsupported.c             |  22 +-
 src/video/SDL_vulkan_internal.h               |   8 +-
 src/video/SDL_vulkan_utils.c                  |  98 +-
 src/video/SDL_yuv.c                           | 305 +++---
 src/video/SDL_yuv_c.h                         |   8 +-
 src/video/android/SDL_androidclipboard.c      |   2 +-
 src/video/android/SDL_androidclipboard.h      |   2 +-
 src/video/android/SDL_androidevents.c         |  10 +-
 src/video/android/SDL_androidevents.h         |   2 +-
 src/video/android/SDL_androidgl.c             |  20 +-
 src/video/android/SDL_androidgl.h             |   8 +-
 src/video/android/SDL_androidkeyboard.c       |   8 +-
 src/video/android/SDL_androidkeyboard.h       |   4 +-
 src/video/android/SDL_androidmessagebox.c     |   2 +-
 src/video/android/SDL_androidmessagebox.h     |   2 +-
 src/video/android/SDL_androidmouse.c          |  10 +-
 src/video/android/SDL_androidvideo.c          |  14 +-
 src/video/android/SDL_androidvulkan.c         |  14 +-
 src/video/android/SDL_androidvulkan.h         |  25 +-
 src/video/android/SDL_androidwindow.c         |  23 +-
 src/video/android/SDL_androidwindow.h         |   4 +-
 src/video/cocoa/SDL_cocoaclipboard.h          |   5 +-
 src/video/cocoa/SDL_cocoaclipboard.m          |   4 +-
 src/video/cocoa/SDL_cocoaevents.h             |   2 +-
 src/video/cocoa/SDL_cocoaevents.m             |   4 +-
 src/video/cocoa/SD

(Patch may be truncated, please check the link at the top of this post.)