Pārlūkot izejas kodu

Change return type from void to int, for functions that set an error
(SDL_SetError(), SDL_OutOfMemory(), SDL_Unsupported(), SDL_InvalidParam())

Update prototype to forward errors to generic layer, for the functions:
MoveCursor, WarpMouse, GL_DeleteContext, GetDisplayModes.

Check invalid parameter in SDL_SetTextInputRect() generic layer.

Sylvain 2 gadi atpakaļ
vecāks
revīzija
c5c94a6be6
100 mainītis faili ar 471 papildinājumiem un 388 dzēšanām
  1. 3 1
      include/SDL3/SDL_audio.h
  2. 3 1
      include/SDL3/SDL_hidapi.h
  3. 6 2
      include/SDL3/SDL_joystick.h
  4. 3 1
      include/SDL3/SDL_keyboard.h
  5. 3 1
      include/SDL3/SDL_mouse.h
  6. 6 2
      include/SDL3/SDL_pixels.h
  7. 6 2
      include/SDL3/SDL_rect.h
  8. 13 4
      include/SDL3/SDL_render.h
  9. 60 20
      include/SDL3/SDL_video.h
  10. 3 3
      src/audio/SDL_audiocvt.c
  11. 5 4
      src/audio/SDL_mixer.c
  12. 4 4
      src/core/linux/SDL_udev.c
  13. 1 1
      src/core/linux/SDL_udev.h
  14. 34 34
      src/dynapi/SDL_dynapi_procs.h
  15. 4 4
      src/events/SDL_mouse.c
  16. 2 2
      src/events/SDL_mouse_c.h
  17. 3 2
      src/hidapi/SDL_hidapi.c
  18. 9 12
      src/joystick/SDL_gamepad.c
  19. 7 5
      src/joystick/SDL_joystick.c
  20. 9 10
      src/joystick/windows/SDL_rawinputjoystick.c
  21. 1 1
      src/joystick/windows/SDL_rawinputjoystick_c.h
  22. 1 1
      src/locale/SDL_syslocale.h
  23. 2 1
      src/locale/android/SDL_syslocale.c
  24. 2 2
      src/locale/dummy/SDL_syslocale.c
  25. 2 1
      src/locale/emscripten/SDL_syslocale.c
  26. 4 5
      src/locale/haiku/SDL_syslocale.cc
  27. 2 1
      src/locale/macos/SDL_syslocale.m
  28. 2 1
      src/locale/n3ds/SDL_syslocale.c
  29. 3 3
      src/locale/unix/SDL_syslocale.c
  30. 2 1
      src/locale/vita/SDL_syslocale.c
  31. 5 4
      src/locale/windows/SDL_syslocale.c
  32. 2 1
      src/locale/winrt/SDL_syslocale.c
  33. 15 11
      src/render/SDL_render.c
  34. 3 2
      src/video/SDL_egl.c
  35. 1 1
      src/video/SDL_egl_c.h
  36. 8 8
      src/video/SDL_pixels.c
  37. 7 9
      src/video/SDL_rect_impl.h
  38. 3 3
      src/video/SDL_sysvideo.h
  39. 80 53
      src/video/SDL_video.c
  40. 2 7
      src/video/android/SDL_androidkeyboard.c
  41. 1 1
      src/video/android/SDL_androidkeyboard.h
  42. 1 1
      src/video/cocoa/SDL_cocoakeyboard.h
  43. 2 7
      src/video/cocoa/SDL_cocoakeyboard.m
  44. 1 1
      src/video/cocoa/SDL_cocoamodes.h
  45. 2 1
      src/video/cocoa/SDL_cocoamodes.m
  46. 2 2
      src/video/cocoa/SDL_cocoamouse.m
  47. 1 1
      src/video/cocoa/SDL_cocoaopengl.h
  48. 2 1
      src/video/cocoa/SDL_cocoaopengl.m
  49. 1 1
      src/video/cocoa/SDL_cocoaopengles.h
  50. 2 1
      src/video/cocoa/SDL_cocoaopengles.m
  51. 2 1
      src/video/emscripten/SDL_emscriptenopengles.c
  52. 1 1
      src/video/emscripten/SDL_emscriptenopengles.h
  53. 2 1
      src/video/haiku/SDL_bmodes.cc
  54. 1 1
      src/video/haiku/SDL_bmodes.h
  55. 2 1
      src/video/haiku/SDL_bopengl.cc
  56. 1 1
      src/video/haiku/SDL_bopengl.h
  57. 13 16
      src/video/kmsdrm/SDL_kmsdrmmouse.c
  58. 1 1
      src/video/kmsdrm/SDL_kmsdrmmouse.h
  59. 2 1
      src/video/kmsdrm/SDL_kmsdrmvideo.c
  60. 2 2
      src/video/kmsdrm/SDL_kmsdrmvideo.h
  61. 4 4
      src/video/n3ds/SDL_n3dsvideo.c
  62. 4 5
      src/video/psp/SDL_pspevents.c
  63. 4 7
      src/video/psp/SDL_pspgl.c
  64. 2 1
      src/video/psp/SDL_pspvideo.c
  65. 2 2
      src/video/psp/SDL_pspvideo.h
  66. 5 5
      src/video/raspberry/SDL_rpimouse.c
  67. 2 2
      src/video/raspberry/SDL_rpivideo.h
  68. 7 9
      src/video/riscos/SDL_riscosmodes.c
  69. 1 1
      src/video/riscos/SDL_riscosmodes.h
  70. 1 1
      src/video/uikit/SDL_uikitmodes.h
  71. 2 1
      src/video/uikit/SDL_uikitmodes.m
  72. 1 1
      src/video/uikit/SDL_uikitopengles.h
  73. 2 1
      src/video/uikit/SDL_uikitopengles.m
  74. 1 1
      src/video/uikit/SDL_uikitviewcontroller.h
  75. 2 6
      src/video/uikit/SDL_uikitviewcontroller.m
  76. 4 6
      src/video/vita/SDL_vitagles.c
  77. 2 2
      src/video/vita/SDL_vitavideo.h
  78. 1 1
      src/video/vivante/SDL_vivantevideo.h
  79. 2 7
      src/video/wayland/SDL_waylandkeyboard.c
  80. 1 1
      src/video/wayland/SDL_waylandkeyboard.h
  81. 4 3
      src/video/wayland/SDL_waylandmouse.c
  82. 2 1
      src/video/wayland/SDL_waylandopengles.c
  83. 1 1
      src/video/wayland/SDL_waylandopengles.h
  84. 3 3
      src/video/wayland/SDL_waylandvideo.c
  85. 9 13
      src/video/windows/SDL_windowskeyboard.c
  86. 1 1
      src/video/windows/SDL_windowskeyboard.h
  87. 2 1
      src/video/windows/SDL_windowsmodes.c
  88. 1 1
      src/video/windows/SDL_windowsmodes.h
  89. 3 2
      src/video/windows/SDL_windowsmouse.c
  90. 3 2
      src/video/windows/SDL_windowsopengl.c
  91. 1 1
      src/video/windows/SDL_windowsopengl.h
  92. 2 1
      src/video/windows/SDL_windowsopengles.c
  93. 1 1
      src/video/windows/SDL_windowsopengles.h
  94. 2 6
      src/video/x11/SDL_x11keyboard.c
  95. 1 1
      src/video/x11/SDL_x11keyboard.h
  96. 2 2
      src/video/x11/SDL_x11modes.c
  97. 1 1
      src/video/x11/SDL_x11modes.h
  98. 3 4
      src/video/x11/SDL_x11mouse.c
  99. 5 4
      src/video/x11/SDL_x11opengl.c
  100. 1 1
      src/video/x11/SDL_x11opengl.h

+ 3 - 1
include/SDL3/SDL_audio.h

@@ -851,10 +851,12 @@ extern DECLSPEC void SDLCALL SDL_DestroyAudioStream(SDL_AudioStream *stream);
  * \param len the length of the audio buffer in bytes
  * \param volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME
  *               for full audio volume
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
  *
  * \since This function is available since SDL 3.0.0.
  */
-extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst,
+extern DECLSPEC int SDLCALL SDL_MixAudioFormat(Uint8 * dst,
                                                 const Uint8 * src,
                                                 SDL_AudioFormat format,
                                                 Uint32 len, int volume);

+ 3 - 1
include/SDL3/SDL_hidapi.h

@@ -377,10 +377,12 @@ extern DECLSPEC int SDLCALL SDL_hid_get_feature_report(SDL_hid_device *dev, unsi
  * Close a HID device.
  *
  * \param dev A device handle returned from SDL_hid_open().
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
  *
  * \since This function is available since SDL 3.0.0.
  */
-extern DECLSPEC void SDLCALL SDL_hid_close(SDL_hid_device *dev);
+extern DECLSPEC int SDLCALL SDL_hid_close(SDL_hid_device *dev);
 
 /**
  * Get The Manufacturer String from a HID device.

+ 6 - 2
include/SDL3/SDL_joystick.h

@@ -493,10 +493,12 @@ extern DECLSPEC int SDLCALL SDL_GetJoystickPlayerIndex(SDL_Joystick *joystick);
  * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick()
  * \param player_index Player index to assign to this joystick, or -1 to clear
  *                     the player index and turn off player LEDs.
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
  *
  * \since This function is available since SDL 3.0.0.
  */
-extern DECLSPEC void SDLCALL SDL_SetJoystickPlayerIndex(SDL_Joystick *joystick, int player_index);
+extern DECLSPEC int SDLCALL SDL_SetJoystickPlayerIndex(SDL_Joystick *joystick, int player_index);
 
 /**
  * Get the implementation-dependent GUID for the joystick.
@@ -966,12 +968,14 @@ extern DECLSPEC int SDLCALL SDL_SendJoystickEffect(SDL_Joystick *joystick, const
  * Close a joystick previously opened with SDL_OpenJoystick().
  *
  * \param joystick The joystick device to close
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
  *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_OpenJoystick
  */
-extern DECLSPEC void SDLCALL SDL_CloseJoystick(SDL_Joystick *joystick);
+extern DECLSPEC int SDLCALL SDL_CloseJoystick(SDL_Joystick *joystick);
 
 /**
  * Get the battery level of a joystick as SDL_JoystickPowerLevel.

+ 3 - 1
include/SDL3/SDL_keyboard.h

@@ -310,12 +310,14 @@ extern DECLSPEC SDL_bool SDLCALL SDL_TextInputShown(void);
  *
  * \param rect the SDL_Rect structure representing the rectangle to receive
  *             text (ignored if NULL)
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
  *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_StartTextInput
  */
-extern DECLSPEC void SDLCALL SDL_SetTextInputRect(const SDL_Rect *rect);
+extern DECLSPEC int SDLCALL SDL_SetTextInputRect(const SDL_Rect *rect);
 
 /**
  * Check whether the platform has screen keyboard support.

+ 3 - 1
include/SDL3/SDL_mouse.h

@@ -364,13 +364,15 @@ extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateSystemCursor(SDL_SystemCursor id);
  * this is desired for any reason.
  *
  * \param cursor a cursor to make active
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
  *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_CreateCursor
  * \sa SDL_GetCursor
  */
-extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor * cursor);
+extern DECLSPEC int SDLCALL SDL_SetCursor(SDL_Cursor * cursor);
 
 /**
  * Get the active cursor.

+ 6 - 2
include/SDL3/SDL_pixels.h

@@ -416,12 +416,14 @@ extern DECLSPEC SDL_PixelFormat * SDLCALL SDL_CreatePixelFormat(Uint32 pixel_for
  * Free an SDL_PixelFormat structure allocated by SDL_CreatePixelFormat().
  *
  * \param format the SDL_PixelFormat structure to free
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
  *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_CreatePixelFormat
  */
-extern DECLSPEC void SDLCALL SDL_DestroyPixelFormat(SDL_PixelFormat *format);
+extern DECLSPEC int SDLCALL SDL_DestroyPixelFormat(SDL_PixelFormat *format);
 
 /**
  * Create a palette structure with the specified number of color entries.
@@ -478,12 +480,14 @@ extern DECLSPEC int SDLCALL SDL_SetPaletteColors(SDL_Palette * palette,
  * Free a palette created with SDL_CreatePalette().
  *
  * \param palette the SDL_Palette structure to be freed
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
  *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_CreatePalette
  */
-extern DECLSPEC void SDLCALL SDL_DestroyPalette(SDL_Palette * palette);
+extern DECLSPEC int SDLCALL SDL_DestroyPalette(SDL_Palette * palette);
 
 /**
  * Map an RGB triple to an opaque pixel value for a given pixel format.

+ 6 - 2
include/SDL3/SDL_rect.h

@@ -172,10 +172,12 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetRectIntersection(const SDL_Rect * A,
  * \param B an SDL_Rect structure representing the second rectangle
  * \param result an SDL_Rect structure filled in with the union of rectangles
  *               `A` and `B`
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
  *
  * \since This function is available since SDL 3.0.0.
  */
-extern DECLSPEC void SDLCALL SDL_GetRectUnion(const SDL_Rect * A,
+extern DECLSPEC int SDLCALL SDL_GetRectUnion(const SDL_Rect * A,
                                            const SDL_Rect * B,
                                            SDL_Rect * result);
 
@@ -311,10 +313,12 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetRectIntersectionFloat(const SDL_FRect *
  * \param B an SDL_FRect structure representing the second rectangle
  * \param result an SDL_FRect structure filled in with the union of rectangles
  *               `A` and `B`
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
  *
  * \since This function is available since SDL 3.0.0.
  */
-extern DECLSPEC void SDLCALL SDL_GetRectUnionFloat(const SDL_FRect * A,
+extern DECLSPEC int SDLCALL SDL_GetRectUnionFloat(const SDL_FRect * A,
                                             const SDL_FRect * B,
                                             SDL_FRect * result);
 

+ 13 - 4
include/SDL3/SDL_render.h

@@ -783,11 +783,14 @@ extern DECLSPEC int SDLCALL SDL_LockTextureToSurface(SDL_Texture *texture,
  *
  * \param texture a texture locked by SDL_LockTexture()
  *
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_LockTexture
  */
-extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture *texture);
+extern DECLSPEC int SDLCALL SDL_UnlockTexture(SDL_Texture *texture);
 
 /**
  * Set a texture as the current rendering target.
@@ -1408,6 +1411,8 @@ extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer *renderer,
  * pixel.
  *
  * \param renderer the rendering context
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
  *
  * \threadsafety You may only call this function on the main thread.
  *
@@ -1425,7 +1430,7 @@ extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer *renderer,
  * \sa SDL_SetRenderDrawBlendMode
  * \sa SDL_SetRenderDrawColor
  */
-extern DECLSPEC void SDLCALL SDL_RenderPresent(SDL_Renderer *renderer);
+extern DECLSPEC int SDLCALL SDL_RenderPresent(SDL_Renderer *renderer);
 
 /**
  * Destroy the specified texture.
@@ -1434,13 +1439,15 @@ extern DECLSPEC void SDLCALL SDL_RenderPresent(SDL_Renderer *renderer);
  * to "Invalid texture".
  *
  * \param texture the texture to destroy
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
  *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_CreateTexture
  * \sa SDL_CreateTextureFromSurface
  */
-extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture *texture);
+extern DECLSPEC int SDLCALL SDL_DestroyTexture(SDL_Texture *texture);
 
 /**
  * Destroy the rendering context for a window and free associated textures.
@@ -1449,12 +1456,14 @@ extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture *texture);
  * the SDL error message to "Invalid renderer". See SDL_GetError().
  *
  * \param renderer the rendering context
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
  *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_CreateRenderer
  */
-extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer *renderer);
+extern DECLSPEC int SDLCALL SDL_DestroyRenderer(SDL_Renderer *renderer);
 
 /**
  * Force the rendering context to flush any pending commands to the underlying

+ 60 - 20
include/SDL3/SDL_video.h

@@ -821,12 +821,14 @@ extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window *window, const char *
  *          `SDL_WINDOWPOS_UNDEFINED`
  * \param y the y coordinate of the window, or `SDL_WINDOWPOS_CENTERED` or
  *          `SDL_WINDOWPOS_UNDEFINED`
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
  *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_GetWindowPosition
  */
-extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window *window, int x, int y);
+extern DECLSPEC int SDLCALL SDL_SetWindowPosition(SDL_Window *window, int x, int y);
 
 /**
  * Get the position of a window, in screen coordinates.
@@ -837,12 +839,14 @@ extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window *window, int x, in
  * \param window the window to query
  * \param x a pointer filled in with the x position of the window, may be NULL
  * \param y a pointer filled in with the y position of the window, may be NULL
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
  *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_SetWindowPosition
  */
-extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window *window, int *x, int *y);
+extern DECLSPEC int SDLCALL SDL_GetWindowPosition(SDL_Window *window, int *x, int *y);
 
 /**
  * Set the size of a window's client area, in screen coordinates.
@@ -880,6 +884,8 @@ extern DECLSPEC int SDLCALL SDL_SetWindowSize(SDL_Window *window, int w, int h);
  * \param window the window to query the width and height from
  * \param w a pointer filled in with the width of the window, may be NULL
  * \param h a pointer filled in with the height of the window, may be NULL
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
  *
  * \since This function is available since SDL 3.0.0.
  *
@@ -887,7 +893,7 @@ extern DECLSPEC int SDLCALL SDL_SetWindowSize(SDL_Window *window, int w, int h);
  * \sa SDL_GetWindowSizeInPixels
  * \sa SDL_SetWindowSize
  */
-extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window *window, int *w, int *h);
+extern DECLSPEC int SDLCALL SDL_GetWindowSize(SDL_Window *window, int *w, int *h);
 
 /**
  * Get the size of a window's borders (decorations) around the client area, in
@@ -934,13 +940,15 @@ extern DECLSPEC int SDLCALL SDL_GetWindowBordersSize(SDL_Window *window, int *to
  * \param w a pointer to variable for storing the width in pixels, may be NULL
  * \param h a pointer to variable for storing the height in pixels, may be
  *          NULL
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
  *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_CreateWindow
  * \sa SDL_GetWindowSize
  */
-extern DECLSPEC void SDLCALL SDL_GetWindowSizeInPixels(SDL_Window *window, int *w, int *h);
+extern DECLSPEC int SDLCALL SDL_GetWindowSizeInPixels(SDL_Window *window, int *w, int *h);
 
 /**
  * Set the minimum size of a window's client area, in screen coordinates.
@@ -966,13 +974,15 @@ extern DECLSPEC int SDLCALL SDL_SetWindowMinimumSize(SDL_Window *window, int min
  *          NULL
  * \param h a pointer filled in with the minimum height of the window, may be
  *          NULL
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
  *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_GetWindowMaximumSize
  * \sa SDL_SetWindowMinimumSize
  */
-extern DECLSPEC void SDLCALL SDL_GetWindowMinimumSize(SDL_Window *window, int *w, int *h);
+extern DECLSPEC int SDLCALL SDL_GetWindowMinimumSize(SDL_Window *window, int *w, int *h);
 
 /**
  * Set the maximum size of a window's client area, in screen coordinates.
@@ -998,13 +1008,15 @@ extern DECLSPEC int SDLCALL SDL_SetWindowMaximumSize(SDL_Window *window, int max
  *          NULL
  * \param h a pointer filled in with the maximum height of the window, may be
  *          NULL
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
  *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_GetWindowMinimumSize
  * \sa SDL_SetWindowMaximumSize
  */
-extern DECLSPEC void SDLCALL SDL_GetWindowMaximumSize(SDL_Window *window, int *w, int *h);
+extern DECLSPEC int SDLCALL SDL_GetWindowMaximumSize(SDL_Window *window, int *w, int *h);
 
 /**
  * Set the border state of a window.
@@ -1017,12 +1029,14 @@ extern DECLSPEC void SDLCALL SDL_GetWindowMaximumSize(SDL_Window *window, int *w
  *
  * \param window the window of which to change the border state
  * \param bordered SDL_FALSE to remove border, SDL_TRUE to add border
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
  *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_GetWindowFlags
  */
