Fixed bug 3745 - specify SDLCALL as the calling convention for API callbacks
authorSam Lantinga <slouken@libsdl.org>
Mon, 14 Aug 2017 06:28:21 -0700
changeset 112843db78361e751
parent 11283 4276937a9792
child 11285 16f51c1376ae
Fixed bug 3745 - specify SDLCALL as the calling convention for API callbacks

Patches contributed by Ozkan Sezer
include/SDL_hints.h
include/SDL_log.h
include/SDL_surface.h
include/SDL_thread.h
src/SDL_log.c
src/core/linux/SDL_fcitx.c
src/core/linux/SDL_ibus.c
src/core/winrt/SDL_winrtapp_direct3d.cpp
src/events/SDL_mouse.c
src/joystick/SDL_gamecontroller.c
src/joystick/SDL_joystick.c
src/joystick/iphoneos/SDL_sysjoystick.m
src/thread/SDL_thread.c
src/thread/SDL_thread_c.h
src/timer/windows/SDL_systimer.c
src/video/SDL_RLEaccel.c
src/video/SDL_RLEaccel_c.h
src/video/SDL_blit.c
src/video/android/SDL_androidtouch.c
src/video/uikit/SDL_uikitappdelegate.m
src/video/uikit/SDL_uikitviewcontroller.m
src/video/wayland/SDL_waylandwindow.c
src/video/windows/SDL_windowsvideo.c
     1.1 --- a/include/SDL_hints.h	Mon Aug 14 06:18:08 2017 -0700
     1.2 +++ b/include/SDL_hints.h	Mon Aug 14 06:28:21 2017 -0700
     1.3 @@ -903,7 +903,7 @@
     1.4  /**
     1.5   * \brief type definition of the hint callback function.
     1.6   */
     1.7 -typedef void (*SDL_HintCallback)(void *userdata, const char *name, const char *oldValue, const char *newValue);
     1.8 +typedef void (SDLCALL *SDL_HintCallback)(void *userdata, const char *name, const char *oldValue, const char *newValue);
     1.9  
    1.10  /**
    1.11   *  \brief Add a function to watch a particular hint
     2.1 --- a/include/SDL_log.h	Mon Aug 14 06:18:08 2017 -0700
     2.2 +++ b/include/SDL_log.h	Mon Aug 14 06:28:21 2017 -0700
     2.3 @@ -186,7 +186,7 @@
     2.4  /**
     2.5   *  \brief The prototype for the log output function
     2.6   */
     2.7 -typedef void (*SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message);
     2.8 +typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message);
     2.9  
    2.10  /**
    2.11   *  \brief Get the current log output function.
     3.1 --- a/include/SDL_surface.h	Mon Aug 14 06:18:08 2017 -0700
     3.2 +++ b/include/SDL_surface.h	Mon Aug 14 06:28:21 2017 -0700
     3.3 @@ -94,8 +94,8 @@
     3.4  /**
     3.5   * \brief The type of function used for surface blitting functions.
     3.6   */
     3.7 -typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
     3.8 -                         struct SDL_Surface * dst, SDL_Rect * dstrect);
     3.9 +typedef int (SDLCALL *SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
    3.10 +                                 struct SDL_Surface * dst, SDL_Rect * dstrect);
    3.11  
    3.12  /**
    3.13   *  Allocate and free an RGB surface.
     4.1 --- a/include/SDL_thread.h	Mon Aug 14 06:18:08 2017 -0700
     4.2 +++ b/include/SDL_thread.h	Mon Aug 14 06:28:21 2017 -0700
     4.3 @@ -273,7 +273,7 @@
     4.4   *  \sa SDL_TLSCreate()
     4.5   *  \sa SDL_TLSGet()
     4.6   */
     4.7 -extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (*destructor)(void*));
     4.8 +extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (SDLCALL *destructor)(void*));
     4.9  
    4.10  
    4.11  /* Ends C function definitions when using C++ */
     5.1 --- a/src/SDL_log.c	Mon Aug 14 06:18:08 2017 -0700
     5.2 +++ b/src/SDL_log.c	Mon Aug 14 06:28:21 2017 -0700
     5.3 @@ -50,9 +50,7 @@
     5.4  } SDL_LogLevel;
     5.5  
     5.6  /* The default log output function */
     5.7 -static void SDL_LogOutput(void *userdata,
     5.8 -                          int category, SDL_LogPriority priority,
     5.9 -                          const char *message);
    5.10 +static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, const char *message);
    5.11  
    5.12  static SDL_LogLevel *SDL_loglevels;
    5.13  static SDL_LogPriority SDL_default_priority = DEFAULT_PRIORITY;
    5.14 @@ -312,7 +310,7 @@
    5.15  static HANDLE stderrHandle = NULL;
    5.16  #endif
    5.17  
    5.18 -static void
    5.19 +static void SDLCALL
    5.20  SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
    5.21                const char *message)
    5.22  {
     6.1 --- a/src/core/linux/SDL_fcitx.c	Mon Aug 14 06:18:08 2017 -0700
     6.2 +++ b/src/core/linux/SDL_fcitx.c	Mon Aug 14 06:28:21 2017 -0700
     6.3 @@ -172,7 +172,7 @@
     6.4      SDL_DBus_CallVoidMethod(client->servicename, client->icname, FCITX_IC_DBUS_INTERFACE, method, DBUS_TYPE_INVALID);
     6.5  }
     6.6  
     6.7 -static void
     6.8 +static void SDLCALL
     6.9  Fcitx_SetCapabilities(void *data,
    6.10          const char *name,
    6.11          const char *old_val,
    6.12 @@ -219,7 +219,7 @@
    6.13                  NULL);
    6.14          dbus->connection_flush(dbus->session_conn);
    6.15  
    6.16 -        SDL_AddHintCallback(SDL_HINT_IME_INTERNAL_EDITING, &Fcitx_SetCapabilities, client);
    6.17 +        SDL_AddHintCallback(SDL_HINT_IME_INTERNAL_EDITING, Fcitx_SetCapabilities, client);
    6.18          return SDL_TRUE;
    6.19      }
    6.20  
     7.1 --- a/src/core/linux/SDL_ibus.c	Mon Aug 14 06:18:08 2017 -0700
     7.2 +++ b/src/core/linux/SDL_ibus.c	Mon Aug 14 06:28:21 2017 -0700
     7.3 @@ -287,7 +287,7 @@
     7.4  
     7.5  static SDL_bool IBus_CheckConnection(SDL_DBusContext *dbus);
     7.6  
     7.7 -static void
     7.8 +static void SDLCALL
     7.9  IBus_SetCapabilities(void *data, const char *name, const char *old_val,
    7.10                                                     const char *internal_editing)
    7.11  {
    7.12 @@ -336,7 +336,7 @@
    7.13              DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID)) {
    7.14          SDL_free(input_ctx_path);
    7.15          input_ctx_path = SDL_strdup(path);
    7.16 -        SDL_AddHintCallback(SDL_HINT_IME_INTERNAL_EDITING, &IBus_SetCapabilities, NULL);
    7.17 +        SDL_AddHintCallback(SDL_HINT_IME_INTERNAL_EDITING, IBus_SetCapabilities, NULL);
    7.18          
    7.19          dbus->bus_add_match(ibus_conn, "type='signal',interface='org.freedesktop.IBus.InputContext'", NULL);
    7.20          dbus->connection_try_register_object_path(ibus_conn, input_ctx_path, &ibus_vtable, dbus, NULL);
    7.21 @@ -468,7 +468,7 @@
    7.22          inotify_wd = -1;
    7.23      }
    7.24      
    7.25 -    SDL_DelHintCallback(SDL_HINT_IME_INTERNAL_EDITING, &IBus_SetCapabilities, NULL);
    7.26 +    SDL_DelHintCallback(SDL_HINT_IME_INTERNAL_EDITING, IBus_SetCapabilities, NULL);
    7.27      
    7.28      SDL_memset(&ibus_cursor_rect, 0, sizeof(ibus_cursor_rect));
    7.29  }
     8.1 --- a/src/core/winrt/SDL_winrtapp_direct3d.cpp	Mon Aug 14 06:18:08 2017 -0700
     8.2 +++ b/src/core/winrt/SDL_winrtapp_direct3d.cpp	Mon Aug 14 06:28:21 2017 -0700
     8.3 @@ -121,7 +121,8 @@
     8.4      return 0;
     8.5  }
     8.6  
     8.7 -static void WINRT_SetDisplayOrientationsPreference(void *userdata, const char *name, const char *oldValue, const char *newValue)
     8.8 +static void SDLCALL
     8.9 +WINRT_SetDisplayOrientationsPreference(void *userdata, const char *name, const char *oldValue, const char *newValue)
    8.10  {
    8.11      SDL_assert(SDL_strcmp(name, SDL_HINT_ORIENTATIONS) == 0);
    8.12  
     9.1 --- a/src/events/SDL_mouse.c	Mon Aug 14 06:18:08 2017 -0700
     9.2 +++ b/src/events/SDL_mouse.c	Mon Aug 14 06:28:21 2017 -0700
     9.3 @@ -40,7 +40,7 @@
     9.4  static int
     9.5  SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int x, int y);
     9.6  
     9.7 -static void
     9.8 +static void SDLCALL
     9.9  SDL_MouseNormalSpeedScaleChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
    9.10  {
    9.11      SDL_Mouse *mouse = (SDL_Mouse *)userdata;
    9.12 @@ -52,7 +52,7 @@
    9.13      }
    9.14  }
    9.15  
    9.16 -static void
    9.17 +static void SDLCALL
    9.18  SDL_MouseRelativeSpeedScaleChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
    9.19  {
    9.20      SDL_Mouse *mouse = (SDL_Mouse *)userdata;
    9.21 @@ -64,7 +64,7 @@
    9.22      }
    9.23  }
    9.24  
    9.25 -static void
    9.26 +static void SDLCALL
    9.27  SDL_TouchMouseEventsChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
    9.28  {
    9.29      SDL_Mouse *mouse = (SDL_Mouse *)userdata;
    10.1 --- a/src/joystick/SDL_gamecontroller.c	Mon Aug 14 06:18:08 2017 -0700
    10.2 +++ b/src/joystick/SDL_gamecontroller.c	Mon Aug 14 06:28:21 2017 -0700
    10.3 @@ -168,13 +168,13 @@
    10.4      }
    10.5  }
    10.6  
    10.7 -static void
    10.8 +static void SDLCALL
    10.9  SDL_GameControllerIgnoreDevicesChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
   10.10  {
   10.11      SDL_LoadVIDPIDListFromHint(hint, &SDL_ignored_controllers);
   10.12  }
   10.13  
   10.14 -static void
   10.15 +static void SDLCALL
   10.16  SDL_GameControllerIgnoreDevicesExceptChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
   10.17  {
   10.18      SDL_LoadVIDPIDListFromHint(hint, &SDL_allowed_controllers);
    11.1 --- a/src/joystick/SDL_joystick.c	Mon Aug 14 06:18:08 2017 -0700
    11.2 +++ b/src/joystick/SDL_joystick.c	Mon Aug 14 06:28:21 2017 -0700
    11.3 @@ -56,7 +56,7 @@
    11.4  }
    11.5  
    11.6  
    11.7 -static void
    11.8 +static void SDLCALL
    11.9  SDL_JoystickAllowBackgroundEventsChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
   11.10  {
   11.11      if (hint && *hint == '1') {
    12.1 --- a/src/joystick/iphoneos/SDL_sysjoystick.m	Mon Aug 14 06:18:08 2017 -0700
    12.2 +++ b/src/joystick/iphoneos/SDL_sysjoystick.m	Mon Aug 14 06:28:21 2017 -0700
    12.3 @@ -251,7 +251,7 @@
    12.4  }
    12.5  
    12.6  #if TARGET_OS_TV
    12.7 -static void
    12.8 +static void SDLCALL
    12.9  SDL_AppleTVRemoteRotationHintChanged(void *udata, const char *name, const char *oldValue, const char *newValue)
   12.10  {
   12.11      BOOL allowRotation = newValue != NULL && *newValue != '0';
    13.1 --- a/src/thread/SDL_thread.c	Mon Aug 14 06:18:08 2017 -0700
    13.2 +++ b/src/thread/SDL_thread.c	Mon Aug 14 06:28:21 2017 -0700
    13.3 @@ -50,7 +50,7 @@
    13.4  }
    13.5  
    13.6  int
    13.7 -SDL_TLSSet(SDL_TLSID id, const void *value, void (*destructor)(void *))
    13.8 +SDL_TLSSet(SDL_TLSID id, const void *value, void (SDLCALL *destructor)(void *))
    13.9  {
   13.10      SDL_TLSData *storage;
   13.11  
    14.1 --- a/src/thread/SDL_thread_c.h	Mon Aug 14 06:18:08 2017 -0700
    14.2 +++ b/src/thread/SDL_thread_c.h	Mon Aug 14 06:28:21 2017 -0700
    14.3 @@ -71,7 +71,7 @@
    14.4      unsigned int limit;
    14.5      struct {
    14.6          void *data;
    14.7 -        void (*destructor)(void*);
    14.8 +        void (SDLCALL *destructor)(void*);
    14.9      } array[1];
   14.10  } SDL_TLSData;
   14.11  
    15.1 --- a/src/timer/windows/SDL_systimer.c	Mon Aug 14 06:18:08 2017 -0700
    15.2 +++ b/src/timer/windows/SDL_systimer.c	Mon Aug 14 06:28:21 2017 -0700
    15.3 @@ -60,7 +60,7 @@
    15.4  #endif
    15.5  }
    15.6  
    15.7 -static void
    15.8 +static void SDLCALL
    15.9  SDL_TimerResolutionChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
   15.10  {
   15.11      UINT uPeriod;
    16.1 --- a/src/video/SDL_RLEaccel.c	Mon Aug 14 06:18:08 2017 -0700
    16.2 +++ b/src/video/SDL_RLEaccel.c	Mon Aug 14 06:28:21 2017 -0700
    16.3 @@ -445,7 +445,7 @@
    16.4  
    16.5  
    16.6  /* blit a colorkeyed RLE surface */
    16.7 -int
    16.8 +int SDLCALL
    16.9  SDL_RLEBlit(SDL_Surface * surf_src, SDL_Rect * srcrect,
   16.10              SDL_Surface * surf_dst, SDL_Rect * dstrect)
   16.11  {
   16.12 @@ -723,7 +723,7 @@
   16.13  }
   16.14  
   16.15  /* blit a pixel-alpha RLE surface */
   16.16 -int
   16.17 +int SDLCALL
   16.18  SDL_RLEAlphaBlit(SDL_Surface * surf_src, SDL_Rect * srcrect,
   16.19                   SDL_Surface * surf_dst, SDL_Rect * dstrect)
   16.20  {
    17.1 --- a/src/video/SDL_RLEaccel_c.h	Mon Aug 14 06:18:08 2017 -0700
    17.2 +++ b/src/video/SDL_RLEaccel_c.h	Mon Aug 14 06:28:21 2017 -0700
    17.3 @@ -23,9 +23,9 @@
    17.4  /* Useful functions and variables from SDL_RLEaccel.c */
    17.5  
    17.6  extern int SDL_RLESurface(SDL_Surface * surface);
    17.7 -extern int SDL_RLEBlit(SDL_Surface * src, SDL_Rect * srcrect,
    17.8 -                       SDL_Surface * dst, SDL_Rect * dstrect);
    17.9 -extern int SDL_RLEAlphaBlit(SDL_Surface * src, SDL_Rect * srcrect,
   17.10 -                            SDL_Surface * dst, SDL_Rect * dstrect);
   17.11 +extern int SDLCALL SDL_RLEBlit     (SDL_Surface * src, SDL_Rect * srcrect,
   17.12 +                                    SDL_Surface * dst, SDL_Rect * dstrect);
   17.13 +extern int SDLCALL SDL_RLEAlphaBlit(SDL_Surface * src, SDL_Rect * srcrect,
   17.14 +                                    SDL_Surface * dst, SDL_Rect * dstrect);
   17.15  extern void SDL_UnRLESurface(SDL_Surface * surface, int recode);
   17.16  /* vi: set ts=4 sw=4 expandtab: */
    18.1 --- a/src/video/SDL_blit.c	Mon Aug 14 06:18:08 2017 -0700
    18.2 +++ b/src/video/SDL_blit.c	Mon Aug 14 06:28:21 2017 -0700
    18.3 @@ -30,7 +30,7 @@
    18.4  #include "SDL_pixels_c.h"
    18.5  
    18.6  /* The general purpose software blit routine */
    18.7 -static int
    18.8 +static int SDLCALL
    18.9  SDL_SoftBlit(SDL_Surface * src, SDL_Rect * srcrect,
   18.10               SDL_Surface * dst, SDL_Rect * dstrect)
   18.11  {
    19.1 --- a/src/video/android/SDL_androidtouch.c	Mon Aug 14 06:18:08 2017 -0700
    19.2 +++ b/src/video/android/SDL_androidtouch.c	Mon Aug 14 06:28:21 2017 -0700
    19.3 @@ -52,7 +52,7 @@
    19.4  
    19.5  static SDL_bool separate_mouse_and_touch = SDL_FALSE;
    19.6  
    19.7 -static void
    19.8 +static void SDLCALL
    19.9  SeparateEventsHintWatcher(void *userdata, const char *name,
   19.10                            const char *oldValue, const char *newValue)
   19.11  {
    20.1 --- a/src/video/uikit/SDL_uikitappdelegate.m	Mon Aug 14 06:18:08 2017 -0700
    20.2 +++ b/src/video/uikit/SDL_uikitappdelegate.m	Mon Aug 14 06:28:21 2017 -0700
    20.3 @@ -69,7 +69,7 @@
    20.4      return exit_status;
    20.5  }
    20.6  
    20.7 -static void
    20.8 +static void SDLCALL
    20.9  SDL_IdleTimerDisabledChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
   20.10  {
   20.11      BOOL disable = (hint && *hint != '0');
    21.1 --- a/src/video/uikit/SDL_uikitviewcontroller.m	Mon Aug 14 06:18:08 2017 -0700
    21.2 +++ b/src/video/uikit/SDL_uikitviewcontroller.m	Mon Aug 14 06:28:21 2017 -0700
    21.3 @@ -40,7 +40,7 @@
    21.4  #endif
    21.5  
    21.6  #if TARGET_OS_TV
    21.7 -static void
    21.8 +static void SDLCALL
    21.9  SDL_AppleTVControllerUIHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
   21.10  {
   21.11      @autoreleasepool {
    22.1 --- a/src/video/wayland/SDL_waylandwindow.c	Mon Aug 14 06:18:08 2017 -0700
    22.2 +++ b/src/video/wayland/SDL_waylandwindow.c	Mon Aug 14 06:28:21 2017 -0700
    22.3 @@ -178,7 +178,8 @@
    22.4  }
    22.5  
    22.6  #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
    22.7 -static void QtExtendedSurface_OnHintChanged(void *userdata, const char *name,
    22.8 +static void SDLCALL
    22.9 +QtExtendedSurface_OnHintChanged(void *userdata, const char *name,
   22.10          const char *oldValue, const char *newValue)
   22.11  {
   22.12      struct qt_extended_surface *qt_extended_surface = userdata;
    23.1 --- a/src/video/windows/SDL_windowsvideo.c	Mon Aug 14 06:18:08 2017 -0700
    23.2 +++ b/src/video/windows/SDL_windowsvideo.c	Mon Aug 14 06:28:21 2017 -0700
    23.3 @@ -42,7 +42,8 @@
    23.4  SDL_bool g_WindowsEnableMessageLoop = SDL_TRUE;
    23.5  SDL_bool g_WindowFrameUsableWhileCursorHidden = SDL_TRUE;
    23.6  
    23.7 -static void UpdateWindowsEnableMessageLoop(void *userdata, const char *name, const char *oldValue, const char *newValue)
    23.8 +static void SDLCALL
    23.9 +UpdateWindowsEnableMessageLoop(void *userdata, const char *name, const char *oldValue, const char *newValue)
   23.10  {
   23.11      if (newValue && *newValue == '0') {
   23.12          g_WindowsEnableMessageLoop = SDL_FALSE;
   23.13 @@ -51,7 +52,8 @@
   23.14      }
   23.15  }
   23.16  
   23.17 -static void UpdateWindowFrameUsableWhileCursorHidden(void *userdata, const char *name, const char *oldValue, const char *newValue)
   23.18 +static void SDLCALL
   23.19 +UpdateWindowFrameUsableWhileCursorHidden(void *userdata, const char *name, const char *oldValue, const char *newValue)
   23.20  {
   23.21      if (newValue && *newValue == '0') {
   23.22          g_WindowFrameUsableWhileCursorHidden = SDL_FALSE;