summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Lantinga <slouken@libsdl.org>2017-08-14 06:28:21 -0700
committerSam Lantinga <slouken@libsdl.org>2017-08-14 06:28:21 -0700
commit57143a118326f76b178df0627c2f6cc3b35b2441 (patch)
tree3c5baacef3dd9990f90051ae1bd0a60b2d98894e
parent06a9ec9872d18d28864638184155100cb068cfe9 (diff)
Fixed bug 3745 - specify SDLCALL as the calling convention for API callbacks
Patches contributed by Ozkan Sezer
-rw-r--r--include/SDL_hints.h2
-rw-r--r--include/SDL_log.h2
-rw-r--r--include/SDL_surface.h4
-rw-r--r--include/SDL_thread.h2
-rw-r--r--src/SDL_log.c6
-rw-r--r--src/core/linux/SDL_fcitx.c4
-rw-r--r--src/core/linux/SDL_ibus.c6
-rw-r--r--src/core/winrt/SDL_winrtapp_direct3d.cpp3
-rw-r--r--src/events/SDL_mouse.c6
-rw-r--r--src/joystick/SDL_gamecontroller.c4
-rw-r--r--src/joystick/SDL_joystick.c2
-rw-r--r--src/joystick/iphoneos/SDL_sysjoystick.m2
-rw-r--r--src/thread/SDL_thread.c2
-rw-r--r--src/thread/SDL_thread_c.h2
-rw-r--r--src/timer/windows/SDL_systimer.c2
-rw-r--r--src/video/SDL_RLEaccel.c4
-rw-r--r--src/video/SDL_RLEaccel_c.h8
-rw-r--r--src/video/SDL_blit.c2
-rw-r--r--src/video/android/SDL_androidtouch.c2
-rw-r--r--src/video/uikit/SDL_uikitappdelegate.m2
-rw-r--r--src/video/uikit/SDL_uikitviewcontroller.m2
-rw-r--r--src/video/wayland/SDL_waylandwindow.c3
-rw-r--r--src/video/windows/SDL_windowsvideo.c6
23 files changed, 40 insertions, 38 deletions
diff --git a/include/SDL_hints.h b/include/SDL_hints.h
index 2b2fd490ff..e14614b388 100644
--- a/include/SDL_hints.h
+++ b/include/SDL_hints.h
@@ -903,7 +903,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetHintBoolean(const char *name, SDL_bool d
/**
* \brief type definition of the hint callback function.
*/
-typedef void (*SDL_HintCallback)(void *userdata, const char *name, const char *oldValue, const char *newValue);
+typedef void (SDLCALL *SDL_HintCallback)(void *userdata, const char *name, const char *oldValue, const char *newValue);
/**
* \brief Add a function to watch a particular hint
diff --git a/include/SDL_log.h b/include/SDL_log.h
index 13872c11fc..356d0e1cf7 100644
--- a/include/SDL_log.h
+++ b/include/SDL_log.h
@@ -186,7 +186,7 @@ extern DECLSPEC void SDLCALL SDL_LogMessageV(int category,
/**
* \brief The prototype for the log output function
*/
-typedef void (*SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message);
+typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message);
/**
* \brief Get the current log output function.
diff --git a/include/SDL_surface.h b/include/SDL_surface.h
index 62f713aa01..c3ea1d5329 100644
--- a/include/SDL_surface.h
+++ b/include/SDL_surface.h
@@ -94,8 +94,8 @@ typedef struct SDL_Surface
/**
* \brief The type of function used for surface blitting functions.
*/
-typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
- struct SDL_Surface * dst, SDL_Rect * dstrect);
+typedef int (SDLCALL *SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
+ struct SDL_Surface * dst, SDL_Rect * dstrect);
/**
* Allocate and free an RGB surface.
diff --git a/include/SDL_thread.h b/include/SDL_thread.h
index 6cf5af0962..66a2d3e7e4 100644
--- a/include/SDL_thread.h
+++ b/include/SDL_thread.h
@@ -273,7 +273,7 @@ extern DECLSPEC void * SDLCALL SDL_TLSGet(SDL_TLSID id);
* \sa SDL_TLSCreate()
* \sa SDL_TLSGet()
*/
-extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (*destructor)(void*));
+extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (SDLCALL *destructor)(void*));
/* Ends C function definitions when using C++ */
diff --git a/src/SDL_log.c b/src/SDL_log.c
index b0f8c85864..98978628ec 100644
--- a/src/SDL_log.c
+++ b/src/SDL_log.c
@@ -50,9 +50,7 @@ typedef struct SDL_LogLevel
} SDL_LogLevel;
/* The default log output function */
-static void SDL_LogOutput(void *userdata,
- int category, SDL_LogPriority priority,
- const char *message);
+static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, const char *message);
static SDL_LogLevel *SDL_loglevels;
static SDL_LogPriority SDL_default_priority = DEFAULT_PRIORITY;
@@ -312,7 +310,7 @@ static int consoleAttached = 0;
static HANDLE stderrHandle = NULL;
#endif
-static void
+static void SDLCALL
SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
const char *message)
{
diff --git a/src/core/linux/SDL_fcitx.c b/src/core/linux/SDL_fcitx.c
index aac098ca93..e59a99d638 100644
--- a/src/core/linux/SDL_fcitx.c
+++ b/src/core/linux/SDL_fcitx.c
@@ -172,7 +172,7 @@ FcitxClientICCallMethod(FcitxClient *client, const char *method)
SDL_DBus_CallVoidMethod(client->servicename, client->icname, FCITX_IC_DBUS_INTERFACE, method, DBUS_TYPE_INVALID);
}
-static void
+static void SDLCALL
Fcitx_SetCapabilities(void *data,
const char *name,
const char *old_val,
@@ -219,7 +219,7 @@ FcitxClientCreateIC(FcitxClient *client)
NULL);
dbus->connection_flush(dbus->session_conn);
- SDL_AddHintCallback(SDL_HINT_IME_INTERNAL_EDITING, &Fcitx_SetCapabilities, client);
+ SDL_AddHintCallback(SDL_HINT_IME_INTERNAL_EDITING, Fcitx_SetCapabilities, client);
return SDL_TRUE;
}
diff --git a/src/core/linux/SDL_ibus.c b/src/core/linux/SDL_ibus.c
index eb5a5deeac..0fcec87a11 100644
--- a/src/core/linux/SDL_ibus.c
+++ b/src/core/linux/SDL_ibus.c
@@ -287,7 +287,7 @@ IBus_GetDBusAddressFilename(void)
static SDL_bool IBus_CheckConnection(SDL_DBusContext *dbus);
-static void
+static void SDLCALL
IBus_SetCapabilities(void *data, const char *name, const char *old_val,
const char *internal_editing)
{
@@ -336,7 +336,7 @@ IBus_SetupConnection(SDL_DBusContext *dbus, const char* addr)
DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID)) {
SDL_free(input_ctx_path);
input_ctx_path = SDL_strdup(path);
- SDL_AddHintCallback(SDL_HINT_IME_INTERNAL_EDITING, &IBus_SetCapabilities, NULL);
+ SDL_AddHintCallback(SDL_HINT_IME_INTERNAL_EDITING, IBus_SetCapabilities, NULL);
dbus->bus_add_match(ibus_conn, "type='signal',interface='org.freedesktop.IBus.InputContext'", NULL);
dbus->connection_try_register_object_path(ibus_conn, input_ctx_path, &ibus_vtable, dbus, NULL);
@@ -468,7 +468,7 @@ SDL_IBus_Quit(void)
inotify_wd = -1;
}
- SDL_DelHintCallback(SDL_HINT_IME_INTERNAL_EDITING, &IBus_SetCapabilities, NULL);
+ SDL_DelHintCallback(SDL_HINT_IME_INTERNAL_EDITING, IBus_SetCapabilities, NULL);
SDL_memset(&ibus_cursor_rect, 0, sizeof(ibus_cursor_rect));
}
diff --git a/src/core/winrt/SDL_winrtapp_direct3d.cpp b/src/core/winrt/SDL_winrtapp_direct3d.cpp
index 9603f49f7b..2a2eb15ef5 100644
--- a/src/core/winrt/SDL_winrtapp_direct3d.cpp
+++ b/src/core/winrt/SDL_winrtapp_direct3d.cpp
@@ -121,7 +121,8 @@ int SDL_WinRTInitNonXAMLApp(int (*mainFunction)(int, char **))
return 0;
}
-static void WINRT_SetDisplayOrientationsPreference(void *userdata, const char *name, const char *oldValue, const char *newValue)
+static void SDLCALL
+WINRT_SetDisplayOrientationsPreference(void *userdata, const char *name, const char *oldValue, const char *newValue)
{
SDL_assert(SDL_strcmp(name, SDL_HINT_ORIENTATIONS) == 0);
diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c
index 42d142ab3a..7885c30d33 100644
--- a/src/events/SDL_mouse.c
+++ b/src/events/SDL_mouse.c
@@ -40,7 +40,7 @@ static int SDL_double_click_radius = 1;
static int
SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int x, int y);
-static void
+static void SDLCALL
SDL_MouseNormalSpeedScaleChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
{
SDL_Mouse *mouse = (SDL_Mouse *)userdata;
@@ -52,7 +52,7 @@ SDL_MouseNormalSpeedScaleChanged(void *userdata, const char *name, const char *o
}
}
-static void
+static void SDLCALL
SDL_MouseRelativeSpeedScaleChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
{
SDL_Mouse *mouse = (SDL_Mouse *)userdata;
@@ -64,7 +64,7 @@ SDL_MouseRelativeSpeedScaleChanged(void *userdata, const char *name, const char
}
}
-static void
+static void SDLCALL
SDL_TouchMouseEventsChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
{
SDL_Mouse *mouse = (SDL_Mouse *)userdata;
diff --git a/src/joystick/SDL_gamecontroller.c b/src/joystick/SDL_gamecontroller.c
index 1227fa7dfa..575593a4be 100644
--- a/src/joystick/SDL_gamecontroller.c
+++ b/src/joystick/SDL_gamecontroller.c
@@ -168,13 +168,13 @@ SDL_LoadVIDPIDListFromHint(const char *hint, SDL_vidpid_list *list)
}
}
-static void
+static void SDLCALL
SDL_GameControllerIgnoreDevicesChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
{
SDL_LoadVIDPIDListFromHint(hint, &SDL_ignored_controllers);
}
-static void
+static void SDLCALL
SDL_GameControllerIgnoreDevicesExceptChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
{
SDL_LoadVIDPIDListFromHint(hint, &SDL_allowed_controllers);
diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c
index dc330c9258..f7485d343d 100644
--- a/src/joystick/SDL_joystick.c
+++ b/src/joystick/SDL_joystick.c
@@ -56,7 +56,7 @@ SDL_UnlockJoystickList(void)
}
-static void
+static void SDLCALL
SDL_JoystickAllowBackgroundEventsChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
{
if (hint && *hint == '1') {
diff --git a/src/joystick/iphoneos/SDL_sysjoystick.m b/src/joystick/iphoneos/SDL_sysjoystick.m
index 2120074475..3af5350be1 100644
--- a/src/joystick/iphoneos/SDL_sysjoystick.m
+++ b/src/joystick/iphoneos/SDL_sysjoystick.m
@@ -251,7 +251,7 @@ SDL_SYS_RemoveJoystickDevice(SDL_JoystickDeviceItem *device)
}
#if TARGET_OS_TV
-static void
+static void SDLCALL
SDL_AppleTVRemoteRotationHintChanged(void *udata, const char *name, const char *oldValue, const char *newValue)
{
BOOL allowRotation = newValue != NULL && *newValue != '0';
diff --git a/src/thread/SDL_thread.c b/src/thread/SDL_thread.c
index 38b6e0cac0..78f725e74f 100644
--- a/src/thread/SDL_thread.c
+++ b/src/thread/SDL_thread.c
@@ -50,7 +50,7 @@ SDL_TLSGet(SDL_TLSID id)
}
int
-SDL_TLSSet(SDL_TLSID id, const void *value, void (*destructor)(void *))
+SDL_TLSSet(SDL_TLSID id, const void *value, void (SDLCALL *destructor)(void *))
{
SDL_TLSData *storage;
diff --git a/src/thread/SDL_thread_c.h b/src/thread/SDL_thread_c.h
index bba4095721..d3553fd062 100644
--- a/src/thread/SDL_thread_c.h
+++ b/src/thread/SDL_thread_c.h
@@ -71,7 +71,7 @@ typedef struct {
unsigned int limit;
struct {
void *data;
- void (*destructor)(void*);
+ void (SDLCALL *destructor)(void*);
} array[1];
} SDL_TLSData;
diff --git a/src/timer/windows/SDL_systimer.c b/src/timer/windows/SDL_systimer.c
index 90d5b1e62b..31663ac683 100644
--- a/src/timer/windows/SDL_systimer.c
+++ b/src/timer/windows/SDL_systimer.c
@@ -60,7 +60,7 @@ SDL_SetSystemTimerResolution(const UINT uPeriod)
#endif
}
-static void
+static void SDLCALL
SDL_TimerResolutionChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
{
UINT uPeriod;
diff --git a/src/video/SDL_RLEaccel.c b/src/video/SDL_RLEaccel.c
index 0d6b005a6e..02b28cee5e 100644
--- a/src/video/SDL_RLEaccel.c
+++ b/src/video/SDL_RLEaccel.c
@@ -445,7 +445,7 @@ RLEClipBlit(int w, Uint8 * srcbuf, SDL_Surface * surf_dst,
/* blit a colorkeyed RLE surface */
-int
+int SDLCALL
SDL_RLEBlit(SDL_Surface * surf_src, SDL_Rect * srcrect,
SDL_Surface * surf_dst, SDL_Rect * dstrect)
{
@@ -723,7 +723,7 @@ RLEAlphaClipBlit(int w, Uint8 * srcbuf, SDL_Surface * surf_dst,
}
/* blit a pixel-alpha RLE surface */
-int
+int SDLCALL
SDL_RLEAlphaBlit(SDL_Surface * surf_src, SDL_Rect * srcrect,
SDL_Surface * surf_dst, SDL_Rect * dstrect)
{
diff --git a/src/video/SDL_RLEaccel_c.h b/src/video/SDL_RLEaccel_c.h
index 5700a50def..8931b1584c 100644
--- a/src/video/SDL_RLEaccel_c.h
+++ b/src/video/SDL_RLEaccel_c.h
@@ -23,9 +23,9 @@
/* Useful functions and variables from SDL_RLEaccel.c */
extern int SDL_RLESurface(SDL_Surface * surface);
-extern int SDL_RLEBlit(SDL_Surface * src, SDL_Rect * srcrect,
- SDL_Surface * dst, SDL_Rect * dstrect);
-extern int SDL_RLEAlphaBlit(SDL_Surface * src, SDL_Rect * srcrect,
- SDL_Surface * dst, SDL_Rect * dstrect);
+extern int SDLCALL SDL_RLEBlit (SDL_Surface * src, SDL_Rect * srcrect,
+ SDL_Surface * dst, SDL_Rect * dstrect);
+extern int SDLCALL SDL_RLEAlphaBlit(SDL_Surface * src, SDL_Rect * srcrect,
+ SDL_Surface * dst, SDL_Rect * dstrect);
extern void SDL_UnRLESurface(SDL_Surface * surface, int recode);
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/video/SDL_blit.c b/src/video/SDL_blit.c
index d6fa0dfb3b..2e7404268d 100644
--- a/src/video/SDL_blit.c
+++ b/src/video/SDL_blit.c
@@ -30,7 +30,7 @@
#include "SDL_pixels_c.h"
/* The general purpose software blit routine */
-static int
+static int SDLCALL
SDL_SoftBlit(SDL_Surface * src, SDL_Rect * srcrect,
SDL_Surface * dst, SDL_Rect * dstrect)
{
diff --git a/src/video/android/SDL_androidtouch.c b/src/video/android/SDL_androidtouch.c
index 4aa6b4f5e4..e0d0cd5a2c 100644
--- a/src/video/android/SDL_androidtouch.c
+++ b/src/video/android/SDL_androidtouch.c
@@ -52,7 +52,7 @@ static void Android_GetWindowCoordinates(float x, float y,
static SDL_bool separate_mouse_and_touch = SDL_FALSE;
-static void
+static void SDLCALL
SeparateEventsHintWatcher(void *userdata, const char *name,
const char *oldValue, const char *newValue)
{
diff --git a/src/video/uikit/SDL_uikitappdelegate.m b/src/video/uikit/SDL_uikitappdelegate.m
index b2badaa028..d3ea75c8e3 100644
--- a/src/video/uikit/SDL_uikitappdelegate.m
+++ b/src/video/uikit/SDL_uikitappdelegate.m
@@ -69,7 +69,7 @@ int main(int argc, char **argv)
return exit_status;
}
-static void
+static void SDLCALL
SDL_IdleTimerDisabledChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
{
BOOL disable = (hint && *hint != '0');
diff --git a/src/video/uikit/SDL_uikitviewcontroller.m b/src/video/uikit/SDL_uikitviewcontroller.m
index a4be1ed261..513da87796 100644
--- a/src/video/uikit/SDL_uikitviewcontroller.m
+++ b/src/video/uikit/SDL_uikitviewcontroller.m
@@ -40,7 +40,7 @@
#endif
#if TARGET_OS_TV
-static void
+static void SDLCALL
SDL_AppleTVControllerUIHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
{
@autoreleasepool {
diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c
index 36c79675bb..e97fd59042 100644
--- a/src/video/wayland/SDL_waylandwindow.c
+++ b/src/video/wayland/SDL_waylandwindow.c
@@ -178,7 +178,8 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window)
}
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
-static void QtExtendedSurface_OnHintChanged(void *userdata, const char *name,
+static void SDLCALL
+QtExtendedSurface_OnHintChanged(void *userdata, const char *name,
const char *oldValue, const char *newValue)
{
struct qt_extended_surface *qt_extended_surface = userdata;
diff --git a/src/video/windows/SDL_windowsvideo.c b/src/video/windows/SDL_windowsvideo.c
index f6fc6f4e41..f03ebb061b 100644
--- a/src/video/windows/SDL_windowsvideo.c
+++ b/src/video/windows/SDL_windowsvideo.c
@@ -42,7 +42,8 @@ static void WIN_VideoQuit(_THIS);
SDL_bool g_WindowsEnableMessageLoop = SDL_TRUE;
SDL_bool g_WindowFrameUsableWhileCursorHidden = SDL_TRUE;
-static void UpdateWindowsEnableMessageLoop(void *userdata, const char *name, const char *oldValue, const char *newValue)
+static void SDLCALL
+UpdateWindowsEnableMessageLoop(void *userdata, const char *name, const char *oldValue, const char *newValue)
{
if (newValue && *newValue == '0') {
g_WindowsEnableMessageLoop = SDL_FALSE;
@@ -51,7 +52,8 @@ static void UpdateWindowsEnableMessageLoop(void *userdata, const char *name, con
}
}
-static void UpdateWindowFrameUsableWhileCursorHidden(void *userdata, const char *name, const char *oldValue, const char *newValue)
+static void SDLCALL
+UpdateWindowFrameUsableWhileCursorHidden(void *userdata, const char *name, const char *oldValue, const char *newValue)
{
if (newValue && *newValue == '0') {
g_WindowFrameUsableWhileCursorHidden = SDL_FALSE;