-extern DECLSPEC void SDLCALL SDL_SetWindowBordered(SDL_Window *window, SDL_bool bordered);
+extern DECLSPEC int SDLCALL SDL_SetWindowBordered(SDL_Window *window, SDL_bool bordered);
 
 /**
  * Set the user-resizable state of a window.
@@ -1035,12 +1049,14 @@ extern DECLSPEC void SDLCALL SDL_SetWindowBordered(SDL_Window *window, SDL_bool
  *
  * \param window the window of which to change the resizable state
  * \param resizable SDL_TRUE to allow resizing, SDL_FALSE to disallow
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
  *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_GetWindowFlags
  */
-extern DECLSPEC void SDLCALL SDL_SetWindowResizable(SDL_Window *window, SDL_bool resizable);
+extern DECLSPEC int SDLCALL SDL_SetWindowResizable(SDL_Window *window, SDL_bool resizable);
 
 /**
  * Set the window to always be above the others.
@@ -1051,80 +1067,94 @@ extern DECLSPEC void SDLCALL SDL_SetWindowResizable(SDL_Window *window, SDL_bool
  * \param window The window of which to change the always on top state
  * \param on_top SDL_TRUE to set the window always on top, SDL_FALSE to
  *               disable
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
  *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_GetWindowFlags
  */
-extern DECLSPEC void SDLCALL SDL_SetWindowAlwaysOnTop(SDL_Window *window, SDL_bool on_top);
+extern DECLSPEC int SDLCALL SDL_SetWindowAlwaysOnTop(SDL_Window *window, SDL_bool on_top);
 
 /**
  * Show a window.
  *
  * \param window the window to show
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
  *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_HideWindow
  * \sa SDL_RaiseWindow
  */
-extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_Window *window);
+extern DECLSPEC int SDLCALL SDL_ShowWindow(SDL_Window *window);
 
 /**
  * Hide a window.
  *
  * \param window the window to hide
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
  *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_ShowWindow
  */
-extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_Window *window);
+extern DECLSPEC int SDLCALL SDL_HideWindow(SDL_Window *window);
 
 /**
  * Raise a window above other windows and set the input focus.
  *
  * \param window the window to raise
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
  *
  * \since This function is available since SDL 3.0.0.
  */
-extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_Window *window);
+extern DECLSPEC int SDLCALL SDL_RaiseWindow(SDL_Window *window);
 
 /**
  * Make a window as large as possible.
  *
  * \param window the window to maximize
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
  *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_MinimizeWindow
  * \sa SDL_RestoreWindow
  */
-extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_Window *window);
+extern DECLSPEC int SDLCALL SDL_MaximizeWindow(SDL_Window *window);
 
 /**
  * Minimize a window to an iconic representation.
  *
  * \param window the window to minimize
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
  *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_MaximizeWindow
  * \sa SDL_RestoreWindow
  */
-extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_Window *window);
+extern DECLSPEC int SDLCALL SDL_MinimizeWindow(SDL_Window *window);
 
 /**
  * Restore the size and position of a minimized or maximized window.
  *
  * \param window the window to restore
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
  *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_MaximizeWindow
  * \sa SDL_MinimizeWindow
  */
-extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_Window *window);
+extern DECLSPEC int SDLCALL SDL_RestoreWindow(SDL_Window *window);
 
 /**
  * Set a window's fullscreen state.
@@ -1222,13 +1252,15 @@ extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window *window, con
  *
  * \param window the window for which the input grab mode should be set
  * \param grabbed SDL_TRUE to grab input or SDL_FALSE to release input
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
  *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_GetGrabbedWindow
  * \sa SDL_GetWindowGrab
  */
-extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window *window, SDL_bool grabbed);
+extern DECLSPEC int SDLCALL SDL_SetWindowGrab(SDL_Window *window, SDL_bool grabbed);
 
 /**
  * Set a window's keyboard grab mode.
@@ -1251,6 +1283,8 @@ extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window *window, SDL_bool grab
  *
  * \param window The window for which the keyboard grab mode should be set.
  * \param grabbed This is SDL_TRUE to grab keyboard, and SDL_FALSE to release.
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
  *
  * \since This function is available since SDL 3.0.0.
  *
@@ -1258,7 +1292,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window *window, SDL_bool grab
  * \sa SDL_SetWindowMouseGrab
  * \sa SDL_SetWindowGrab
  */
-extern DECLSPEC void SDLCALL SDL_SetWindowKeyboardGrab(SDL_Window *window, SDL_bool grabbed);
+extern DECLSPEC int SDLCALL SDL_SetWindowKeyboardGrab(SDL_Window *window, SDL_bool grabbed);
 
 /**
  * Set a window's mouse grab mode.
@@ -1267,6 +1301,8 @@ extern DECLSPEC void SDLCALL SDL_SetWindowKeyboardGrab(SDL_Window *window, SDL_b
  *
  * \param window The window for which the mouse grab mode should be set.
  * \param grabbed This is SDL_TRUE to grab mouse, and SDL_FALSE to release.
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
  *
  * \since This function is available since SDL 3.0.0.
  *
@@ -1274,7 +1310,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowKeyboardGrab(SDL_Window *window, SDL_b
  * \sa SDL_SetWindowKeyboardGrab
  * \sa SDL_SetWindowGrab
  */
-extern DECLSPEC void SDLCALL SDL_SetWindowMouseGrab(SDL_Window *window, SDL_bool grabbed);
+extern DECLSPEC int SDLCALL SDL_SetWindowMouseGrab(SDL_Window *window, SDL_bool grabbed);
 
 /**
  * Get a window's input grab mode.
@@ -1521,13 +1557,15 @@ extern DECLSPEC int SDLCALL SDL_FlashWindow(SDL_Window *window, SDL_FlashOperati
  * the SDL error message to "Invalid window". See SDL_GetError().
  *
  * \param window the window to destroy
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
  *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_CreateWindow
  * \sa SDL_CreateWindowFrom
  */
-extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window *window);
+extern DECLSPEC int SDLCALL SDL_DestroyWindow(SDL_Window *window);
 
 
 /**
@@ -1933,12 +1971,14 @@ extern DECLSPEC int SDLCALL SDL_GL_SwapWindow(SDL_Window *window);
  * Delete an OpenGL context.
  *
  * \param context the OpenGL context to be deleted
+ * \returns 0 on success or a negative error code on failure; call
+ *          SDL_GetError() for more information.
  *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_GL_CreateContext
  */
-extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context);
+extern DECLSPEC int SDLCALL SDL_GL_DeleteContext(SDL_GLContext context);
 
 /* @} *//* OpenGL support functions */
 

+ 3 - 3
src/audio/SDL_audiocvt.c

@@ -564,7 +564,7 @@ static void SDL_ResampleCVT_SRC(SDL_AudioCVT *cvt, const int chans, const SDL_Au
 
 #endif /* HAVE_LIBSAMPLERATE_H */
 
-static void SDL_ResampleCVT(SDL_AudioCVT *cvt, const int chans, const SDL_AudioFormat format)
+static int SDL_ResampleCVT(SDL_AudioCVT *cvt, const int chans, const SDL_AudioFormat format)
 {
     /* !!! FIXME in 2.1: there are ten slots in the filter list, and the theoretical maximum we use is six (seven with NULL terminator).
        !!! FIXME in 2.1:   We need to store data for this resampler, because the cvt structure doesn't store the original sample rates,
@@ -592,8 +592,7 @@ static void SDL_ResampleCVT(SDL_AudioCVT *cvt, const int chans, const SDL_AudioF
     /* we keep no streaming state here, so pad with silence on both ends. */
     padding = (float *)SDL_calloc(paddingsamples ? paddingsamples : 1, sizeof(float));
     if (padding == NULL) {
-        SDL_OutOfMemory();
-        return;
+        return SDL_OutOfMemory();
     }
 
     cvt->len_cvt = SDL_ResampleAudio(chans, inrate, outrate, padding, padding, src, srclen, dst, dstlen);
@@ -605,6 +604,7 @@ static void SDL_ResampleCVT(SDL_AudioCVT *cvt, const int chans, const SDL_AudioF
     if (cvt->filters[++cvt->filter_index]) {
         cvt->filters[cvt->filter_index](cvt, format);
     }
+    return 0;
 }
 
 /* !!! FIXME: We only have this macro salsa because SDL_AudioCVT doesn't

+ 5 - 4
src/audio/SDL_mixer.c

@@ -82,11 +82,11 @@ static const Uint8 mix8[] = {
 #define ADJUST_VOLUME_U8(s, v)  ((s) = ((((s) - 128) * (v)) / SDL_MIX_MAXVOLUME) + 128)
 #define ADJUST_VOLUME_U16(s, v) ((s) = ((((s) - 32768) * (v)) / SDL_MIX_MAXVOLUME) + 32768)
 
-void SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format,
+int SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format,
                         Uint32 len, int volume)
 {
     if (volume == 0) {
-        return;
+        return 0;
     }
 
     switch (format) {
@@ -334,7 +334,8 @@ void SDL_MixAudioFormat(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format,
     } break;
 
     default: /* If this happens... FIXME! */
-        SDL_SetError("SDL_MixAudioFormat(): unknown audio format");
-        return;
+        return SDL_SetError("SDL_MixAudioFormat(): unknown audio format");
     }
+
+    return 0;
 }

+ 4 - 4
src/core/linux/SDL_udev.c

@@ -184,21 +184,20 @@ void SDL_UDEV_Quit(void)
     }
 }
 
-void SDL_UDEV_Scan(void)
+int SDL_UDEV_Scan(void)
 {
     struct udev_enumerate *enumerate = NULL;
     struct udev_list_entry *devs = NULL;
     struct udev_list_entry *item = NULL;
 
     if (_this == NULL) {
-        return;
+        return 0;
     }
 
     enumerate = _this->syms.udev_enumerate_new(_this->udev);
     if (enumerate == NULL) {
         SDL_UDEV_Quit();
-        SDL_SetError("udev_enumerate_new() failed");
-        return;
+        return SDL_SetError("udev_enumerate_new() failed");
     }
 
     _this->syms.udev_enumerate_add_match_subsystem(enumerate, "input");
@@ -216,6 +215,7 @@ void SDL_UDEV_Scan(void)
     }
 
     _this->syms.udev_enumerate_unref(enumerate);
+    return 0;
 }
 
 SDL_bool

+ 1 - 1
src/core/linux/SDL_udev.h

@@ -100,7 +100,7 @@ extern void SDL_UDEV_Quit(void);
 extern void SDL_UDEV_UnloadLibrary(void);
 extern int SDL_UDEV_LoadLibrary(void);
 extern void SDL_UDEV_Poll(void);
-extern void SDL_UDEV_Scan(void);
+extern int SDL_UDEV_Scan(void);
 extern SDL_bool SDL_UDEV_GetProductInfo(const char *device_path, Uint16 *vendor, Uint16 *product, Uint16 *version);
 extern int SDL_UDEV_AddCallback(SDL_UDEV_Callback cb);
 extern void SDL_UDEV_DelCallback(SDL_UDEV_Callback cb);

+ 34 - 34
src/dynapi/SDL_dynapi_procs.h

@@ -146,7 +146,7 @@ SDL_DYNAPI_PROC(void,SDL_ClearHints,(void),(),)
 SDL_DYNAPI_PROC(void,SDL_ClearQueuedAudio,(SDL_AudioDeviceID a),(a),)
 SDL_DYNAPI_PROC(void,SDL_CloseAudioDevice,(SDL_AudioDeviceID a),(a),)
 SDL_DYNAPI_PROC(void,SDL_CloseGamepad,(SDL_Gamepad *a),(a),)
-SDL_DYNAPI_PROC(void,SDL_CloseJoystick,(SDL_Joystick *a),(a),)
+SDL_DYNAPI_PROC(int,SDL_CloseJoystick,(SDL_Joystick *a),(a),return)
 SDL_DYNAPI_PROC(void,SDL_CloseSensor,(SDL_Sensor *a),(a),)
 SDL_DYNAPI_PROC(SDL_BlendMode,SDL_ComposeCustomBlendMode,(SDL_BlendFactor a, SDL_BlendFactor b, SDL_BlendOperation c, SDL_BlendFactor d, SDL_BlendFactor e, SDL_BlendOperation f),(a,b,c,d,e,f),return)
 SDL_DYNAPI_PROC(int,SDL_CondBroadcast,(SDL_cond *a),(a),return)
@@ -184,13 +184,13 @@ SDL_DYNAPI_PROC(Uint32,SDL_DequeueAudio,(SDL_AudioDeviceID a, void *b, Uint32 c)
 SDL_DYNAPI_PROC(void,SDL_DestroyAudioStream,(SDL_AudioStream *a),(a),)
 SDL_DYNAPI_PROC(void,SDL_DestroyCond,(SDL_cond *a),(a),)
 SDL_DYNAPI_PROC(void,SDL_DestroyMutex,(SDL_mutex *a),(a),)
-SDL_DYNAPI_PROC(void,SDL_DestroyPalette,(SDL_Palette *a),(a),)
-SDL_DYNAPI_PROC(void,SDL_DestroyPixelFormat,(SDL_PixelFormat *a),(a),)
-SDL_DYNAPI_PROC(void,SDL_DestroyRenderer,(SDL_Renderer *a),(a),)
+SDL_DYNAPI_PROC(int,SDL_DestroyPalette,(SDL_Palette *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_DestroyPixelFormat,(SDL_PixelFormat *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_DestroyRenderer,(SDL_Renderer *a),(a),return)
 SDL_DYNAPI_PROC(void,SDL_DestroySemaphore,(SDL_sem *a),(a),)
 SDL_DYNAPI_PROC(void,SDL_DestroySurface,(SDL_Surface *a),(a),)
-SDL_DYNAPI_PROC(void,SDL_DestroyTexture,(SDL_Texture *a),(a),)
-SDL_DYNAPI_PROC(void,SDL_DestroyWindow,(SDL_Window *a),(a),)
+SDL_DYNAPI_PROC(int,SDL_DestroyTexture,(SDL_Texture *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_DestroyWindow,(SDL_Window *a),(a),return)
 SDL_DYNAPI_PROC(void,SDL_DetachThread,(SDL_Thread *a),(a),)
 SDL_DYNAPI_PROC(int,SDL_DetachVirtualJoystick,(SDL_JoystickID a),(a),return)
 SDL_DYNAPI_PROC(void,SDL_DisableScreenSaver,(void),(),)
@@ -214,7 +214,7 @@ SDL_DYNAPI_PROC(void,SDL_DestroyCursor,(SDL_Cursor *a),(a),)
 SDL_DYNAPI_PROC(void,SDL_DestroyRW,(SDL_RWops *a),(a),)
 SDL_DYNAPI_PROC(int,SDL_GL_BindTexture,(SDL_Texture *a, float *b, float *c),(a,b,c),return)
 SDL_DYNAPI_PROC(SDL_GLContext,SDL_GL_CreateContext,(SDL_Window *a),(a),return)
-SDL_DYNAPI_PROC(void,SDL_GL_DeleteContext,(SDL_GLContext a),(a),)
+SDL_DYNAPI_PROC(int,SDL_GL_DeleteContext,(SDL_GLContext a),(a),return)
 SDL_DYNAPI_PROC(SDL_bool,SDL_GL_ExtensionSupported,(const char *a),(a),return)
 SDL_DYNAPI_PROC(int,SDL_GL_GetAttribute,(SDL_GLattr a, int *b),(a,b),return)
 SDL_DYNAPI_PROC(SDL_GLContext,SDL_GL_GetCurrentContext,(void),(),return)
@@ -384,8 +384,8 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_GetRectEnclosingPoints,(const SDL_Point *a, int b,
 SDL_DYNAPI_PROC(SDL_bool,SDL_GetRectEnclosingPointsFloat,(const SDL_FPoint *a, int b, const SDL_FRect *c, SDL_FRect *d),(a,b,c,d),return)
 SDL_DYNAPI_PROC(SDL_bool,SDL_GetRectIntersection,(const SDL_Rect *a, const SDL_Rect *b, SDL_Rect *c),(a,b,c),return)
 SDL_DYNAPI_PROC(SDL_bool,SDL_GetRectIntersectionFloat,(const SDL_FRect *a, const SDL_FRect *b, SDL_FRect *c),(a,b,c),return)
-SDL_DYNAPI_PROC(void,SDL_GetRectUnion,(const SDL_Rect *a, const SDL_Rect *b, SDL_Rect *c),(a,b,c),)
-SDL_DYNAPI_PROC(void,SDL_GetRectUnionFloat,(const SDL_FRect *a, const SDL_FRect *b, SDL_FRect *c),(a,b,c),)
+SDL_DYNAPI_PROC(int,SDL_GetRectUnion,(const SDL_Rect *a, const SDL_Rect *b, SDL_Rect *c),(a,b,c),return)
+SDL_DYNAPI_PROC(int,SDL_GetRectUnionFloat,(const SDL_FRect *a, const SDL_FRect *b, SDL_FRect *c),(a,b,c),return)
 SDL_DYNAPI_PROC(SDL_bool,SDL_GetRelativeMouseMode,(void),(),return)
 SDL_DYNAPI_PROC(Uint32,SDL_GetRelativeMouseState,(float *a, float *b),(a,b),return)
 SDL_DYNAPI_PROC(int,SDL_GetRenderClipRect,(SDL_Renderer *a, SDL_Rect *b),(a,b),return)
@@ -447,15 +447,15 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_GetWindowGrab,(SDL_Window *a),(a),return)
 SDL_DYNAPI_PROC(void*,SDL_GetWindowICCProfile,(SDL_Window *a, size_t *b),(a,b),return)
 SDL_DYNAPI_PROC(Uint32,SDL_GetWindowID,(SDL_Window *a),(a),return)
 SDL_DYNAPI_PROC(SDL_bool,SDL_GetWindowKeyboardGrab,(SDL_Window *a),(a),return)
-SDL_DYNAPI_PROC(void,SDL_GetWindowMaximumSize,(SDL_Window *a, int *b, int *c),(a,b,c),)
-SDL_DYNAPI_PROC(void,SDL_GetWindowMinimumSize,(SDL_Window *a, int *b, int *c),(a,b,c),)
+SDL_DYNAPI_PROC(int,SDL_GetWindowMaximumSize,(SDL_Window *a, int *b, int *c),(a,b,c),return)
+SDL_DYNAPI_PROC(int,SDL_GetWindowMinimumSize,(SDL_Window *a, int *b, int *c),(a,b,c),return)
 SDL_DYNAPI_PROC(SDL_bool,SDL_GetWindowMouseGrab,(SDL_Window *a),(a),return)
 SDL_DYNAPI_PROC(const SDL_Rect*,SDL_GetWindowMouseRect,(SDL_Window *a),(a),return)
 SDL_DYNAPI_PROC(int,SDL_GetWindowOpacity,(SDL_Window *a, float *b),(a,b),return)
 SDL_DYNAPI_PROC(Uint32,SDL_GetWindowPixelFormat,(SDL_Window *a),(a),return)
-SDL_DYNAPI_PROC(void,SDL_GetWindowPosition,(SDL_Window *a, int *b, int *c),(a,b,c),)
-SDL_DYNAPI_PROC(void,SDL_GetWindowSize,(SDL_Window *a, int *b, int *c),(a,b,c),)
-SDL_DYNAPI_PROC(void,SDL_GetWindowSizeInPixels,(SDL_Window *a, int *b, int *c),(a,b,c),)
+SDL_DYNAPI_PROC(int,SDL_GetWindowPosition,(SDL_Window *a, int *b, int *c),(a,b,c),return)
+SDL_DYNAPI_PROC(int,SDL_GetWindowSize,(SDL_Window *a, int *b, int *c),(a,b,c),return)
+SDL_DYNAPI_PROC(int,SDL_GetWindowSizeInPixels,(SDL_Window *a, int *b, int *c),(a,b,c),return)
 SDL_DYNAPI_PROC(SDL_Surface*,SDL_GetWindowSurface,(SDL_Window *a),(a),return)
 SDL_DYNAPI_PROC(const char*,SDL_GetWindowTitle,(SDL_Window *a),(a),return)
 SDL_DYNAPI_PROC(int,SDL_GetWindowWMInfo,(SDL_Window *a, SDL_SysWMinfo *b, Uint32 c),(a,b,c),return)
@@ -511,7 +511,7 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_HasSSE41,(void),(),return)
 SDL_DYNAPI_PROC(SDL_bool,SDL_HasSSE42,(void),(),return)
 SDL_DYNAPI_PROC(SDL_bool,SDL_HasScreenKeyboardSupport,(void),(),return)
 SDL_DYNAPI_PROC(int,SDL_HideCursor,(void),(),return)
-SDL_DYNAPI_PROC(void,SDL_HideWindow,(SDL_Window *a),(a),)
+SDL_DYNAPI_PROC(int,SDL_HideWindow,(SDL_Window *a),(a),return)
 SDL_DYNAPI_PROC(int,SDL_Init,(Uint32 a),(a),return)
 SDL_DYNAPI_PROC(int,SDL_InitSubSystem,(Uint32 a),(a),return)
 SDL_DYNAPI_PROC(SDL_bool,SDL_IsGamepad,(SDL_JoystickID a),(a),return)
@@ -545,14 +545,14 @@ SDL_DYNAPI_PROC(void,SDL_LogSetOutputFunction,(SDL_LogOutputFunction a, void *b)
 SDL_DYNAPI_PROC(void,SDL_LogSetPriority,(int a, SDL_LogPriority b),(a,b),)
 SDL_DYNAPI_PROC(Uint32,SDL_MapRGB,(const SDL_PixelFormat *a, Uint8 b, Uint8 c, Uint8 d),(a,b,c,d),return)
 SDL_DYNAPI_PROC(Uint32,SDL_MapRGBA,(const SDL_PixelFormat *a, Uint8 b, Uint8 c, Uint8 d, Uint8 e),(a,b,c,d,e),return)
-SDL_DYNAPI_PROC(void,SDL_MaximizeWindow,(SDL_Window *a),(a),)
+SDL_DYNAPI_PROC(int,SDL_MaximizeWindow,(SDL_Window *a),(a),return)
 SDL_DYNAPI_PROC(void,SDL_MemoryBarrierAcquireFunction,(void),(),)
 SDL_DYNAPI_PROC(void,SDL_MemoryBarrierReleaseFunction,(void),(),)
 SDL_DYNAPI_PROC(SDL_MetalView,SDL_Metal_CreateView,(SDL_Window *a),(a),return)
 SDL_DYNAPI_PROC(void,SDL_Metal_DestroyView,(SDL_MetalView a),(a),)
 SDL_DYNAPI_PROC(void*,SDL_Metal_GetLayer,(SDL_MetalView a),(a),return)
-SDL_DYNAPI_PROC(void,SDL_MinimizeWindow,(SDL_Window *a),(a),)
-SDL_DYNAPI_PROC(void,SDL_MixAudioFormat,(Uint8 *a, const Uint8 *b, SDL_AudioFormat c, Uint32 d, int e),(a,b,c,d,e),)
+SDL_DYNAPI_PROC(int,SDL_MinimizeWindow,(SDL_Window *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_MixAudioFormat,(Uint8 *a, const Uint8 *b, SDL_AudioFormat c, Uint32 d, int e),(a,b,c,d,e),return)
 SDL_DYNAPI_PROC(int,SDL_MouseIsHaptic,(void),(),return)
 SDL_DYNAPI_PROC(int,SDL_NumHaptics,(void),(),return)
 SDL_DYNAPI_PROC(void,SDL_OnApplicationDidBecomeActive,(void),(),)
@@ -586,7 +586,7 @@ SDL_DYNAPI_PROC(Sint64,SDL_RWseek,(SDL_RWops *a, Sint64 b, int c),(a,b,c),return
 SDL_DYNAPI_PROC(Sint64,SDL_RWsize,(SDL_RWops *a),(a),return)
 SDL_DYNAPI_PROC(Sint64,SDL_RWtell,(SDL_RWops *a),(a),return)
 SDL_DYNAPI_PROC(Sint64,SDL_RWwrite,(SDL_RWops *a, const void *b, Sint64 c),(a,b,c),return)
-SDL_DYNAPI_PROC(void,SDL_RaiseWindow,(SDL_Window *a),(a),)
+SDL_DYNAPI_PROC(int,SDL_RaiseWindow,(SDL_Window *a),(a),return)
 SDL_DYNAPI_PROC(Uint16,SDL_ReadBE16,(SDL_RWops *a),(a),return)
 SDL_DYNAPI_PROC(Uint32,SDL_ReadBE32,(SDL_RWops *a),(a),return)
 SDL_DYNAPI_PROC(Uint64,SDL_ReadBE64,(SDL_RWops *a),(a),return)
@@ -608,7 +608,7 @@ SDL_DYNAPI_PROC(int,SDL_RenderLines,(SDL_Renderer *a, const SDL_FPoint *b, int c
 SDL_DYNAPI_PROC(int,SDL_RenderCoordinatesToWindow,(SDL_Renderer *a, float b, float c, float *d, float *e),(a,b,c,d,e),return)
 SDL_DYNAPI_PROC(int,SDL_RenderPoint,(SDL_Renderer *a, float b, float c),(a,b,c),return)
 SDL_DYNAPI_PROC(int,SDL_RenderPoints,(SDL_Renderer *a, const SDL_FPoint *b, int c),(a,b,c),return)
-SDL_DYNAPI_PROC(void,SDL_RenderPresent,(SDL_Renderer *a),(a),)
+SDL_DYNAPI_PROC(int,SDL_RenderPresent,(SDL_Renderer *a),(a),return)
 SDL_DYNAPI_PROC(int,SDL_RenderReadPixels,(SDL_Renderer *a, const SDL_Rect *b, Uint32 c, void *d, int e),(a,b,c,d,e),return)
 SDL_DYNAPI_PROC(int,SDL_RenderRect,(SDL_Renderer *a, const SDL_FRect *b),(a,b),return)
 SDL_DYNAPI_PROC(int,SDL_RenderRects,(SDL_Renderer *a, const SDL_FRect *b, int c),(a,b,c),return)
@@ -620,7 +620,7 @@ SDL_DYNAPI_PROC(void,SDL_ResetAssertionReport,(void),(),)
 SDL_DYNAPI_PROC(SDL_bool,SDL_ResetHint,(const char *a),(a),return)
 SDL_DYNAPI_PROC(void,SDL_ResetHints,(void),(),)
 SDL_DYNAPI_PROC(void,SDL_ResetKeyboard,(void),(),)
-SDL_DYNAPI_PROC(void,SDL_RestoreWindow,(SDL_Window *a),(a),)
+SDL_DYNAPI_PROC(int,SDL_RestoreWindow,(SDL_Window *a),(a),return)
 SDL_DYNAPI_PROC(int,SDL_RumbleGamepad,(SDL_Gamepad *a, Uint16 b, Uint16 c, Uint32 d),(a,b,c,d),return)
 SDL_DYNAPI_PROC(int,SDL_RumbleGamepadTriggers,(SDL_Gamepad *a, Uint16 b, Uint16 c, Uint32 d),(a,b,c,d),return)
 SDL_DYNAPI_PROC(int,SDL_RumbleJoystick,(SDL_Joystick *a, Uint16 b, Uint16 c, Uint32 d),(a,b,c,d),return)
@@ -639,7 +639,7 @@ SDL_DYNAPI_PROC(int,SDL_SendGamepadEffect,(SDL_Gamepad *a, const void *b, int c)
 SDL_DYNAPI_PROC(int,SDL_SendJoystickEffect,(SDL_Joystick *a, const void *b, int c),(a,b,c),return)
 SDL_DYNAPI_PROC(void,SDL_SetAssertionHandler,(SDL_AssertionHandler a, void *b),(a,b),)
 SDL_DYNAPI_PROC(int,SDL_SetClipboardText,(const char *a),(a),return)
-SDL_DYNAPI_PROC(void,SDL_SetCursor,(SDL_Cursor *a),(a),)
+SDL_DYNAPI_PROC(int,SDL_SetCursor,(SDL_Cursor *a),(a),return)
 SDL_DYNAPI_PROC(void,SDL_SetEventEnabled,(Uint32 a, SDL_bool b),(a,b),)
 SDL_DYNAPI_PROC(void,SDL_SetEventFilter,(SDL_EventFilter a, void *b),(a,b),)
 SDL_DYNAPI_PROC(void,SDL_SetGamepadEventsEnabled,(SDL_bool a),(a),)
@@ -650,7 +650,7 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_SetHint,(const char *a, const char *b),(a,b),return
 SDL_DYNAPI_PROC(SDL_bool,SDL_SetHintWithPriority,(const char *a, const char *b, SDL_HintPriority c),(a,b,c),return)
 SDL_DYNAPI_PROC(void,SDL_SetJoystickEventsEnabled,(SDL_bool a),(a),)
 SDL_DYNAPI_PROC(int,SDL_SetJoystickLED,(SDL_Joystick *a, Uint8 b, Uint8 c, Uint8 d),(a,b,c,d),return)
-SDL_DYNAPI_PROC(void,SDL_SetJoystickPlayerIndex,(SDL_Joystick *a, int b),(a,b),)
+SDL_DYNAPI_PROC(int,SDL_SetJoystickPlayerIndex,(SDL_Joystick *a, int b),(a,b),return)
 SDL_DYNAPI_PROC(int,SDL_SetJoystickVirtualAxis,(SDL_Joystick *a, int b, Sint16 c),(a,b,c),return)
 SDL_DYNAPI_PROC(int,SDL_SetJoystickVirtualButton,(SDL_Joystick *a, int b, Uint8 c),(a,b,c),return)
 SDL_DYNAPI_PROC(int,SDL_SetJoystickVirtualHat,(SDL_Joystick *a, int b, Uint8 c),(a,b,c),return)
@@ -675,31 +675,31 @@ SDL_DYNAPI_PROC(int,SDL_SetSurfaceColorKey,(SDL_Surface *a, int b, Uint32 c),(a,
 SDL_DYNAPI_PROC(int,SDL_SetSurfaceColorMod,(SDL_Surface *a, Uint8 b, Uint8 c, Uint8 d),(a,b,c,d),return)
 SDL_DYNAPI_PROC(int,SDL_SetSurfacePalette,(SDL_Surface *a, SDL_Palette *b),(a,b),return)
 SDL_DYNAPI_PROC(int,SDL_SetSurfaceRLE,(SDL_Surface *a, int b),(a,b),return)
-SDL_DYNAPI_PROC(void,SDL_SetTextInputRect,(const SDL_Rect *a),(a),)
+SDL_DYNAPI_PROC(int,SDL_SetTextInputRect,(const SDL_Rect *a),(a),return)
 SDL_DYNAPI_PROC(int,SDL_SetTextureAlphaMod,(SDL_Texture *a, Uint8 b),(a,b),return)
 SDL_DYNAPI_PROC(int,SDL_SetTextureBlendMode,(SDL_Texture *a, SDL_BlendMode b),(a,b),return)
 SDL_DYNAPI_PROC(int,SDL_SetTextureColorMod,(SDL_Texture *a, Uint8 b, Uint8 c, Uint8 d),(a,b,c,d),return)
 SDL_DYNAPI_PROC(int,SDL_SetTextureScaleMode,(SDL_Texture *a, SDL_ScaleMode b),(a,b),return)
 SDL_DYNAPI_PROC(int,SDL_SetTextureUserData,(SDL_Texture *a, void *b),(a,b),return)
 SDL_DYNAPI_PROC(int,SDL_SetThreadPriority,(SDL_ThreadPriority a),(a),return)
-SDL_DYNAPI_PROC(void,SDL_SetWindowAlwaysOnTop,(SDL_Window *a, SDL_bool b),(a,b),)
-SDL_DYNAPI_PROC(void,SDL_SetWindowBordered,(SDL_Window *a, SDL_bool b),(a,b),)
+SDL_DYNAPI_PROC(int,SDL_SetWindowAlwaysOnTop,(SDL_Window *a, SDL_bool b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_SetWindowBordered,(SDL_Window *a, SDL_bool b),(a,b),return)
 SDL_DYNAPI_PROC(void*,SDL_SetWindowData,(SDL_Window *a, const char *b, void *c),(a,b,c),return)
 SDL_DYNAPI_PROC(int,SDL_SetWindowFullscreenMode,(SDL_Window *a, const SDL_DisplayMode *b),(a,b),return)
 SDL_DYNAPI_PROC(int,SDL_SetWindowFullscreen,(SDL_Window *a, SDL_bool b),(a,b),return)
-SDL_DYNAPI_PROC(void,SDL_SetWindowGrab,(SDL_Window *a, SDL_bool b),(a,b),)
+SDL_DYNAPI_PROC(int,SDL_SetWindowGrab,(SDL_Window *a, SDL_bool b),(a,b),return)
 SDL_DYNAPI_PROC(int,SDL_SetWindowHitTest,(SDL_Window *a, SDL_HitTest b, void *c),(a,b,c),return)
 SDL_DYNAPI_PROC(int,SDL_SetWindowIcon,(SDL_Window *a, SDL_Surface *b),(a,b),return)
 SDL_DYNAPI_PROC(int,SDL_SetWindowInputFocus,(SDL_Window *a),(a),return)
-SDL_DYNAPI_PROC(void,SDL_SetWindowKeyboardGrab,(SDL_Window *a, SDL_bool b),(a,b),)
+SDL_DYNAPI_PROC(int,SDL_SetWindowKeyboardGrab,(SDL_Window *a, SDL_bool b),(a,b),return)
 SDL_DYNAPI_PROC(int,SDL_SetWindowMaximumSize,(SDL_Window *a, int b, int c),(a,b,c),return)
 SDL_DYNAPI_PROC(int,SDL_SetWindowMinimumSize,(SDL_Window *a, int b, int c),(a,b,c),return)
 SDL_DYNAPI_PROC(int,SDL_SetWindowModalFor,(SDL_Window *a, SDL_Window *b),(a,b),return)
-SDL_DYNAPI_PROC(void,SDL_SetWindowMouseGrab,(SDL_Window *a, SDL_bool b),(a,b),)
+SDL_DYNAPI_PROC(int,SDL_SetWindowMouseGrab,(SDL_Window *a, SDL_bool b),(a,b),return)
 SDL_DYNAPI_PROC(int,SDL_SetWindowMouseRect,(SDL_Window *a, const SDL_Rect *b),(a,b),return)
 SDL_DYNAPI_PROC(int,SDL_SetWindowOpacity,(SDL_Window *a, float b),(a,b),return)
-SDL_DYNAPI_PROC(void,SDL_SetWindowPosition,(SDL_Window *a, int b, int c),(a,b,c),)
-SDL_DYNAPI_PROC(void,SDL_SetWindowResizable,(SDL_Window *a, SDL_bool b),(a,b),)
+SDL_DYNAPI_PROC(int,SDL_SetWindowPosition,(SDL_Window *a, int b, int c),(a,b,c),return)
+SDL_DYNAPI_PROC(int,SDL_SetWindowResizable,(SDL_Window *a, SDL_bool b),(a,b),return)
 SDL_DYNAPI_PROC(int,SDL_SetWindowShape,(SDL_Window *a, SDL_Surface *b, SDL_WindowShapeMode *c),(a,b,c),return)
 SDL_DYNAPI_PROC(int,SDL_SetWindowSize,(SDL_Window *a, int b, int c),(a,b,c),return)
 SDL_DYNAPI_PROC(int,SDL_SetWindowTitle,(SDL_Window *a, const char *b),(a,b),return)
@@ -707,7 +707,7 @@ SDL_DYNAPI_PROC(void,SDL_SetYUVConversionMode,(SDL_YUV_CONVERSION_MODE a),(a),)
 SDL_DYNAPI_PROC(int,SDL_ShowCursor,(void),(),return)
 SDL_DYNAPI_PROC(int,SDL_ShowMessageBox,(const SDL_MessageBoxData *a, int *b),(a,b),return)
 SDL_DYNAPI_PROC(int,SDL_ShowSimpleMessageBox,(Uint32 a, const char *b, const char *c, SDL_Window *d),(a,b,c,d),return)
-SDL_DYNAPI_PROC(void,SDL_ShowWindow,(SDL_Window *a),(a),)
+SDL_DYNAPI_PROC(int,SDL_ShowWindow,(SDL_Window *a),(a),return)
 SDL_DYNAPI_PROC(int,SDL_SoftStretch,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, const SDL_Rect *d),(a,b,c,d),return)
 SDL_DYNAPI_PROC(int,SDL_SoftStretchLinear,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, const SDL_Rect *d),(a,b,c,d),return)
 SDL_DYNAPI_PROC(void,SDL_StartTextInput,(void),(),)
@@ -727,7 +727,7 @@ SDL_DYNAPI_PROC(void,SDL_UnlockAudioDevice,(SDL_AudioDeviceID a),(a),)
 SDL_DYNAPI_PROC(void,SDL_UnlockJoysticks,(void),(),)
 SDL_DYNAPI_PROC(int,SDL_UnlockMutex,(SDL_mutex *a),(a),return)
 SDL_DYNAPI_PROC(void,SDL_UnlockSurface,(SDL_Surface *a),(a),)
-SDL_DYNAPI_PROC(void,SDL_UnlockTexture,(SDL_Texture *a),(a),)
+SDL_DYNAPI_PROC(int,SDL_UnlockTexture,(SDL_Texture *a),(a),return)
 SDL_DYNAPI_PROC(void,SDL_UpdateGamepads,(void),(),)
 SDL_DYNAPI_PROC(void,SDL_UpdateJoysticks,(void),(),)
 SDL_DYNAPI_PROC(int,SDL_UpdateNVTexture,(SDL_Texture *a, const SDL_Rect *b, const Uint8 *c, int d, const Uint8 *e, int f),(a,b,c,d,e,f),return)
@@ -786,7 +786,7 @@ SDL_DYNAPI_PROC(float,SDL_fmodf,(float a, float b),(a,b),return)
 SDL_DYNAPI_PROC(void,SDL_free,(void *a),(a),)
 SDL_DYNAPI_PROC(char*,SDL_getenv,(const char *a),(a),return)
 SDL_DYNAPI_PROC(void,SDL_hid_ble_scan,(SDL_bool a),(a),)
-SDL_DYNAPI_PROC(void,SDL_hid_close,(SDL_hid_device *a),(a),)
+SDL_DYNAPI_PROC(int,SDL_hid_close,(SDL_hid_device *a),(a),return)
 SDL_DYNAPI_PROC(Uint32,SDL_hid_device_change_count,(void),(),return)
 SDL_DYNAPI_PROC(SDL_hid_device_info*,SDL_hid_enumerate,(unsigned short a, unsigned short b),(a,b),return)
 SDL_DYNAPI_PROC(int,SDL_hid_exit,(void),(),return)

+ 4 - 4
src/events/SDL_mouse.c

@@ -1256,13 +1256,13 @@ SDL_CreateSystemCursor(SDL_SystemCursor id)
    if this is desired for any reason.  This is used when setting
    the video mode and when the SDL window gains the mouse focus.
  */
-void SDL_SetCursor(SDL_Cursor *cursor)
+int SDL_SetCursor(SDL_Cursor *cursor)
 {
     SDL_Mouse *mouse = SDL_GetMouse();
 
     /* Return immediately if setting the cursor to the currently set one (fixes #7151) */
     if (cursor == mouse->cur_cursor) {
-        return;
+        return 0;
     }
 
     /* Set the new cursor */
@@ -1276,8 +1276,7 @@ void SDL_SetCursor(SDL_Cursor *cursor)
                 }
             }
             if (found == NULL) {
-                SDL_SetError("Cursor not associated with the current mouse");
-                return;
+                return SDL_SetError("Cursor not associated with the current mouse");
             }
         }
         mouse->cur_cursor = cursor;
@@ -1298,6 +1297,7 @@ void SDL_SetCursor(SDL_Cursor *cursor)
             mouse->ShowCursor(NULL);
         }
     }
+    return 0;
 }
 
 SDL_Cursor *

+ 2 - 2
src/events/SDL_mouse_c.h

@@ -54,13 +54,13 @@ typedef struct
     int (*ShowCursor)(SDL_Cursor *cursor);
 
     /* This is called when a mouse motion event occurs */
-    void (*MoveCursor)(SDL_Cursor *cursor);
+    int (*MoveCursor)(SDL_Cursor *cursor);
 
     /* Free a window manager cursor */
     void (*FreeCursor)(SDL_Cursor *cursor);
 
     /* Warp the mouse to (x,y) within a window */
-    void (*WarpMouse)(SDL_Window *window, float x, float y);
+    int (*WarpMouse)(SDL_Window *window, float x, float y);
 
     /* Warp the mouse to (x,y) in screen space */
     int (*WarpMouseGlobal)(float x, float y);

+ 3 - 2
src/hidapi/SDL_hidapi.c

@@ -1522,12 +1522,13 @@ int SDL_hid_get_feature_report(SDL_hid_device *device, unsigned char *data, size
     return result;
 }
 
-void SDL_hid_close(SDL_hid_device *device)
+int SDL_hid_close(SDL_hid_device *device)
 {
-    CHECK_DEVICE_MAGIC(device, );
+    CHECK_DEVICE_MAGIC(device, -1);
 
     device->backend->hid_close(device->device);
     DeleteHIDDeviceWrapper(device);
+    return 0;
 }
 
 int SDL_hid_get_manufacturer_string(SDL_hid_device *device, wchar_t *string, size_t maxlen)

+ 9 - 12
src/joystick/SDL_gamepad.c

@@ -936,7 +936,7 @@ const char *SDL_GetGamepadStringForButton(SDL_GamepadButton button)
 /*
  * given a gamepad button name and a joystick name update our mapping structure with it
  */
-static void SDL_PrivateParseGamepadElement(SDL_Gamepad *gamepad, const char *szGameButton, const char *szJoystickButton)
+static int SDL_PrivateParseGamepadElement(SDL_Gamepad *gamepad, const char *szGameButton, const char *szJoystickButton)
 {
     SDL_ExtendedGamepadBind bind;
     SDL_GamepadButton button;
@@ -975,8 +975,7 @@ static void SDL_PrivateParseGamepadElement(SDL_Gamepad *gamepad, const char *szG
         bind.outputType = SDL_GAMEPAD_BINDTYPE_BUTTON;
         bind.output.button = button;
     } else {
-        SDL_SetError("Unexpected gamepad element %s", szGameButton);
-        return;
+        return SDL_SetError("Unexpected gamepad element %s", szGameButton);
     }
 
     if (*szJoystickButton == '+' || *szJoystickButton == '-') {
@@ -1015,24 +1014,23 @@ static void SDL_PrivateParseGamepadElement(SDL_Gamepad *gamepad, const char *szG
         bind.input.hat.hat = hat;
         bind.input.hat.hat_mask = mask;
     } else {
-        SDL_SetError("Unexpected joystick element: %s", szJoystickButton);
-        return;
+        return SDL_SetError("Unexpected joystick element: %s", szJoystickButton);
     }
 
     ++gamepad->num_bindings;
     gamepad->bindings = (SDL_ExtendedGamepadBind *)SDL_realloc(gamepad->bindings, gamepad->num_bindings * sizeof(*gamepad->bindings));
     if (!gamepad->bindings) {
         gamepad->num_bindings = 0;
-        SDL_OutOfMemory();
-        return;
+        return SDL_OutOfMemory();
     }
     gamepad->bindings[gamepad->num_bindings - 1] = bind;
+    return 0;
 }
 
 /*
  * given a gamepad mapping string update our mapping object
  */
-static void SDL_PrivateParseGamepadConfigString(SDL_Gamepad *gamepad, const char *pchString)
+static int SDL_PrivateParseGamepadConfigString(SDL_Gamepad *gamepad, const char *pchString)
 {
     char szGameButton[20];
     char szJoystickButton[20];
@@ -1058,15 +1056,13 @@ static void SDL_PrivateParseGamepadConfigString(SDL_Gamepad *gamepad, const char
 
         } else if (bGameButton) {
             if (i >= sizeof(szGameButton)) {
-                SDL_SetError("Button name too large: %s", szGameButton);
-                return;
+                return SDL_SetError("Button name too large: %s", szGameButton);
             }
             szGameButton[i] = *pchPos;
             i++;
         } else {
             if (i >= sizeof(szJoystickButton)) {
-                SDL_SetError("Joystick button name too large: %s", szJoystickButton);
-                return;
+                return SDL_SetError("Joystick button name too large: %s", szJoystickButton);
             }
             szJoystickButton[i] = *pchPos;
             i++;
@@ -1078,6 +1074,7 @@ static void SDL_PrivateParseGamepadConfigString(SDL_Gamepad *gamepad, const char
     if (szGameButton[0] != '\0' || szJoystickButton[0] != '\0') {
         SDL_PrivateParseGamepadElement(gamepad, szGameButton, szJoystickButton);
     }
+    return 0;
 }
 
 /*

+ 7 - 5
src/joystick/SDL_joystick.c

@@ -1043,15 +1043,16 @@ int SDL_GetJoystickPlayerIndex(SDL_Joystick *joystick)
 /**
  *  Set the player index of an opened joystick
  */
-void SDL_SetJoystickPlayerIndex(SDL_Joystick *joystick, int player_index)
+int SDL_SetJoystickPlayerIndex(SDL_Joystick *joystick, int player_index)
 {
     SDL_LockJoysticks();
     {
-        CHECK_JOYSTICK_MAGIC(joystick, );
+        CHECK_JOYSTICK_MAGIC(joystick, -1);
 
         SDL_SetJoystickIDForPlayerIndex(player_index, joystick->instance_id);
     }
     SDL_UnlockJoysticks();
+    return 0;
 }
 
 int SDL_RumbleJoystick(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms)
@@ -1216,7 +1217,7 @@ int SDL_SendJoystickEffect(SDL_Joystick *joystick, const void *data, int size)
 /*
  * Close a joystick previously opened with SDL_OpenJoystick()
  */
-void SDL_CloseJoystick(SDL_Joystick *joystick)
+int SDL_CloseJoystick(SDL_Joystick *joystick)
 {
     SDL_Joystick *joysticklist;
     SDL_Joystick *joysticklistprev;
@@ -1224,12 +1225,12 @@ void SDL_CloseJoystick(SDL_Joystick *joystick)
 
     SDL_LockJoysticks();
     {
-        CHECK_JOYSTICK_MAGIC(joystick, );
+        CHECK_JOYSTICK_MAGIC(joystick, -1);
 
         /* First decrement ref count */
         if (--joystick->ref_count > 0) {
             SDL_UnlockJoysticks();
-            return;
+            return 0;
         }
 
         if (joystick->rumble_expiration) {
@@ -1276,6 +1277,7 @@ void SDL_CloseJoystick(SDL_Joystick *joystick)
         SDL_free(joystick);
     }
     SDL_UnlockJoysticks();
+    return 0;
 }
 
 void SDL_QuitJoysticks(void)

+ 9 - 10
src/joystick/windows/SDL_rawinputjoystick.c

@@ -458,15 +458,15 @@ static SDL_bool RAWINPUT_MissingWindowsGamingInputSlot()
     return SDL_FALSE;
 }
 
-static void RAWINPUT_UpdateWindowsGamingInput()
+static int RAWINPUT_UpdateWindowsGamingInput()
 {
     int ii;
     if (!wgi_state.gamepad_statics) {
-        return;
+        return 0;
     }
 
     if (!wgi_state.dirty) {
-        return;
+        return 0;
     }
 
     wgi_state.dirty = SDL_FALSE;
@@ -507,13 +507,11 @@ static void RAWINPUT_UpdateWindowsGamingInput()
                             wgi_state.per_gamepad_count++;
                             wgi_state.per_gamepad = SDL_realloc(wgi_state.per_gamepad, sizeof(wgi_state.per_gamepad[0]) * wgi_state.per_gamepad_count);
                             if (!wgi_state.per_gamepad) {
-                                SDL_OutOfMemory();
-                                return;
+                                return SDL_OutOfMemory();
                             }
                             gamepad_state = SDL_calloc(1, sizeof(*gamepad_state));
                             if (gamepad_state == NULL) {
-                                SDL_OutOfMemory();
-                                return;
+                                return SDL_OutOfMemory();
                             }
                             wgi_state.per_gamepad[wgi_state.per_gamepad_count - 1] = gamepad_state;
                             gamepad_state->gamepad = gamepad;
@@ -549,6 +547,7 @@ static void RAWINPUT_UpdateWindowsGamingInput()
             wgi_state.per_gamepad[ii]->connected = SDL_FALSE; /* Not used by anything, currently */
         }
     }
+    return 0;
 }
 static void RAWINPUT_InitWindowsGamingInput(RAWINPUT_DeviceContext *ctx)
 {
@@ -1907,7 +1906,7 @@ RAWINPUT_RegisterNotifications(HWND hWnd)
     return SDL_TRUE;
 }
 
-void RAWINPUT_UnregisterNotifications()
+int RAWINPUT_UnregisterNotifications()
 {
     int i;
     RAWINPUTDEVICE rid[SDL_arraysize(subscribed_devices)];
@@ -1920,9 +1919,9 @@ void RAWINPUT_UnregisterNotifications()
     }
 
     if (!RegisterRawInputDevices(rid, SDL_arraysize(rid), sizeof(RAWINPUTDEVICE))) {
-        SDL_SetError("Couldn't unregister for raw input events");
-        return;
+        return SDL_SetError("Couldn't unregister for raw input events");
     }
+    return 0;
 }
 
 LRESULT CALLBACK

+ 1 - 1
src/joystick/windows/SDL_rawinputjoystick_c.h

@@ -29,7 +29,7 @@ extern SDL_bool RAWINPUT_IsDevicePresent(Uint16 vendor_id, Uint16 product_id, Ui
 
 /* Registers for input events */
 extern SDL_bool RAWINPUT_RegisterNotifications(HWND hWnd);
-extern void RAWINPUT_UnregisterNotifications();
+extern int RAWINPUT_UnregisterNotifications();
 
 /* Returns 0 if message was handled */
 extern LRESULT CALLBACK RAWINPUT_WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);

+ 1 - 1
src/locale/SDL_syslocale.h

@@ -26,7 +26,7 @@
 extern "C" {
 #endif
 
-extern void SDL_SYS_GetPreferredLocales(char *buf, size_t buflen);
+extern int SDL_SYS_GetPreferredLocales(char *buf, size_t buflen);
 
 #ifdef __cplusplus
 }

+ 2 - 1
src/locale/android/SDL_syslocale.c

@@ -23,7 +23,8 @@
 #include "../SDL_syslocale.h"
 #include "../../core/android/SDL_android.h"
 
-void SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
+int SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
 {
     Android_JNI_GetLocale(buf, buflen);
+    return 0;
 }

+ 2 - 2
src/locale/dummy/SDL_syslocale.c

@@ -22,8 +22,8 @@
 #include "SDL_internal.h"
 #include "../SDL_syslocale.h"
 
-void SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
+int SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
 {
     /* dummy implementation. Caller already zero'd out buffer. */
-    SDL_Unsupported();
+    return SDL_Unsupported();
 }

+ 2 - 1
src/locale/emscripten/SDL_syslocale.c

@@ -24,7 +24,7 @@
 #include "SDL_internal.h"
 #include "../SDL_syslocale.h"
 
-void SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
+int SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
 {
     /* *INDENT-OFF* */ /* clang-format off */
     EM_ASM({
@@ -67,4 +67,5 @@ void SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
         }
     }, buf, buflen);
     /* *INDENT-ON* */ /* clang-format on */
+    return 0;
 }

+ 4 - 5
src/locale/haiku/SDL_syslocale.cc

@@ -26,7 +26,7 @@
 #include "SDL_internal.h"
 #include "../SDL_syslocale.h"
 
-void
+int
 SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
 {
     BLocaleRoster *roster = BLocaleRoster::Default();
@@ -34,16 +34,14 @@ SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
 
     BMessage msg;
     if (roster->GetPreferredLanguages(&msg) != B_OK) {
-        SDL_SetError("BLocaleRoster couldn't get preferred languages");
-        return;
+        return SDL_SetError("BLocaleRoster couldn't get preferred languages");
     }
 
     const char *key = "language";
     type_code typ = B_ANY_TYPE;
     int32 numlangs = 0;
     if ((msg.GetInfo(key, &typ, &numlangs) != B_OK) || (typ != B_STRING_TYPE)) {
-        SDL_SetError("BLocaleRoster message was wrong");
-        return;
+        return SDL_SetError("BLocaleRoster message was wrong");
     }
 
     for (int32 i = 0; i < numlangs; i++) {
@@ -71,4 +69,5 @@ SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
             buflen--;
         }
     }
+    return 0;
 }

+ 2 - 1
src/locale/macos/SDL_syslocale.m

@@ -24,7 +24,7 @@
 
 #import <Foundation/Foundation.h>
 
-void SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
+int SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
 {
     @autoreleasepool {
         NSArray *languages = NSLocale.preferredLanguages;
@@ -72,4 +72,5 @@ void SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
             }
         }
     }
+    return 0;
 }

+ 2 - 1
src/locale/n3ds/SDL_syslocale.c

@@ -29,7 +29,7 @@
 
 SDL_FORCE_INLINE u8 GetLocaleIndex(void);
 
-void SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
+int SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
 {
     /* The 3DS only supports these 12 languages, only one can be active at a time */
     static const char AVAILABLE_LOCALES[][6] = { "ja_JP", "en_US", "fr_FR", "de_DE",
@@ -39,6 +39,7 @@ void SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
     if (current_locale != BAD_LOCALE) {
         SDL_strlcpy(buf, AVAILABLE_LOCALES[current_locale], buflen);
     }
+    return 0;
 }
 
 SDL_FORCE_INLINE u8

+ 3 - 3
src/locale/unix/SDL_syslocale.c

@@ -62,7 +62,7 @@ static void normalize_locales(char *dst, char *src, size_t buflen)
     normalize_locale_str(dst, src, buflen);
 }
 
-void SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
+int SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
 {
     /* !!! FIXME: should we be using setlocale()? Or some D-Bus thing? */
     SDL_bool isstack;
@@ -72,8 +72,7 @@ void SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
     SDL_assert(buflen > 0);
     tmp = SDL_small_alloc(char, buflen, &isstack);
     if (tmp == NULL) {
-        SDL_OutOfMemory();
-        return;
+        return SDL_OutOfMemory();
     }
 
     *tmp = '\0';
@@ -100,4 +99,5 @@ void SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
     }
 
     SDL_small_free(tmp, isstack);
+    return 0;
 }

+ 2 - 1
src/locale/vita/SDL_syslocale.c

@@ -25,7 +25,7 @@
 #include <psp2/apputil.h>
 #include <psp2/system_param.h>
 
-void SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
+int SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
 {
     const char *vita_locales[] = {
         "ja_JP",
@@ -65,4 +65,5 @@ void SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
     SDL_strlcpy(buf, vita_locales[language], buflen);
 
     sceAppUtilShutdown();
+    return 0;
 }

+ 5 - 4
src/locale/windows/SDL_syslocale.c

@@ -54,7 +54,7 @@ static void SDL_SYS_GetPreferredLocales_winxp(char *buf, size_t buflen)
 }
 
 /* this works on Windows Vista and later. */
-static void SDL_SYS_GetPreferredLocales_vista(char *buf, size_t buflen)
+static int SDL_SYS_GetPreferredLocales_vista(char *buf, size_t buflen)
 {
     ULONG numlangs = 0;
     WCHAR *wbuf = NULL;
@@ -66,8 +66,7 @@ static void SDL_SYS_GetPreferredLocales_vista(char *buf, size_t buflen)
 
     wbuf = SDL_small_alloc(WCHAR, wbuflen, &isstack);
     if (wbuf == NULL) {
-        SDL_OutOfMemory();
-        return;
+        return SDL_OutOfMemory();
     }
 
     if (!pGetUserPreferredUILanguages(MUI_LANGUAGE_NAME, &numlangs, wbuf, &wbuflen)) {
@@ -91,9 +90,10 @@ static void SDL_SYS_GetPreferredLocales_vista(char *buf, size_t buflen)
     }
 
     SDL_small_free(wbuf, isstack);
+    return 0;
 }
 
-void SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
+int SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
 {
     if (!kernel32) {
         kernel32 = GetModuleHandle(TEXT("kernel32.dll"));
@@ -107,4 +107,5 @@ void SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
     } else {
         SDL_SYS_GetPreferredLocales_vista(buf, buflen); /* available on Vista and later. */
     }
+    return 0;
 }

+ 2 - 1
src/locale/winrt/SDL_syslocale.c

@@ -27,7 +27,7 @@
 /*using namespace Windows::Graphics::Display;*/
 #include <wchar.h>
 
-void SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
+int SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
 {
     WCHAR wbuffer[128] = L"";
     int ret = 0;
@@ -50,4 +50,5 @@ void SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
             buf[i] = (char)wbuffer[i]; /* assume this was ASCII anyhow. */
         }
     }
+    return 0;
 }

+ 15 - 11
src/render/SDL_render.c

@@ -2013,12 +2013,12 @@ static void SDL_UnlockTextureNative(SDL_Texture *texture)
     SDL_UnlockTexture(native);
 }
 
-void SDL_UnlockTexture(SDL_Texture *texture)
+int SDL_UnlockTexture(SDL_Texture *texture)
 {
-    CHECK_TEXTURE_MAGIC(texture, );
+    CHECK_TEXTURE_MAGIC(texture, -1);
 
     if (texture->access != SDL_TEXTUREACCESS_STREAMING) {
-        return;
+        return 0;
     }
 #if SDL_HAVE_YUV
     if (texture->yuv) {
@@ -2034,6 +2034,7 @@ void SDL_UnlockTexture(SDL_Texture *texture)
 
     SDL_DestroySurface(texture->locked_surface);
     texture->locked_surface = NULL;
+    return 0;
 }
 
 static int SDL_SetRenderTargetInternal(SDL_Renderer *renderer, SDL_Texture *texture)
@@ -4002,11 +4003,11 @@ static void SDL_RenderLogicalBorders(SDL_Renderer *renderer)
     }
 }
 
-void SDL_RenderPresent(SDL_Renderer *renderer)
+int SDL_RenderPresent(SDL_Renderer *renderer)
 {
     SDL_bool presented = SDL_TRUE;
 
-    CHECK_RENDERER_MAGIC(renderer, );
+    CHECK_RENDERER_MAGIC(renderer, -1);
 
     if (renderer->logical_target) {
         SDL_SetRenderTargetInternal(renderer, NULL);
@@ -4034,13 +4035,14 @@ void SDL_RenderPresent(SDL_Renderer *renderer)
         (!presented && renderer->wanted_vsync)) {
         SDL_SimulateRenderVSync(renderer);
     }
+    return 0;
 }
 
-static void SDL_DestroyTextureInternal(SDL_Texture *texture, SDL_bool is_destroying)
+static int SDL_DestroyTextureInternal(SDL_Texture *texture, SDL_bool is_destroying)
 {
     SDL_Renderer *renderer;
 
-    CHECK_TEXTURE_MAGIC(texture, );
+    CHECK_TEXTURE_MAGIC(texture, -1);
 
     renderer = texture->renderer;
     if (is_destroying) {
@@ -4084,11 +4086,12 @@ static void SDL_DestroyTextureInternal(SDL_Texture *texture, SDL_bool is_destroy
     texture->locked_surface = NULL;
 
     SDL_free(texture);
+    return 0;
 }
 
-void SDL_DestroyTexture(SDL_Texture *texture)
+int SDL_DestroyTexture(SDL_Texture *texture)
 {
-    SDL_DestroyTextureInternal(texture, SDL_FALSE /* is_destroying */);
+    return SDL_DestroyTextureInternal(texture, SDL_FALSE /* is_destroying */);
 }
 
 static void SDL_DiscardAllCommands(SDL_Renderer *renderer)
@@ -4113,9 +4116,9 @@ static void SDL_DiscardAllCommands(SDL_Renderer *renderer)
     }
 }
 
-void SDL_DestroyRenderer(SDL_Renderer *renderer)
+int SDL_DestroyRenderer(SDL_Renderer *renderer)
 {
-    CHECK_RENDERER_MAGIC(renderer, );
+    CHECK_RENDERER_MAGIC(renderer, -1);
 
     SDL_DelEventWatch(SDL_RendererEventWatch, renderer);
 
@@ -4144,6 +4147,7 @@ void SDL_DestroyRenderer(SDL_Renderer *renderer)
 
     /* Free the renderer instance */
     renderer->DestroyRenderer(renderer);
+    return 0;
 }
 
 int SDL_GL_BindTexture(SDL_Texture *texture, float *texw, float *texh)

+ 3 - 2
src/video/SDL_egl.c

@@ -1202,18 +1202,19 @@ int SDL_EGL_SwapBuffers(_THIS, EGLSurface egl_surface)
     return 0;
 }
 
-void SDL_EGL_DeleteContext(_THIS, SDL_GLContext context)
+int SDL_EGL_DeleteContext(_THIS, SDL_GLContext context)
 {
     EGLContext egl_context = (EGLContext)context;
 
     /* Clean up GLES and EGL */
     if (!_this->egl_data) {
-        return;
+        return 0;
     }
 
     if (egl_context != NULL && egl_context != EGL_NO_CONTEXT) {
         _this->egl_data->eglDestroyContext(_this->egl_data->egl_display, egl_context);
     }
+    return 0;
 }
 
 EGLSurface *

+ 1 - 1
src/video/SDL_egl_c.h

@@ -128,7 +128,7 @@ extern void SDL_EGL_SetRequiredVisualId(_THIS, int visual_id);
 extern int SDL_EGL_ChooseConfig(_THIS);
 extern int SDL_EGL_SetSwapInterval(_THIS, int interval);
 extern int SDL_EGL_GetSwapInterval(_THIS, int *interval);
-extern void SDL_EGL_DeleteContext(_THIS, SDL_GLContext context);
+extern int SDL_EGL_DeleteContext(_THIS, SDL_GLContext context);
 extern EGLSurface *SDL_EGL_CreateSurface(_THIS, NativeWindowType nw);
 extern void SDL_EGL_DestroySurface(_THIS, EGLSurface egl_surface);
 

+ 8 - 8
src/video/SDL_pixels.c

@@ -623,20 +623,19 @@ int SDL_InitFormat(SDL_PixelFormat *format, Uint32 pixel_format)
     return 0;
 }
 
-void SDL_DestroyPixelFormat(SDL_PixelFormat *format)
+int SDL_DestroyPixelFormat(SDL_PixelFormat *format)
 {
     SDL_PixelFormat *prev;
 
     if (format == NULL) {
-        SDL_InvalidParamError("format");
-        return;
+        return SDL_InvalidParamError("format");
     }
 
     SDL_AtomicLock(&formats_lock);
 
     if (--format->refcount > 0) {
         SDL_AtomicUnlock(&formats_lock);
-        return;
+        return 0;
     }
 
     /* Remove this format from our list */
@@ -657,6 +656,7 @@ void SDL_DestroyPixelFormat(SDL_PixelFormat *format)
         SDL_DestroyPalette(format->palette);
     }
     SDL_free(format);
+    return 0;
 }
 
 SDL_Palette *
@@ -744,17 +744,17 @@ int SDL_SetPaletteColors(SDL_Palette *palette, const SDL_Color *colors,
     return status;
 }
 
-void SDL_DestroyPalette(SDL_Palette *palette)
+int SDL_DestroyPalette(SDL_Palette *palette)
 {
     if (palette == NULL) {
-        SDL_InvalidParamError("palette");
-        return;
+        return SDL_InvalidParamError("palette");
     }
     if (--palette->refcount > 0) {
-        return;
+        return 0;
     }
     SDL_free(palette->colors);
     SDL_free(palette);
+    return 0;
 }
 
 /*

+ 7 - 9
src/video/SDL_rect_impl.h

@@ -118,29 +118,26 @@ SDL_INTERSECTRECT(const RECTTYPE *A, const RECTTYPE *B, RECTTYPE *result)
     return !SDL_RECTEMPTY(result);
 }
 
-void SDL_UNIONRECT(const RECTTYPE *A, const RECTTYPE *B, RECTTYPE *result)
+int SDL_UNIONRECT(const RECTTYPE *A, const RECTTYPE *B, RECTTYPE *result)
 {
     SCALARTYPE Amin, Amax, Bmin, Bmax;
 
     if (A == NULL) {
-        SDL_InvalidParamError("A");
-        return;
+        return SDL_InvalidParamError("A");
     } else if (B == NULL) {
-        SDL_InvalidParamError("B");
-        return;
+        return SDL_InvalidParamError("B");
     } else if (result == NULL) {
-        SDL_InvalidParamError("result");
-        return;
+        return SDL_InvalidParamError("result");
     } else if (SDL_RECTEMPTY(A)) { /* Special cases for empty Rects */
         if (SDL_RECTEMPTY(B)) {    /* A and B empty */
             SDL_zerop(result);
         } else { /* A empty, B not empty */
             *result = *B;
         }
-        return;
+        return 0;
     } else if (SDL_RECTEMPTY(B)) { /* A not empty, B empty */
         *result = *A;
-        return;
+        return 0;
     }
 
     /* Horizontal union */
@@ -170,6 +167,7 @@ void SDL_UNIONRECT(const RECTTYPE *A, const RECTTYPE *B, RECTTYPE *result)
         Amax = Bmax;
     }
     result->h = Amax - Amin;
+    return 0;
 }
 
 SDL_bool SDL_ENCLOSEPOINTS(const POINTTYPE *points, int count, const RECTTYPE *clip,

+ 3 - 3
src/video/SDL_sysvideo.h

@@ -232,7 +232,7 @@ struct SDL_VideoDevice
     /*
      * Get a list of the available display modes for a display.
      */
-    void (*GetDisplayModes)(_THIS, SDL_VideoDisplay *display);
+    int (*GetDisplayModes)(_THIS, SDL_VideoDisplay *display);
 
     /*
      * Setting the display mode is independent of creating windows, so
@@ -303,7 +303,7 @@ struct SDL_VideoDevice
     int (*GL_SetSwapInterval)(_THIS, int interval);
     int (*GL_GetSwapInterval)(_THIS, int *interval);
     int (*GL_SwapWindow)(_THIS, SDL_Window *window);
-    void (*GL_DeleteContext)(_THIS, SDL_GLContext context);
+    int (*GL_DeleteContext)(_THIS, SDL_GLContext context);
     void (*GL_DefaultProfileConfig)(_THIS, int *mask, int *major, int *minor);
 
     /* * * */
@@ -337,7 +337,7 @@ struct SDL_VideoDevice
     /* Text input */
     void (*StartTextInput)(_THIS);
     void (*StopTextInput)(_THIS);
-    void (*SetTextInputRect)(_THIS, const SDL_Rect *rect);
+    int (*SetTextInputRect)(_THIS, const SDL_Rect *rect);
     void (*ClearComposition)(_THIS);
     SDL_bool (*IsTextInputShown)(_THIS);
 

+ 80 - 53
src/video/SDL_video.c

@@ -2157,9 +2157,9 @@ void *SDL_GetWindowData(SDL_Window *window, const char *name)
     return NULL;
 }
 
-void SDL_SetWindowPosition(SDL_Window *window, int x, int y)
+int SDL_SetWindowPosition(SDL_Window *window, int x, int y)
 {
-    CHECK_WINDOW_MAGIC(window, );
+    CHECK_WINDOW_MAGIC(window, -1);
 
     if (SDL_WINDOWPOS_ISCENTERED(x) || SDL_WINDOWPOS_ISCENTERED(y)) {
         SDL_DisplayID displayID = 0;
@@ -2201,11 +2201,12 @@ void SDL_SetWindowPosition(SDL_Window *window, int x, int y)
             _this->SetWindowPosition(_this, window);
         }
     }
+    return 0;
 }
 
-void SDL_GetWindowPosition(SDL_Window *window, int *x, int *y)
+int SDL_GetWindowPosition(SDL_Window *window, int *x, int *y)
 {
-    CHECK_WINDOW_MAGIC(window, );
+    CHECK_WINDOW_MAGIC(window, -1);
 
     /* Fullscreen windows are always at their display's origin */
     if (window->flags & SDL_WINDOW_FULLSCREEN) {
@@ -2242,11 +2243,12 @@ void SDL_GetWindowPosition(SDL_Window *window, int *x, int *y)
             *y = window->y;
         }
     }
+    return 0;
 }
 
-void SDL_SetWindowBordered(SDL_Window *window, SDL_bool bordered)
+int SDL_SetWindowBordered(SDL_Window *window, SDL_bool bordered)
 {
-    CHECK_WINDOW_MAGIC(window, );
+    CHECK_WINDOW_MAGIC(window, -1);
     if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
         const int want = (bordered != SDL_FALSE); /* normalize the flag. */
         const int have = !(window->flags & SDL_WINDOW_BORDERLESS);
@@ -2259,11 +2261,12 @@ void SDL_SetWindowBordered(SDL_Window *window, SDL_bool bordered)
             _this->SetWindowBordered(_this, window, (SDL_bool)want);
         }
     }
+    return 0;
 }
 
-void SDL_SetWindowResizable(SDL_Window *window, SDL_bool resizable)
+int SDL_SetWindowResizable(SDL_Window *window, SDL_bool resizable)
 {
-    CHECK_WINDOW_MAGIC(window, );
+    CHECK_WINDOW_MAGIC(window, -1);
     if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
         const int want = (resizable != SDL_FALSE); /* normalize the flag. */
         const int have = ((window->flags & SDL_WINDOW_RESIZABLE) != 0);
@@ -2276,11 +2279,12 @@ void SDL_SetWindowResizable(SDL_Window *window, SDL_bool resizable)
             _this->SetWindowResizable(_this, window, (SDL_bool)want);
         }
     }
+    return 0;
 }
 
-void SDL_SetWindowAlwaysOnTop(SDL_Window *window, SDL_bool on_top)
+int SDL_SetWindowAlwaysOnTop(SDL_Window *window, SDL_bool on_top)
 {
-    CHECK_WINDOW_MAGIC(window, );
+    CHECK_WINDOW_MAGIC(window, -1);
     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);
@@ -2293,6 +2297,7 @@ void SDL_SetWindowAlwaysOnTop(SDL_Window *window, SDL_bool on_top)
             _this->SetWindowAlwaysOnTop(_this, window, (SDL_bool)want);
         }
     }
+    return 0;
 }
 
 int SDL_SetWindowSize(SDL_Window *window, int w, int h)
@@ -2330,15 +2335,16 @@ int SDL_SetWindowSize(SDL_Window *window, int w, int h)
     return 0;
 }
 
-void SDL_GetWindowSize(SDL_Window *window, int *w, int *h)
+int SDL_GetWindowSize(SDL_Window *window, int *w, int *h)
 {
-    CHECK_WINDOW_MAGIC(window, );
+    CHECK_WINDOW_MAGIC(window, -1);
     if (w) {
         *w = window->w;
     }
     if (h) {
         *h = window->h;
     }
+    return 0;
 }
 
 int SDL_GetWindowBordersSize(SDL_Window *window, int *top, int *left, int *bottom, int *right)
@@ -2370,11 +2376,11 @@ int SDL_GetWindowBordersSize(SDL_Window *window, int *top, int *left, int *botto
     return _this->GetWindowBordersSize(_this, window, top, left, bottom, right);
 }
 
-void SDL_GetWindowSizeInPixels(SDL_Window *window, int *w, int *h)
+int SDL_GetWindowSizeInPixels(SDL_Window *window, int *w, int *h)
 {
     int filter;
 
-    CHECK_WINDOW_MAGIC(window, );
+    CHECK_WINDOW_MAGIC(window, -1);
 
     if (w == NULL) {
         w = &filter;
@@ -2410,6 +2416,7 @@ void SDL_GetWindowSizeInPixels(SDL_Window *window, int *w, int *h)
             }
         }
     }
+    return 0;
 }
 
 int SDL_SetWindowMinimumSize(SDL_Window *window, int min_w, int min_h)
@@ -2440,15 +2447,16 @@ int SDL_SetWindowMinimumSize(SDL_Window *window, int min_w, int min_h)
     return 0;
 }
 
-void SDL_GetWindowMinimumSize(SDL_Window *window, int *min_w, int *min_h)
+int SDL_GetWindowMinimumSize(SDL_Window *window, int *min_w, int *min_h)
 {
-    CHECK_WINDOW_MAGIC(window, );
+    CHECK_WINDOW_MAGIC(window, -1);
     if (min_w) {
         *min_w = window->min_w;
     }
     if (min_h) {
         *min_h = window->min_h;
     }
+    return 0;
 }
 
 int SDL_SetWindowMaximumSize(SDL_Window *window, int max_w, int max_h)
@@ -2478,37 +2486,39 @@ int SDL_SetWindowMaximumSize(SDL_Window *window, int max_w, int max_h)
     return 0;
 }
 
-void SDL_GetWindowMaximumSize(SDL_Window *window, int *max_w, int *max_h)
+int SDL_GetWindowMaximumSize(SDL_Window *window, int *max_w, int *max_h)
 {
-    CHECK_WINDOW_MAGIC(window, );
+    CHECK_WINDOW_MAGIC(window, -1);
     if (max_w) {
         *max_w = window->max_w;
     }
     if (max_h) {
         *max_h = window->max_h;
     }
+    return 0;
 }
 
-void SDL_ShowWindow(SDL_Window *window)
+int SDL_ShowWindow(SDL_Window *window)
 {
-    CHECK_WINDOW_MAGIC(window, );
+    CHECK_WINDOW_MAGIC(window, -1);
 
     if (!(window->flags & SDL_WINDOW_HIDDEN)) {
-        return;
+        return 0;
     }
 
     if (_this->ShowWindow) {
         _this->ShowWindow(_this, window);
     }
     SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_SHOWN, 0, 0);
+    return 0;
 }
 
-void SDL_HideWindow(SDL_Window *window)
+int SDL_HideWindow(SDL_Window *window)
 {
-    CHECK_WINDOW_MAGIC(window, );
+    CHECK_WINDOW_MAGIC(window, -1);
 
     if (window->flags & SDL_WINDOW_HIDDEN) {
-        return;
+        return 0;
     }
 
     window->is_hiding = SDL_TRUE;
@@ -2519,26 +2529,28 @@ void SDL_HideWindow(SDL_Window *window)
     }
     window->is_hiding = SDL_FALSE;
     SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_HIDDEN, 0, 0);
+    return 0;
 }
 
-void SDL_RaiseWindow(SDL_Window *window)
+int SDL_RaiseWindow(SDL_Window *window)
 {
-    CHECK_WINDOW_MAGIC(window, );
+    CHECK_WINDOW_MAGIC(window, -1);
 
     if (window->flags & SDL_WINDOW_HIDDEN) {
-        return;
+        return 0;
     }
     if (_this->RaiseWindow) {
         _this->RaiseWindow(_this, window);
     }
+    return 0;
 }
 
-void SDL_MaximizeWindow(SDL_Window *window)
+int SDL_MaximizeWindow(SDL_Window *window)
 {
-    CHECK_WINDOW_MAGIC(window, );
+    CHECK_WINDOW_MAGIC(window, -1);
 
     if (window->flags & SDL_WINDOW_MAXIMIZED) {
-        return;
+        return 0;
     }
 
     /* !!! FIXME: should this check if the window is resizable? */
@@ -2546,6 +2558,7 @@ void SDL_MaximizeWindow(SDL_Window *window)
     if (_this->MaximizeWindow) {
         _this->MaximizeWindow(_this, window);
     }
+    return 0;
 }
 
 static SDL_bool SDL_CanMinimizeWindow(SDL_Window *window)
@@ -2556,16 +2569,16 @@ static SDL_bool SDL_CanMinimizeWindow(SDL_Window *window)
     return SDL_TRUE;
 }
 
-void SDL_MinimizeWindow(SDL_Window *window)
+int SDL_MinimizeWindow(SDL_Window *window)
 {
-    CHECK_WINDOW_MAGIC(window, );
+    CHECK_WINDOW_MAGIC(window, -1);
 
     if (window->flags & SDL_WINDOW_MINIMIZED) {
-        return;
+        return 0;
     }
 
     if (!SDL_CanMinimizeWindow(window)) {
-        return;
+        return 0;
     }
 
     if (!DisableUnsetFullscreenOnMinimize(_this)) {
@@ -2575,19 +2588,21 @@ void SDL_MinimizeWindow(SDL_Window *window)
     if (_this->MinimizeWindow) {
         _this->MinimizeWindow(_this, window);
     }
+    return 0;
 }
 
-void SDL_RestoreWindow(SDL_Window *window)
+int SDL_RestoreWindow(SDL_Window *window)
 {
-    CHECK_WINDOW_MAGIC(window, );
+    CHECK_WINDOW_MAGIC(window, -1);
 
     if (!(window->flags & (SDL_WINDOW_MAXIMIZED | SDL_WINDOW_MINIMIZED))) {
-        return;
+        return 0;
     }
 
     if (_this->RestoreWindow) {
         _this->RestoreWindow(_this, window);
     }
+    return 0;
 }
 
 int SDL_SetWindowFullscreen(SDL_Window *window, SDL_bool fullscreen)
@@ -2840,23 +2855,24 @@ void SDL_UpdateWindowGrab(SDL_Window *window)
     }
 }
 
-void SDL_SetWindowGrab(SDL_Window *window, SDL_bool grabbed)
+int SDL_SetWindowGrab(SDL_Window *window, SDL_bool grabbed)
 {
-    CHECK_WINDOW_MAGIC(window, );
+    CHECK_WINDOW_MAGIC(window, -1);
 
     SDL_SetWindowMouseGrab(window, grabbed);
 
     if (SDL_GetHintBoolean(SDL_HINT_GRAB_KEYBOARD, SDL_FALSE)) {
         SDL_SetWindowKeyboardGrab(window, grabbed);
     }
+    return 0;
 }
 
-void SDL_SetWindowKeyboardGrab(SDL_Window *window, SDL_bool grabbed)
+int SDL_SetWindowKeyboardGrab(SDL_Window *window, SDL_bool grabbed)
 {
-    CHECK_WINDOW_MAGIC(window, );
+    CHECK_WINDOW_MAGIC(window, -1);
 
     if (!!grabbed == !!(window->flags & SDL_WINDOW_KEYBOARD_GRABBED)) {
-        return;
+        return 0;
     }
     if (grabbed) {
         window->flags |= SDL_WINDOW_KEYBOARD_GRABBED;
@@ -2864,14 +2880,15 @@ void SDL_SetWindowKeyboardGrab(SDL_Window *window, SDL_bool grabbed)
         window->flags &= ~SDL_WINDOW_KEYBOARD_GRABBED;
     }
     SDL_UpdateWindowGrab(window);
+    return 0;
 }
 
-void SDL_SetWindowMouseGrab(SDL_Window *window, SDL_bool grabbed)
+int SDL_SetWindowMouseGrab(SDL_Window *window, SDL_bool grabbed)
 {
-    CHECK_WINDOW_MAGIC(window, );
+    CHECK_WINDOW_MAGIC(window, -1);
 
     if (!!grabbed == !!(window->flags & SDL_WINDOW_MOUSE_GRABBED)) {
-        return;
+        return 0;
     }
     if (grabbed) {
         window->flags |= SDL_WINDOW_MOUSE_GRABBED;
@@ -2879,6 +2896,7 @@ void SDL_SetWindowMouseGrab(SDL_Window *window, SDL_bool grabbed)
         window->flags &= ~SDL_WINDOW_MOUSE_GRABBED;
     }
     SDL_UpdateWindowGrab(window);
+    return 0;
 }
 
 SDL_bool SDL_GetWindowGrab(SDL_Window *window)
@@ -3127,11 +3145,11 @@ SDL_Window *SDL_GetFocusWindow(void)
     return NULL;
 }
 
-void SDL_DestroyWindow(SDL_Window *window)
+int SDL_DestroyWindow(SDL_Window *window)
 {
     SDL_VideoDisplay *display;
 
-    CHECK_WINDOW_MAGIC(window, );
+    CHECK_WINDOW_MAGIC(window, -1);
 
     window->is_destroying = SDL_TRUE;
 
@@ -3208,6 +3226,7 @@ void SDL_DestroyWindow(SDL_Window *window)
     }
 
     SDL_free(window);
+    return 0;
 }
 
 SDL_bool SDL_ScreenSaverEnabled()
@@ -4129,17 +4148,20 @@ int SDL_GL_SwapWindow(SDL_Window *window)
     return _this->GL_SwapWindow(_this, window);
 }
 
-void SDL_GL_DeleteContext(SDL_GLContext context)
+int SDL_GL_DeleteContext(SDL_GLContext context)
 {
-    if (_this == NULL || !context) {
-        return;
+    if (_this == NULL) {
+        return SDL_UninitializedVideo();                                       \
+    }
+    if (!context) {
+        return SDL_InvalidParamError("context");
     }
 
     if (SDL_GL_GetCurrentContext() == context) {
         SDL_GL_MakeCurrent(NULL, NULL);
     }
 
-    _this->GL_DeleteContext(_this, context);
+    return _this->GL_DeleteContext(_this, context);
 }
 
 #if 0 /* FIXME */
@@ -4327,11 +4349,16 @@ void SDL_StopTextInput(void)
     SDL_SetEventEnabled(SDL_EVENT_TEXT_EDITING, SDL_FALSE);
 }
 
-void SDL_SetTextInputRect(const SDL_Rect *rect)
+int SDL_SetTextInputRect(const SDL_Rect *rect)
 {
+    if (rect == NULL) {
+        return SDL_InvalidParamError("rect");
+    }
+
     if (_this && _this->SetTextInputRect) {
-        _this->SetTextInputRect(_this, rect);
+        return _this->SetTextInputRect(_this, rect);
     }
+    return SDL_Unsupported();
 }
 
 SDL_bool SDL_HasScreenKeyboardSupport(void)

+ 2 - 7
src/video/android/SDL_androidkeyboard.c

@@ -359,16 +359,11 @@ void Android_StopTextInput(_THIS)
     Android_JNI_HideTextInput();
 }
 
-void Android_SetTextInputRect(_THIS, const SDL_Rect *rect)
+int Android_SetTextInputRect(_THIS, const SDL_Rect *rect)
 {
     SDL_VideoData *videodata = _this->driverdata;
-
-    if (rect == NULL) {
-        SDL_InvalidParamError("rect");
-        return;
-    }
-
     videodata->textRect = *rect;
+    return 0;
 }
 
 #endif /* SDL_VIDEO_DRIVER_ANDROID */

+ 1 - 1
src/video/android/SDL_androidkeyboard.h

@@ -30,4 +30,4 @@ extern SDL_bool Android_IsScreenKeyboardShown(_THIS, SDL_Window *window);
 
 extern void Android_StartTextInput(_THIS);
 extern void Android_StopTextInput(_THIS);
-extern void Android_SetTextInputRect(_THIS, const SDL_Rect *rect);
+extern int Android_SetTextInputRect(_THIS, const SDL_Rect *rect);

+ 1 - 1
src/video/cocoa/SDL_cocoakeyboard.h

@@ -29,7 +29,7 @@ extern void Cocoa_QuitKeyboard(_THIS);
 
 extern void Cocoa_StartTextInput(_THIS);
 extern void Cocoa_StopTextInput(_THIS);
-extern void Cocoa_SetTextInputRect(_THIS, const SDL_Rect *rect);
+extern int Cocoa_SetTextInputRect(_THIS, const SDL_Rect *rect);
 
 extern void Cocoa_SetWindowKeyboardGrab(_THIS, SDL_Window *window, SDL_bool grabbed);
 

+ 2 - 7
src/video/cocoa/SDL_cocoakeyboard.m

@@ -354,16 +354,11 @@ void Cocoa_StopTextInput(_THIS)
     }
 }
 
-void Cocoa_SetTextInputRect(_THIS, const SDL_Rect *rect)
+int Cocoa_SetTextInputRect(_THIS, const SDL_Rect *rect)
 {
     SDL_VideoData *data = _this->driverdata;
-
-    if (!rect) {
-        SDL_InvalidParamError("rect");
-        return;
-    }
-
     [data.fieldEdit setInputRect:rect];
+    return 0;
 }
 
 void Cocoa_HandleKeyEvent(_THIS, NSEvent *event)

+ 1 - 1
src/video/cocoa/SDL_cocoamodes.h

@@ -36,7 +36,7 @@ struct SDL_DisplayModeData
 extern void Cocoa_InitModes(_THIS);
 extern int Cocoa_GetDisplayBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect);
 extern int Cocoa_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect);
-extern void Cocoa_GetDisplayModes(_THIS, SDL_VideoDisplay *display);
+extern int Cocoa_GetDisplayModes(_THIS, SDL_VideoDisplay *display);
 extern int Cocoa_GetDisplayPhysicalDPI(_THIS, SDL_VideoDisplay *display, float *ddpi, float *hdpi, float *vdpi);
 extern int Cocoa_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode);
 extern void Cocoa_QuitModes(_THIS);

+ 2 - 1
src/video/cocoa/SDL_cocoamodes.m

@@ -473,7 +473,7 @@ int Cocoa_GetDisplayPhysicalDPI(_THIS, SDL_VideoDisplay *display, float *ddpi, f
     }
 }
 
-void Cocoa_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
+int Cocoa_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
 {
     SDL_DisplayData *data = display->driverdata;
     CVDisplayLinkRef link = NULL;
@@ -529,6 +529,7 @@ void Cocoa_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
     }
 
     CVDisplayLinkRelease(link);
+    return 0;
 }
 
 static CGError SetDisplayModeForDisplay(CGDirectDisplayID display, SDL_DisplayModeData *data)

+ 2 - 2
src/video/cocoa/SDL_cocoamouse.m

@@ -289,9 +289,9 @@ static int Cocoa_WarpMouseGlobal(float x, float y)
     return 0;
 }
 
-static void Cocoa_WarpMouse(SDL_Window *window, float x, float y)
+static int Cocoa_WarpMouse(SDL_Window *window, float x, float y)
 {
-    Cocoa_WarpMouseGlobal(window->x + x, window->y + y);
+    return Cocoa_WarpMouseGlobal(window->x + x, window->y + y);
 }
 
 static int Cocoa_SetRelativeMouseMode(SDL_bool enabled)

+ 1 - 1
src/video/cocoa/SDL_cocoaopengl.h

@@ -78,7 +78,7 @@ extern int Cocoa_GL_MakeCurrent(_THIS, SDL_Window *window,
 extern int Cocoa_GL_SetSwapInterval(_THIS, int interval);
 extern int Cocoa_GL_GetSwapInterval(_THIS, int *interval);
 extern int Cocoa_GL_SwapWindow(_THIS, SDL_Window *window);
-extern void Cocoa_GL_DeleteContext(_THIS, SDL_GLContext context);
+extern int Cocoa_GL_DeleteContext(_THIS, SDL_GLContext context);
 
 #ifdef __clang__
 #pragma clang diagnostic pop

+ 2 - 1
src/video/cocoa/SDL_cocoaopengl.m

@@ -515,12 +515,13 @@ int Cocoa_GL_SwapWindow(_THIS, SDL_Window *window)
     }
 }
 
-void Cocoa_GL_DeleteContext(_THIS, SDL_GLContext context)
+int Cocoa_GL_DeleteContext(_THIS, SDL_GLContext context)
 {
     @autoreleasepool {
         SDLOpenGLContext *nscontext = (SDLOpenGLContext *)CFBridgingRelease(context);
         [nscontext setWindow:NULL];
     }
+    return 0;
 }
 
 /* We still support OpenGL as long as Apple offers it, deprecated or not, so disable deprecation warnings about it. */

+ 1 - 1
src/video/cocoa/SDL_cocoaopengles.h

@@ -39,7 +39,7 @@ extern int Cocoa_GLES_LoadLibrary(_THIS, const char *path);
 extern SDL_GLContext Cocoa_GLES_CreateContext(_THIS, SDL_Window *window);
 extern int Cocoa_GLES_SwapWindow(_THIS, SDL_Window *window);
 extern int Cocoa_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context);
-extern void Cocoa_GLES_DeleteContext(_THIS, SDL_GLContext context);
+extern int Cocoa_GLES_DeleteContext(_THIS, SDL_GLContext context);
 extern int Cocoa_GLES_SetupWindow(_THIS, SDL_Window *window);
 extern SDL_EGLSurface Cocoa_GLES_GetEGLSurface(_THIS, SDL_Window *window);
 

+ 2 - 1
src/video/cocoa/SDL_cocoaopengles.m

@@ -92,12 +92,13 @@ Cocoa_GLES_CreateContext(_THIS, SDL_Window *window)
     }
 }
 
-void Cocoa_GLES_DeleteContext(_THIS, SDL_GLContext context)
+int Cocoa_GLES_DeleteContext(_THIS, SDL_GLContext context)
 {
     @autoreleasepool {
         SDL_EGL_DeleteContext(_this, context);
         Cocoa_GLES_UnloadLibrary(_this);
     }
+    return 0;
 }
 
 int Cocoa_GLES_SwapWindow(_THIS, SDL_Window *window)

+ 2 - 1
src/video/emscripten/SDL_emscriptenopengles.c

@@ -112,7 +112,7 @@ SDL_GLContext Emscripten_GLES_CreateContext(_THIS, SDL_Window *window)
     return (SDL_GLContext)context;
 }
 
-void Emscripten_GLES_DeleteContext(_THIS, SDL_GLContext context)
+int Emscripten_GLES_DeleteContext(_THIS, SDL_GLContext context)
 {
     SDL_Window *window;
 
@@ -126,6 +126,7 @@ void Emscripten_GLES_DeleteContext(_THIS, SDL_GLContext context)
     }
 
     emscripten_webgl_destroy_context((EMSCRIPTEN_WEBGL_CONTEXT_HANDLE)context);
+    return 0;
 }
 
 int Emscripten_GLES_SwapWindow(_THIS, SDL_Window *window)

+ 1 - 1
src/video/emscripten/SDL_emscriptenopengles.h

@@ -34,7 +34,7 @@ extern SDL_FunctionPointer Emscripten_GLES_GetProcAddress(_THIS, const char *pro
 extern int Emscripten_GLES_SetSwapInterval(_THIS, int interval);
 extern int Emscripten_GLES_GetSwapInterval(_THIS, int *interval);
 extern SDL_GLContext Emscripten_GLES_CreateContext(_THIS, SDL_Window *window);
-extern void Emscripten_GLES_DeleteContext(_THIS, SDL_GLContext context);
+extern int Emscripten_GLES_DeleteContext(_THIS, SDL_GLContext context);
 extern int Emscripten_GLES_SwapWindow(_THIS, SDL_Window *window);
 extern int Emscripten_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context);
 

+ 2 - 1
src/video/haiku/SDL_bmodes.cc

@@ -226,7 +226,7 @@ int HAIKU_GetDisplayBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect) {
     return 0;
 }
 
-void HAIKU_GetDisplayModes(_THIS, SDL_VideoDisplay *display) {
+int HAIKU_GetDisplayModes(_THIS, SDL_VideoDisplay *display) {
     /* Get the current screen */
     BScreen bscreen;
 
@@ -248,6 +248,7 @@ void HAIKU_GetDisplayModes(_THIS, SDL_VideoDisplay *display) {
         }
     }
     free(bmodes); /* This should not be SDL_free() */
+    return 0;
 }
 
 

+ 1 - 1
src/video/haiku/SDL_bmodes.h

@@ -34,7 +34,7 @@ extern int HAIKU_InitModes(_THIS);
 extern int HAIKU_QuitModes(_THIS);
 extern int HAIKU_GetDisplayBounds(_THIS, SDL_VideoDisplay *display,
                                   SDL_Rect *rect);
-extern void HAIKU_GetDisplayModes(_THIS, SDL_VideoDisplay *display);
+extern int HAIKU_GetDisplayModes(_THIS, SDL_VideoDisplay *display);
 extern int HAIKU_SetDisplayMode(_THIS, SDL_VideoDisplay *display,
                                 SDL_DisplayMode *mode);
 

+ 2 - 1
src/video/haiku/SDL_bopengl.cc

@@ -142,7 +142,7 @@ SDL_GLContext HAIKU_GL_CreateContext(_THIS, SDL_Window * window) {
     return (SDL_GLContext)(bwin->GetGLView());
 }
 
-void HAIKU_GL_DeleteContext(_THIS, SDL_GLContext context) {
+int HAIKU_GL_DeleteContext(_THIS, SDL_GLContext context) {
     // printf("HAIKU_GL_DeleteContext(%llx), thread = %d\n", (uint64)context, find_thread(NULL));
     BGLView* glView = (BGLView*)context;
     SDL_BWin *bwin = (SDL_BWin*)glView->Window();
@@ -151,6 +151,7 @@ void HAIKU_GL_DeleteContext(_THIS, SDL_GLContext context) {
     } else {
         bwin->RemoveGLView();
     }
+    return 0;
 }
 
 

+ 1 - 1
src/video/haiku/SDL_bopengl.h

@@ -39,7 +39,7 @@ extern int HAIKU_GL_SetSwapInterval(_THIS, int interval); /* TODO */
 extern int HAIKU_GL_GetSwapInterval(_THIS, int *interval); /* TODO */
 extern int HAIKU_GL_SwapWindow(_THIS, SDL_Window *window);
 extern SDL_GLContext HAIKU_GL_CreateContext(_THIS, SDL_Window *window);
-extern void HAIKU_GL_DeleteContext(_THIS, SDL_GLContext context);
+extern int HAIKU_GL_DeleteContext(_THIS, SDL_GLContext context);
 
 extern void HAIKU_GL_RebootContexts(_THIS);
 

+ 13 - 16
src/video/kmsdrm/SDL_kmsdrmmouse.c

@@ -35,7 +35,7 @@
 static SDL_Cursor *KMSDRM_CreateDefaultCursor(void);
 static SDL_Cursor *KMSDRM_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y);
 static int KMSDRM_ShowCursor(SDL_Cursor *cursor);
-static void KMSDRM_MoveCursor(SDL_Cursor *cursor);
+static int KMSDRM_MoveCursor(SDL_Cursor *cursor);
 static void KMSDRM_FreeCursor(SDL_Cursor *cursor);
 
 /**************************************************************************************/
@@ -76,7 +76,7 @@ void KMSDRM_DestroyCursorBO(_THIS, SDL_VideoDisplay *display)
 /* Given a display's driverdata, create the cursor BO for it.
    To be called from KMSDRM_CreateWindow(), as that's where we
    build a window and assign a display to it. */
-void KMSDRM_CreateCursorBO(SDL_VideoDisplay *display)
+int KMSDRM_CreateCursorBO(SDL_VideoDisplay *display)
 {
 
     SDL_VideoDevice *dev = SDL_GetVideoDevice();
@@ -86,21 +86,18 @@ void KMSDRM_CreateCursorBO(SDL_VideoDisplay *display)
     if (!KMSDRM_gbm_device_is_format_supported(viddata->gbm_dev,
                                                GBM_FORMAT_ARGB8888,
                                                GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE)) {
-        SDL_SetError("Unsupported pixel format for cursor");
-        return;
+        return SDL_SetError("Unsupported pixel format for cursor");
     }
 
     if (KMSDRM_drmGetCap(viddata->drm_fd,
                          DRM_CAP_CURSOR_WIDTH, &dispdata->cursor_w) ||
         KMSDRM_drmGetCap(viddata->drm_fd, DRM_CAP_CURSOR_HEIGHT,
                          &dispdata->cursor_h)) {
-        SDL_SetError("Could not get the recommended GBM cursor size");
-        return;
+        return SDL_SetError("Could not get the recommended GBM cursor size");
     }
 
     if (dispdata->cursor_w == 0 || dispdata->cursor_h == 0) {
-        SDL_SetError("Could not get an usable GBM cursor size");
-        return;
+        return SDL_SetError("Could not get an usable GBM cursor size");
     }
 
     dispdata->cursor_bo = KMSDRM_gbm_bo_create(viddata->gbm_dev,
@@ -108,11 +105,11 @@ void KMSDRM_CreateCursorBO(SDL_VideoDisplay *display)
                                                GBM_FORMAT_ARGB8888, GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE | GBM_BO_USE_LINEAR);
 
     if (!dispdata->cursor_bo) {
-        SDL_SetError("Could not create GBM cursor BO");
-        return;
+        return SDL_SetError("Could not create GBM cursor BO");
     }
 
     dispdata->cursor_bo_drm_fd = viddata->drm_fd;
+    return 0;
 }
 
 /* Remove a cursor buffer from a display's DRM cursor BO. */
@@ -380,10 +377,10 @@ static int KMSDRM_WarpMouseGlobal(float x, float y)
     }
 }
 
-static void KMSDRM_WarpMouse(SDL_Window *window, float x, float y)
+static int KMSDRM_WarpMouse(SDL_Window *window, float x, float y)
 {
     /* Only one global/fullscreen window is supported */
-    KMSDRM_WarpMouseGlobal(x, y);
+    return KMSDRM_WarpMouseGlobal(x, y);
 }
 
 void KMSDRM_InitMouse(_THIS, SDL_VideoDisplay *display)
@@ -412,7 +409,7 @@ void KMSDRM_QuitMouse(_THIS)
 }
 
 /* This is called when a mouse motion event occurs */
-static void KMSDRM_MoveCursor(SDL_Cursor *cursor)
+static int KMSDRM_MoveCursor(SDL_Cursor *cursor)
 {
     SDL_Mouse *mouse = SDL_GetMouse();
     int ret = 0;
@@ -425,16 +422,16 @@ static void KMSDRM_MoveCursor(SDL_Cursor *cursor)
         SDL_DisplayData *dispdata = SDL_GetDisplayDriverDataForWindow(window);
 
         if (!dispdata->cursor_bo) {
-            SDL_SetError("Cursor not initialized properly.");
-            return;
+            return SDL_SetError("Cursor not initialized properly.");
         }
 
         ret = KMSDRM_drmModeMoveCursor(dispdata->cursor_bo_drm_fd, dispdata->crtc->crtc_id, mouse->x, mouse->y);
 
         if (ret) {
-            SDL_SetError("drmModeMoveCursor() failed.");
+            return SDL_SetError("drmModeMoveCursor() failed.");
         }
     }
+    return 0;
 }
 
 #endif /* SDL_VIDEO_DRIVER_KMSDRM */

+ 1 - 1
src/video/kmsdrm/SDL_kmsdrmmouse.h

@@ -46,7 +46,7 @@ typedef struct KMSDRM_CursorData
 extern void KMSDRM_InitMouse(_THIS, SDL_VideoDisplay *display);
 extern void KMSDRM_QuitMouse(_THIS);
 
-extern void KMSDRM_CreateCursorBO(SDL_VideoDisplay *display);
+extern int KMSDRM_CreateCursorBO(SDL_VideoDisplay *display);
 extern void KMSDRM_DestroyCursorBO(_THIS, SDL_VideoDisplay *display);
 extern void KMSDRM_InitCursor(void);
 

+ 2 - 1
src/video/kmsdrm/SDL_kmsdrmvideo.c

@@ -1281,7 +1281,7 @@ void KMSDRM_VideoQuit(_THIS)
 }
 
 /* Read modes from the connector modes, and store them in display->display_modes. */
-void KMSDRM_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
+int KMSDRM_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
 {
     SDL_DisplayData *dispdata = display->driverdata;
     drmModeConnector *conn = dispdata->connector;
@@ -1306,6 +1306,7 @@ void KMSDRM_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
             SDL_free(modedata);
         }
     }
+    return 0;
 }
 
 int KMSDRM_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)

+ 2 - 2
src/video/kmsdrm/SDL_kmsdrmvideo.h

@@ -119,7 +119,7 @@ SDL_bool KMSDRM_WaitPageflip(_THIS, SDL_WindowData *windata);
 /* Display and window functions */
 int KMSDRM_VideoInit(_THIS);
 void KMSDRM_VideoQuit(_THIS);
-void KMSDRM_GetDisplayModes(_THIS, SDL_VideoDisplay *display);
+int KMSDRM_GetDisplayModes(_THIS, SDL_VideoDisplay *display);
 int KMSDRM_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode);
 int KMSDRM_CreateWindow(_THIS, SDL_Window *window);
 int KMSDRM_CreateWindowFrom(_THIS, SDL_Window *window, const void *data);
@@ -148,6 +148,6 @@ int KMSDRM_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context);
 int KMSDRM_GLES_SetSwapInterval(_THIS, int interval);
 int KMSDRM_GLES_GetSwapInterval(_THIS);
 int KMSDRM_GLES_SwapWindow(_THIS, SDL_Window *window);
-void KMSDRM_GLES_DeleteContext(_THIS, SDL_GLContext context);
+int KMSDRM_GLES_DeleteContext(_THIS, SDL_GLContext context);
 
 #endif /* SDL_kmsdrmvideo_h */

+ 4 - 4
src/video/n3ds/SDL_n3dsvideo.c

@@ -31,7 +31,7 @@
 
 #define N3DSVID_DRIVER_NAME "n3ds"
 
-SDL_FORCE_INLINE void AddN3DSDisplay(gfxScreen_t screen);
+SDL_FORCE_INLINE int AddN3DSDisplay(gfxScreen_t screen);
 
 static int N3DS_VideoInit(_THIS);
 static void N3DS_VideoQuit(_THIS);
@@ -100,14 +100,13 @@ static int N3DS_VideoInit(_THIS)
     return 0;
 }
 
-static void AddN3DSDisplay(gfxScreen_t screen)
+static int AddN3DSDisplay(gfxScreen_t screen)
 {
     SDL_DisplayMode mode;
     SDL_VideoDisplay display;
     SDL_DisplayData *display_driver_data = SDL_calloc(1, sizeof(SDL_DisplayData));
     if (display_driver_data == NULL) {
-        SDL_OutOfMemory();
-        return;
+        return SDL_OutOfMemory();
     }
 
     SDL_zero(mode);
@@ -125,6 +124,7 @@ static void AddN3DSDisplay(gfxScreen_t screen)
     display.driverdata = display_driver_data;
 
     SDL_AddVideoDisplay(&display, SDL_FALSE);
+    return 0;
 }
 
 static void N3DS_VideoQuit(_THIS)

+ 4 - 5
src/video/psp/SDL_pspevents.c

@@ -235,7 +235,7 @@ void PSP_InitOSKeymap(_THIS)
 #endif
 }
 
-void PSP_EventInit(_THIS)
+int PSP_EventInit(_THIS)
 {
 #ifdef PSPIRKEYB
     int outputmode = PSP_IRKBD_OUTPUT_MODE_SCANCODE;
@@ -249,14 +249,13 @@ void PSP_EventInit(_THIS)
 #endif
     /* Start thread to read data */
     if ((event_sem = SDL_CreateSemaphore(1)) == NULL) {
-        SDL_SetError("Can't create input semaphore");
-        return;
+        return SDL_SetError("Can't create input semaphore");
     }
     running = 1;
     if ((thread = SDL_CreateThreadInternal(EventUpdate, "PSPInputThread", 4096, NULL)) == NULL) {
-        SDL_SetError("Can't create input thread");
-        return;
+        return SDL_SetError("Can't create input thread");
     }
+    return 0;
 }
 
 void PSP_EventQuit(_THIS)

+ 4 - 7
src/video/psp/SDL_pspgl.c

@@ -165,14 +165,13 @@ int PSP_GL_SwapWindow(_THIS, SDL_Window *window)
     return 0;
 }
 
-void PSP_GL_DeleteContext(_THIS, SDL_GLContext context)
+int PSP_GL_DeleteContext(_THIS, SDL_GLContext context)
 {
     SDL_VideoData *phdata = _this->driverdata;
     EGLBoolean status;
 
     if (phdata->egl_initialized != SDL_TRUE) {
-        SDL_SetError("PSP: GLES initialization failed, no OpenGL ES support");
-        return;
+        return SDL_SetError("PSP: GLES initialization failed, no OpenGL ES support");
     }
 
     /* Check if OpenGL ES connection has been initialized */
@@ -181,13 +180,11 @@ void PSP_GL_DeleteContext(_THIS, SDL_GLContext context)
             status = eglDestroyContext(_this->gl_data->display, context);
             if (status != EGL_TRUE) {
                 /* Error during OpenGL ES context destroying */
-                SDL_SetError("PSP: OpenGL ES context destroy error");
-                return;
+                return SDL_SetError("PSP: OpenGL ES context destroy error");
             }
         }
     }
-
-    return;
+    return 0;
 }
 
 #endif /* SDL_VIDEO_DRIVER_PSP */

+ 2 - 1
src/video/psp/SDL_pspvideo.c

@@ -153,7 +153,7 @@ void PSP_VideoQuit(_THIS)
 {
 }
 
-void PSP_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
+int PSP_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
 {
     SDL_DisplayMode mode;
 
@@ -169,6 +169,7 @@ void PSP_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
     /* 16 bpp secondary mode */
     mode.format = SDL_PIXELFORMAT_BGR565;
     SDL_AddFullscreenDisplayMode(display, &mode);
+    return 0;
 }
 
 int PSP_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)

+ 2 - 2
src/video/psp/SDL_pspvideo.h

@@ -47,7 +47,7 @@ struct SDL_WindowData
 /* Display and window functions */
 int PSP_VideoInit(_THIS);
 void PSP_VideoQuit(_THIS);
-void PSP_GetDisplayModes(_THIS, SDL_VideoDisplay *display);
+int PSP_GetDisplayModes(_THIS, SDL_VideoDisplay *display);
 int PSP_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode);
 int PSP_CreateWindow(_THIS, SDL_Window *window);
 int PSP_CreateWindowFrom(_THIS, SDL_Window *window, const void *data);
@@ -72,7 +72,7 @@ int PSP_GL_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context);
 int PSP_GL_SetSwapInterval(_THIS, int interval);
 int PSP_GL_GetSwapInterval(_THIS, int *interval);
 int PSP_GL_SwapWindow(_THIS, SDL_Window *window);
-void PSP_GL_DeleteContext(_THIS, SDL_GLContext context);
+int PSP_GL_DeleteContext(_THIS, SDL_GLContext context);
 
 /* PSP on screen keyboard */
 SDL_bool PSP_HasScreenKeyboardSupport(_THIS);

+ 5 - 5
src/video/raspberry/SDL_rpimouse.c

@@ -42,7 +42,7 @@
 static SDL_Cursor *RPI_CreateDefaultCursor(void);
 static SDL_Cursor *RPI_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y);
 static int RPI_ShowCursor(SDL_Cursor *cursor);
-static void RPI_MoveCursor(SDL_Cursor *cursor);
+static int RPI_MoveCursor(SDL_Cursor *cursor);
 static void RPI_FreeCursor(SDL_Cursor *cursor);
 
 static SDL_Cursor *global_cursor;
@@ -283,9 +283,9 @@ static int RPI_WarpMouseGlobal(float x, float y)
     return RPI_WarpMouseGlobalGraphically(x, y);
 }
 
-static void RPI_WarpMouse(SDL_Window *window, float x, float y)
+static int RPI_WarpMouse(SDL_Window *window, float x, float y)
 {
-    RPI_WarpMouseGlobal(x, y);
+    return RPI_WarpMouseGlobal(x, y);
 }
 
 void RPI_InitMouse(_THIS)
@@ -310,12 +310,12 @@ void RPI_QuitMouse(_THIS)
 }
 
 /* This is called when a mouse motion event occurs */
-static void RPI_MoveCursor(SDL_Cursor *cursor)
+static int RPI_MoveCursor(SDL_Cursor *cursor)
 {
     SDL_Mouse *mouse = SDL_GetMouse();
     /* We must NOT call SDL_SendMouseMotion() on the next call or we will enter recursivity,
      * so we create a version of WarpMouseGlobal without it. */
-    RPI_WarpMouseGlobalGraphically(mouse->x, mouse->y);
+    return RPI_WarpMouseGlobalGraphically(mouse->x, mouse->y);
 }
 
 #endif /* SDL_VIDEO_DRIVER_RPI */

+ 2 - 2
src/video/raspberry/SDL_rpivideo.h

@@ -61,7 +61,7 @@ struct SDL_WindowData
 /* Display and window functions */
 int RPI_VideoInit(_THIS);
 void RPI_VideoQuit(_THIS);
-void RPI_GetDisplayModes(_THIS, SDL_VideoDisplay *display);
+int RPI_GetDisplayModes(_THIS, SDL_VideoDisplay *display);
 int RPI_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode);
 int RPI_CreateWindow(_THIS, SDL_Window *window);
 int RPI_CreateWindowFrom(_THIS, SDL_Window *window, const void *data);
@@ -86,6 +86,6 @@ int RPI_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context);
 int RPI_GLES_SetSwapInterval(_THIS, int interval);
 int RPI_GLES_GetSwapInterval(_THIS);
 int RPI_GLES_SwapWindow(_THIS, SDL_Window *window);
-void RPI_GLES_DeleteContext(_THIS, SDL_GLContext context);
+int RPI_GLES_DeleteContext(_THIS, SDL_GLContext context);
 
 #endif /* SDL_rpivideo_h */

+ 7 - 9
src/video/riscos/SDL_riscosmodes.c

@@ -230,7 +230,7 @@ int RISCOS_InitModes(_THIS)
     return 0;
 }
 
-void RISCOS_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
+int RISCOS_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
 {
     SDL_DisplayMode mode;
     _kernel_swi_regs regs;
@@ -243,14 +243,12 @@ void RISCOS_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
     regs.r[7] = 0;
     error = _kernel_swi(OS_ScreenMode, &regs, &regs);
     if (error != NULL) {
-        SDL_SetError("Unable to enumerate screen modes: %s (%i)", error->errmess, error->errnum);
-        return;
+        return SDL_SetError("Unable to enumerate screen modes: %s (%i)", error->errmess, error->errnum);
     }
 
     block = SDL_malloc(-regs.r[7]);
     if (block == NULL) {
-        SDL_OutOfMemory();
-        return;
+        return SDL_OutOfMemory();
     }
 
     regs.r[6] = (int)block;
@@ -258,8 +256,7 @@ void RISCOS_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
     error = _kernel_swi(OS_ScreenMode, &regs, &regs);
     if (error != NULL) {
         SDL_free(block);
-        SDL_SetError("Unable to enumerate screen modes: %s (%i)", error->errmess, error->errnum);
-        return;
+        return SDL_SetError("Unable to enumerate screen modes: %s (%i)", error->errmess, error->errnum);
     }
 
     for (pos = block; pos < (void *)regs.r[6]; pos += *((int *)pos)) {
@@ -273,8 +270,8 @@ void RISCOS_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
 
         mode.driverdata = convert_mode_block(pos + 4);
         if (!mode.driverdata) {
-            SDL_OutOfMemory();
-            break;
+            SDL_free(block);
+            return SDL_OutOfMemory();
         }
 
         if (!SDL_AddFullscreenDisplayMode(display, &mode)) {
@@ -283,6 +280,7 @@ void RISCOS_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
     }
 
     SDL_free(block);
+    return 0;
 }
 
 int RISCOS_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)

+ 1 - 1
src/video/riscos/SDL_riscosmodes.h

@@ -24,7 +24,7 @@
 #define SDL_riscosmodes_h_
 
 extern int RISCOS_InitModes(_THIS);
-extern void RISCOS_GetDisplayModes(_THIS, SDL_VideoDisplay *display);
+extern int RISCOS_GetDisplayModes(_THIS, SDL_VideoDisplay *display);
 extern int RISCOS_SetDisplayMode(_THIS, SDL_VideoDisplay *display,
                                  SDL_DisplayMode *mode);
 

+ 1 - 1
src/video/uikit/SDL_uikitmodes.h

@@ -45,7 +45,7 @@ extern SDL_bool UIKit_IsDisplayLandscape(UIScreen *uiscreen);
 extern int UIKit_InitModes(_THIS);
 extern int UIKit_AddDisplay(UIScreen *uiscreen, SDL_bool send_event);
 extern void UIKit_DelDisplay(UIScreen *uiscreen);
-extern void UIKit_GetDisplayModes(_THIS, SDL_VideoDisplay *display);
+extern int UIKit_GetDisplayModes(_THIS, SDL_VideoDisplay *display);
 extern int UIKit_GetDisplayPhysicalDPI(_THIS, SDL_VideoDisplay *display, float *ddpi, float *hdpi, float *vdpi);
 extern int UIKit_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode);
 extern void UIKit_QuitModes(_THIS);

+ 2 - 1
src/video/uikit/SDL_uikitmodes.m

@@ -417,7 +417,7 @@ int UIKit_InitModes(_THIS)
     return 0;
 }
 
-void UIKit_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
+int UIKit_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
 {
     @autoreleasepool {
         SDL_DisplayData *data = display->driverdata;
@@ -448,6 +448,7 @@ void UIKit_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
             UIKit_AddDisplayMode(display, w, h, data.uiscreen, uimode, addRotation);
         }
     }
+    return 0;
 }
 
 int UIKit_GetDisplayPhysicalDPI(_THIS, SDL_VideoDisplay *display, float *ddpi, float *hdpi, float *vdpi)

+ 1 - 1
src/video/uikit/SDL_uikitopengles.h

@@ -29,7 +29,7 @@ extern int UIKit_GL_MakeCurrent(_THIS, SDL_Window *window,
                                 SDL_GLContext context);
 extern int UIKit_GL_SwapWindow(_THIS, SDL_Window *window);
 extern SDL_GLContext UIKit_GL_CreateContext(_THIS, SDL_Window *window);
-extern void UIKit_GL_DeleteContext(_THIS, SDL_GLContext context);
+extern int UIKit_GL_DeleteContext(_THIS, SDL_GLContext context);
 extern SDL_FunctionPointer UIKit_GL_GetProcAddress(_THIS, const char *proc);
 extern int UIKit_GL_LoadLibrary(_THIS, const char *path);
 

+ 2 - 1
src/video/uikit/SDL_uikitopengles.m

@@ -185,7 +185,7 @@ SDL_GLContext UIKit_GL_CreateContext(_THIS, SDL_Window *window)
     }
 }
 
-void UIKit_GL_DeleteContext(_THIS, SDL_GLContext context)
+int UIKit_GL_DeleteContext(_THIS, SDL_GLContext context)
 {
     @autoreleasepool {
         /* The context was retained in SDL_GL_CreateContext, so we release it
@@ -193,6 +193,7 @@ void UIKit_GL_DeleteContext(_THIS, SDL_GLContext context)
          * context is deallocated. */
         CFRelease(context);
     }
+    return 0;
 }
 
 void UIKit_GL_RestoreCurrentContext(void)

+ 1 - 1
src/video/uikit/SDL_uikitviewcontroller.h

@@ -89,5 +89,5 @@ SDL_bool UIKit_HasScreenKeyboardSupport(_THIS);
 void UIKit_ShowScreenKeyboard(_THIS, SDL_Window *window);
 void UIKit_HideScreenKeyboard(_THIS, SDL_Window *window);
 SDL_bool UIKit_IsScreenKeyboardShown(_THIS, SDL_Window *window);
-void UIKit_SetTextInputRect(_THIS, const SDL_Rect *rect);
+int UIKit_SetTextInputRect(_THIS, const SDL_Rect *rect);
 #endif

+ 2 - 6
src/video/uikit/SDL_uikitviewcontroller.m

@@ -552,13 +552,8 @@ UIKit_IsScreenKeyboardShown(_THIS, SDL_Window *window)
     }
 }
 
-void UIKit_SetTextInputRect(_THIS, const SDL_Rect *rect)
+int UIKit_SetTextInputRect(_THIS, const SDL_Rect *rect)
 {
-    if (!rect) {
-        SDL_InvalidParamError("rect");
-        return;
-    }
-
     @autoreleasepool {
         SDL_uikitviewcontroller *vc = GetWindowViewController(SDL_GetFocusWindow());
         if (vc != nil) {
@@ -569,6 +564,7 @@ void UIKit_SetTextInputRect(_THIS, const SDL_Rect *rect)
             }
         }
     }
+    return 0;
 }
 
 #endif /* SDL_IPHONE_KEYBOARD */

+ 4 - 6
src/video/vita/SDL_vitagles.c

@@ -191,14 +191,13 @@ int VITA_GLES_SwapWindow(_THIS, SDL_Window *window)
     return 0;
 }
 
-void VITA_GLES_DeleteContext(_THIS, SDL_GLContext context)
+int VITA_GLES_DeleteContext(_THIS, SDL_GLContext context)
 {
     SDL_VideoData *phdata = _this->driverdata;
     EGLBoolean status;
 
     if (phdata->egl_initialized != SDL_TRUE) {
-        SDL_SetError("VITA: GLES initialization failed, no OpenGL ES support");
-        return;
+        return SDL_SetError("VITA: GLES initialization failed, no OpenGL ES support");
     }
 
     /* Check if OpenGL ES connection has been initialized */
@@ -207,13 +206,12 @@ void VITA_GLES_DeleteContext(_THIS, SDL_GLContext context)
             status = eglDestroyContext(_this->gl_data->display, context);
             if (status != EGL_TRUE) {
                 /* Error during OpenGL ES context destroying */
-                SDL_SetError("VITA: OpenGL ES context destroy error");
-                return;
+                return SDL_SetError("VITA: OpenGL ES context destroy error");
             }
         }
     }
 
-    return;
+    return 0;
 }
 
 #endif /* SDL_VIDEO_DRIVER_VITA */

+ 2 - 2
src/video/vita/SDL_vitavideo.h

@@ -60,7 +60,7 @@ extern SDL_Window *Vita_Window;
 /* Display and window functions */
 int VITA_VideoInit(_THIS);
 void VITA_VideoQuit(_THIS);
-void VITA_GetDisplayModes(_THIS, SDL_VideoDisplay *display);
+int VITA_GetDisplayModes(_THIS, SDL_VideoDisplay *display);
 int VITA_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode);
 int VITA_CreateWindow(_THIS, SDL_Window *window);
 int VITA_CreateWindowFrom(_THIS, SDL_Window *window, const void *data);
@@ -94,7 +94,7 @@ int VITA_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context);
 int VITA_GLES_SetSwapInterval(_THIS, int interval);
 int VITA_GLES_GetSwapInterval(_THIS, int *interval);
 int VITA_GLES_SwapWindow(_THIS, SDL_Window *window);
-void VITA_GLES_DeleteContext(_THIS, SDL_GLContext context);
+int VITA_GLES_DeleteContext(_THIS, SDL_GLContext context);
 #endif
 
 /* VITA on screen keyboard */

+ 1 - 1
src/video/vivante/SDL_vivantevideo.h

@@ -70,7 +70,7 @@ struct SDL_WindowData
 /* Display and window functions */
 int VIVANTE_VideoInit(_THIS);
 void VIVANTE_VideoQuit(_THIS);
-void VIVANTE_GetDisplayModes(_THIS, SDL_VideoDisplay *display);
+int VIVANTE_GetDisplayModes(_THIS, SDL_VideoDisplay *display);
 int VIVANTE_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode);
 int VIVANTE_CreateWindow(_THIS, SDL_Window *window);
 void VIVANTE_SetWindowTitle(_THIS, SDL_Window *window);

+ 2 - 7
src/video/wayland/SDL_waylandkeyboard.c

@@ -112,15 +112,9 @@ void Wayland_StopTextInput(_THIS)
 #endif
 }
 
-void Wayland_SetTextInputRect(_THIS, const SDL_Rect *rect)
+int Wayland_SetTextInputRect(_THIS, const SDL_Rect *rect)
 {
     SDL_VideoData *driverdata = _this->driverdata;
-
-    if (rect == NULL) {
-        SDL_InvalidParamError("rect");
-        return;
-    }
-
     if (driverdata->text_input_manager) {
         struct SDL_WaylandInput *input = driverdata->input;
         if (input != NULL && input->text_input) {
@@ -141,6 +135,7 @@ void Wayland_SetTextInputRect(_THIS, const SDL_Rect *rect)
         SDL_IME_UpdateTextRect(rect);
     }
 #endif
+    return 0;
 }
 
 SDL_bool Wayland_HasScreenKeyboardSupport(_THIS)

+ 1 - 1
src/video/wayland/SDL_waylandkeyboard.h

@@ -35,7 +35,7 @@ extern int Wayland_InitKeyboard(_THIS);
 extern void Wayland_QuitKeyboard(_THIS);
 extern void Wayland_StartTextInput(_THIS);
 extern void Wayland_StopTextInput(_THIS);
-extern void Wayland_SetTextInputRect(_THIS, const SDL_Rect *rect);
+extern int Wayland_SetTextInputRect(_THIS, const SDL_Rect *rect);
 extern SDL_bool Wayland_HasScreenKeyboardSupport(_THIS);
 
 #endif /* SDL_waylandkeyboard_h_ */

+ 4 - 3
src/video/wayland/SDL_waylandmouse.c

@@ -533,22 +533,23 @@ static int Wayland_ShowCursor(SDL_Cursor *cursor)
     return 0;
 }
 
-static void Wayland_WarpMouse(SDL_Window *window, float x, float y)
+static int Wayland_WarpMouse(SDL_Window *window, float x, float y)
 {
     SDL_VideoDevice *vd = SDL_GetVideoDevice();
     SDL_VideoData *d = vd->driverdata;
     struct SDL_WaylandInput *input = d->input;
 
     if (input->cursor_visible == SDL_TRUE) {
-        SDL_Unsupported();
+        return SDL_Unsupported();
     } else if (input->warp_emulation_prohibited) {
-        SDL_Unsupported();
+        return SDL_Unsupported();
     } else {
         if (!d->relative_mouse_mode) {
             Wayland_input_lock_pointer(input);
             input->relative_mode_override = SDL_TRUE;
         }
     }
+    return 0;
 }
 
 static int Wayland_SetRelativeMouseMode(SDL_bool enabled)

+ 2 - 1
src/video/wayland/SDL_waylandopengles.c

@@ -187,10 +187,11 @@ int Wayland_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context)
     return ret;
 }
 
-void Wayland_GLES_DeleteContext(_THIS, SDL_GLContext context)
+int Wayland_GLES_DeleteContext(_THIS, SDL_GLContext context)
 {
     SDL_EGL_DeleteContext(_this, context);
     WAYLAND_wl_display_flush(_this->driverdata->display);
+    return 0;
 }
 
 EGLSurface Wayland_GLES_GetEGLSurface(_THIS, SDL_Window *window)

+ 1 - 1
src/video/wayland/SDL_waylandopengles.h

@@ -42,7 +42,7 @@ extern int Wayland_GLES_SetSwapInterval(_THIS, int interval);
 extern int Wayland_GLES_GetSwapInterval(_THIS, int *interval);
 extern int Wayland_GLES_SwapWindow(_THIS, SDL_Window *window);
 extern int Wayland_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context);
-extern void Wayland_GLES_DeleteContext(_THIS, SDL_GLContext context);
+extern int Wayland_GLES_DeleteContext(_THIS, SDL_GLContext context);
 extern SDL_EGLSurface Wayland_GLES_GetEGLSurface(_THIS, SDL_Window *window);
 
 #endif /* SDL_waylandopengles_h_ */

+ 3 - 3
src/video/wayland/SDL_waylandvideo.c

@@ -681,15 +681,14 @@ static const struct wl_output_listener output_listener = {
     display_handle_scale
 };
 
-static void Wayland_add_display(SDL_VideoData *d, uint32_t id)
+static int Wayland_add_display(SDL_VideoData *d, uint32_t id)
 {
     struct wl_output *output;
     SDL_DisplayData *data;
 
     output = wl_registry_bind(d->registry, id, &wl_output_interface, 2);
     if (output == NULL) {
-        SDL_SetError("Failed to retrieve output.");
-        return;
+        return SDL_SetError("Failed to retrieve output.");
     }
     data = (SDL_DisplayData *)SDL_calloc(1, sizeof(*data));
     data->videodata = d;
@@ -717,6 +716,7 @@ static void Wayland_add_display(SDL_VideoData *d, uint32_t id)
         data->xdg_output = zxdg_output_manager_v1_get_xdg_output(data->videodata->xdg_output_manager, output);
         zxdg_output_v1_add_listener(data->xdg_output, &xdg_output_listener, data);
     }
+    return 0;
 }
 
 static void Wayland_free_display(SDL_VideoData *d, uint32_t id)

+ 9 - 13
src/video/windows/SDL_windowskeyboard.c

@@ -31,7 +31,7 @@
 #include <oleauto.h>
 
 #ifndef SDL_DISABLE_WINDOWS_IME
-static void IME_Init(SDL_VideoData *videodata, HWND hwnd);
+static int IME_Init(SDL_VideoData *videodata, HWND hwnd);
 static void IME_Enable(SDL_VideoData *videodata, HWND hwnd);
 static void IME_Disable(SDL_VideoData *videodata, HWND hwnd);
 static void IME_Quit(SDL_VideoData *videodata);
@@ -235,16 +235,11 @@ void WIN_StopTextInput(_THIS)
 #endif /* !SDL_DISABLE_WINDOWS_IME */
 }
 
-void WIN_SetTextInputRect(_THIS, const SDL_Rect *rect)
+int WIN_SetTextInputRect(_THIS, const SDL_Rect *rect)
 {
     SDL_VideoData *videodata = _this->driverdata;
     HIMC himc = 0;
 
-    if (rect == NULL) {
-        SDL_InvalidParamError("rect");
-        return;
-    }
-
 #ifndef SDL_DISABLE_WINDOWS_IME
     videodata->ime_rect = *rect;
 
@@ -275,6 +270,7 @@ void WIN_SetTextInputRect(_THIS, const SDL_Rect *rect)
         ImmReleaseContext(videodata->ime_hwnd_current, himc);
     }
 #endif /* !SDL_DISABLE_WINDOWS_IME */
+    return 0;
 }
 
 #ifdef SDL_DISABLE_WINDOWS_IME
@@ -374,12 +370,12 @@ static SDL_bool WIN_ShouldShowNativeUI()
     return SDL_GetHintBoolean(SDL_HINT_IME_SHOW_UI, SDL_FALSE);
 }
 
-static void IME_Init(SDL_VideoData *videodata, HWND hwnd)
+static int IME_Init(SDL_VideoData *videodata, HWND hwnd)
 {
     HRESULT hResult = S_OK;
 
     if (videodata->ime_initialized) {
-        return;
+        return 0;
     }
 
     videodata->ime_hwnd_main = hwnd;
@@ -388,8 +384,7 @@ static void IME_Init(SDL_VideoData *videodata, HWND hwnd)
         hResult = CoCreateInstance(&CLSID_TF_ThreadMgr, NULL, CLSCTX_INPROC_SERVER, &IID_ITfThreadMgr, (LPVOID *)&videodata->ime_threadmgr);
         if (hResult != S_OK) {
             videodata->ime_available = SDL_FALSE;
-            SDL_SetError("CoCreateInstance() failed, HRESULT is %08X", (unsigned int)hResult);
-            return;
+            return SDL_SetError("CoCreateInstance() failed, HRESULT is %08X", (unsigned int)hResult);
         }
     }
     videodata->ime_initialized = SDL_TRUE;
@@ -397,7 +392,7 @@ static void IME_Init(SDL_VideoData *videodata, HWND hwnd)
     if (!videodata->ime_himm32) {
         videodata->ime_available = SDL_FALSE;
         SDL_ClearError();
-        return;
+        return 0;
     }
     /* *INDENT-OFF* */ /* clang-format off */
     videodata->ImmLockIMC = (LPINPUTCONTEXT2 (WINAPI *)(HIMC))SDL_LoadFunction(videodata->ime_himm32, "ImmLockIMC");
@@ -412,7 +407,7 @@ static void IME_Init(SDL_VideoData *videodata, HWND hwnd)
     if (!videodata->ime_himc) {
         videodata->ime_available = SDL_FALSE;
         IME_Disable(videodata, hwnd);
-        return;
+        return 0;
     }
     videodata->ime_available = SDL_TRUE;
     IME_UpdateInputLocale(videodata);
@@ -424,6 +419,7 @@ static void IME_Init(SDL_VideoData *videodata, HWND hwnd)
     }
     IME_UpdateInputLocale(videodata);
     IME_Disable(videodata, hwnd);
+    return 0;
 }
 
 static void IME_Enable(SDL_VideoData *videodata, HWND hwnd)

+ 1 - 1
src/video/windows/SDL_windowskeyboard.h

@@ -31,7 +31,7 @@ extern void WIN_ResetDeadKeys(void);
 
 extern void WIN_StartTextInput(_THIS);
 extern void WIN_StopTextInput(_THIS);
-extern void WIN_SetTextInputRect(_THIS, const SDL_Rect *rect);
+extern int WIN_SetTextInputRect(_THIS, const SDL_Rect *rect);
 extern void WIN_ClearComposition(_THIS);
 extern SDL_bool WIN_IsTextInputShown(_THIS);
 

+ 2 - 1
src/video/windows/SDL_windowsmodes.c

@@ -718,7 +718,7 @@ void WIN_ScreenPointToSDLFloat(LONG x, LONG y, float *xOut, float *yOut)
 #endif
 }
 
-void WIN_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
+int WIN_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
 {
     SDL_DisplayData *data = display->driverdata;
     DWORD i;
@@ -741,6 +741,7 @@ void WIN_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
             SDL_free(mode.driverdata);
         }
     }
+    return 0;
 }
 
 #ifdef DEBUG_MODES

+ 1 - 1
src/video/windows/SDL_windowsmodes.h

@@ -44,7 +44,7 @@ extern void WIN_ScreenPointFromSDLFloat(float x, float y, LONG *xOut, LONG *yOut
 extern void WIN_ScreenPointToSDL(int *x, int *y);
 extern void WIN_ScreenPointToSDLFloat(LONG x, LONG y, float *xOut, float *yOut);
 extern int WIN_GetDisplayPhysicalDPI(_THIS, SDL_VideoDisplay *display, float *ddpi, float *hdpi, float *vdpi);
-extern void WIN_GetDisplayModes(_THIS, SDL_VideoDisplay *display);
+extern int WIN_GetDisplayModes(_THIS, SDL_VideoDisplay *display);
 extern int WIN_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode);
 extern void WIN_RefreshDisplays(_THIS);
 extern void WIN_QuitModes(_THIS);

+ 3 - 2
src/video/windows/SDL_windowsmouse.c

@@ -277,7 +277,7 @@ void WIN_SetCursorPos(int x, int y)
     }
 }
 
-static void WIN_WarpMouse(SDL_Window *window, float x, float y)
+static int WIN_WarpMouse(SDL_Window *window, float x, float y)
 {
     SDL_WindowData *data = window->driverdata;
     HWND hwnd = data->hwnd;
@@ -285,7 +285,7 @@ static void WIN_WarpMouse(SDL_Window *window, float x, float y)
 
     /* Don't warp the mouse while we're doing a modal interaction */
     if (data->in_title_click || data->focus_click_pending) {
-        return;
+        return 0;
     }
 
     WIN_ClientPointFromSDLFloat(window, x, y, &pt.x, &pt.y);
@@ -294,6 +294,7 @@ static void WIN_WarpMouse(SDL_Window *window, float x, float y)
 
     /* Send the exact mouse motion associated with this warp */
     SDL_SendMouseMotion(0, window, SDL_GetMouse()->mouseID, 0, x, y);
+    return 0;
 }
 
 static int WIN_WarpMouseGlobal(float x, float y)

+ 3 - 2
src/video/windows/SDL_windowsopengl.c

@@ -885,12 +885,13 @@ int WIN_GL_SwapWindow(_THIS, SDL_Window *window)
     return 0;
 }
 
-void WIN_GL_DeleteContext(_THIS, SDL_GLContext context)
+int WIN_GL_DeleteContext(_THIS, SDL_GLContext context)
 {
     if (!_this->gl_data) {
-        return;
+        return 0;
     }
     _this->gl_data->wglDeleteContext((HGLRC)context);
+    return 0;
 }
 
 SDL_bool WIN_GL_SetPixelFormatFrom(_THIS, SDL_Window *fromWindow, SDL_Window *toWindow)

+ 1 - 1
src/video/windows/SDL_windowsopengl.h

@@ -113,7 +113,7 @@ extern int WIN_GL_MakeCurrent(_THIS, SDL_Window *window,
 extern int WIN_GL_SetSwapInterval(_THIS, int interval);
 extern int WIN_GL_GetSwapInterval(_THIS, int *interval);
 extern int WIN_GL_SwapWindow(_THIS, SDL_Window *window);
-extern void WIN_GL_DeleteContext(_THIS, SDL_GLContext context);
+extern int WIN_GL_DeleteContext(_THIS, SDL_GLContext context);
 extern void WIN_GL_InitExtensions(_THIS);
 extern SDL_bool WIN_GL_SetPixelFormatFrom(_THIS, SDL_Window *fromWindow, SDL_Window *toWindow);
 

+ 2 - 1
src/video/windows/SDL_windowsopengles.c

@@ -94,10 +94,11 @@ WIN_GLES_CreateContext(_THIS, SDL_Window *window)
     return context;
 }
 
-void WIN_GLES_DeleteContext(_THIS, SDL_GLContext context)
+int WIN_GLES_DeleteContext(_THIS, SDL_GLContext context)
 {
     SDL_EGL_DeleteContext(_this, context);
     WIN_GLES_UnloadLibrary(_this);
+    return 0;
 }
 
 SDL_EGL_SwapWindow_impl(WIN)

+ 1 - 1
src/video/windows/SDL_windowsopengles.h

@@ -39,7 +39,7 @@ extern int WIN_GLES_LoadLibrary(_THIS, const char *path);
 extern SDL_GLContext WIN_GLES_CreateContext(_THIS, SDL_Window *window);
 extern int WIN_GLES_SwapWindow(_THIS, SDL_Window *window);
 extern int WIN_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context);
-extern void WIN_GLES_DeleteContext(_THIS, SDL_GLContext context);
+extern int WIN_GLES_DeleteContext(_THIS, SDL_GLContext context);
 extern int WIN_GLES_SetupWindow(_THIS, SDL_Window *window);
 extern SDL_EGLSurface WIN_GLES_GetEGLSurface(_THIS, SDL_Window *window);
 

+ 2 - 6
src/video/x11/SDL_x11keyboard.c

@@ -422,16 +422,12 @@ void X11_StopTextInput(_THIS)
 #endif
 }
 
-void X11_SetTextInputRect(_THIS, const SDL_Rect *rect)
+int X11_SetTextInputRect(_THIS, const SDL_Rect *rect)
 {
-    if (rect == NULL) {
-        SDL_InvalidParamError("rect");
-        return;
-    }
-
 #ifdef SDL_USE_IME
     SDL_IME_UpdateTextRect(rect);
 #endif
+    return 0;
 }
 
 SDL_bool

+ 1 - 1
src/video/x11/SDL_x11keyboard.h

@@ -28,7 +28,7 @@ extern void X11_UpdateKeymap(_THIS, SDL_bool send_event);
 extern void X11_QuitKeyboard(_THIS);
 extern void X11_StartTextInput(_THIS);
 extern void X11_StopTextInput(_THIS);
-extern void X11_SetTextInputRect(_THIS, const SDL_Rect *rect);
+extern int X11_SetTextInputRect(_THIS, const SDL_Rect *rect);
 extern SDL_bool X11_HasScreenKeyboardSupport(_THIS);
 extern void X11_ShowScreenKeyboard(_THIS, SDL_Window *window);
 extern void X11_HideScreenKeyboard(_THIS, SDL_Window *window);

+ 2 - 2
src/video/x11/SDL_x11modes.c

@@ -656,7 +656,7 @@ int X11_InitModes(_THIS)
     return X11_InitModes_StdXlib(_this);
 }
 
-void X11_GetDisplayModes(_THIS, SDL_VideoDisplay *sdl_display)
+int X11_GetDisplayModes(_THIS, SDL_VideoDisplay *sdl_display)
 {
     SDL_DisplayData *data = sdl_display->driverdata;
     SDL_DisplayMode mode;
@@ -699,9 +699,9 @@ void X11_GetDisplayModes(_THIS, SDL_VideoDisplay *sdl_display)
             X11_XRRFreeOutputInfo(output_info);
             X11_XRRFreeScreenResources(res);
         }
-        return;
     }
 #endif /* SDL_VIDEO_DRIVER_X11_XRANDR */
+    return 0;
 }
 
 #if SDL_VIDEO_DRIVER_X11_XRANDR

+ 1 - 1
src/video/x11/SDL_x11modes.h

@@ -52,7 +52,7 @@ struct SDL_DisplayModeData
 };
 
 extern int X11_InitModes(_THIS);
-extern void X11_GetDisplayModes(_THIS, SDL_VideoDisplay *display);
+extern int X11_GetDisplayModes(_THIS, SDL_VideoDisplay *display);
 extern int X11_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode);
 extern void X11_QuitModes(_THIS);
 

+ 3 - 4
src/video/x11/SDL_x11mouse.c

@@ -347,7 +347,7 @@ static void X11_WarpMouseInternal(Window xwindow, float x, float y)
     videodata->global_mouse_changed = SDL_TRUE;
 }
 
-static void X11_WarpMouse(SDL_Window *window, float x, float y)
+static int X11_WarpMouse(SDL_Window *window, float x, float y)
 {
     SDL_WindowData *data = window->driverdata;
 
@@ -359,6 +359,7 @@ static void X11_WarpMouse(SDL_Window *window, float x, float y)
 #else
     X11_WarpMouseInternal(data->xwindow, x, y);
 #endif
+    return 0;
 }
 
 static int X11_WarpMouseGlobal(float x, float y)
@@ -373,10 +374,8 @@ static int X11_SetRelativeMouseMode(SDL_bool enabled)
     if (X11_Xinput2IsInitialized()) {
         return 0;
     }
-#else
-    SDL_Unsupported();
 #endif
-    return -1;
+    return SDL_Unsupported();
 }
 
 static int X11_CaptureMouse(SDL_Window *window)

+ 5 - 4
src/video/x11/SDL_x11opengl.c

@@ -863,7 +863,7 @@ int X11_GL_SetSwapInterval(_THIS, int interval)
     int status = -1;
 
     if ((interval < 0) && (!_this->gl_data->HAS_GLX_EXT_swap_control_tear)) {
-        SDL_SetError("Negative swap interval unsupported in this GL");
+        return SDL_SetError("Negative swap interval unsupported in this GL");
     } else if (_this->gl_data->glXSwapIntervalEXT) {
         Display *display = _this->driverdata->display;
         const SDL_WindowData *windowdata = SDL_GL_GetCurrentWindow()->driverdata;
@@ -900,7 +900,7 @@ int X11_GL_SetSwapInterval(_THIS, int interval)
             swapinterval = interval;
         }
     } else {
-        SDL_Unsupported();
+        return SDL_Unsupported();
     }
     return status;
 }
@@ -952,16 +952,17 @@ int X11_GL_SwapWindow(_THIS, SDL_Window *window)
     return 0;
 }
 
-void X11_GL_DeleteContext(_THIS, SDL_GLContext context)
+int X11_GL_DeleteContext(_THIS, SDL_GLContext context)
 {
     Display *display = _this->driverdata->display;
     GLXContext glx_context = (GLXContext)context;
 
     if (!_this->gl_data) {
-        return;
+        return 0;
     }
     _this->gl_data->glXDestroyContext(display, glx_context);
     X11_XSync(display, False);
+    return 0;
 }
 
 #endif /* SDL_VIDEO_OPENGL_GLX */

+ 1 - 1
src/video/x11/SDL_x11opengl.h

@@ -79,7 +79,7 @@ extern int X11_GL_MakeCurrent(_THIS, SDL_Window *window,
 extern int X11_GL_SetSwapInterval(_THIS, int interval);
 extern int X11_GL_GetSwapInterval(_THIS, int *interval);
 extern int X11_GL_SwapWindow(_THIS, SDL_Window *window);
-extern void X11_GL_DeleteContext(_THIS, SDL_GLContext context);
+extern int X11_GL_DeleteContext(_THIS, SDL_GLContext context);
 
 #endif /* SDL_VIDEO_OPENGL_GLX */