Fixed bug 3745 - specify SDLCALL as the calling convention for API callbacks

Patches contributed by Ozkan Sezer
This commit is contained in:
Sam Lantinga 2017-08-14 06:28:21 -07:00
parent d03409e118
commit de91b1248f
23 changed files with 40 additions and 38 deletions

View File

@ -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. * \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 * \brief Add a function to watch a particular hint

View File

@ -186,7 +186,7 @@ extern DECLSPEC void SDLCALL SDL_LogMessageV(int category,
/** /**
* \brief The prototype for the log output function * \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. * \brief Get the current log output function.

View File

@ -94,8 +94,8 @@ typedef struct SDL_Surface
/** /**
* \brief The type of function used for surface blitting functions. * \brief The type of function used for surface blitting functions.
*/ */
typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect, typedef int (SDLCALL *SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
struct SDL_Surface * dst, SDL_Rect * dstrect); struct SDL_Surface * dst, SDL_Rect * dstrect);
/** /**
* Allocate and free an RGB surface. * Allocate and free an RGB surface.

View File

@ -273,7 +273,7 @@ extern DECLSPEC void * SDLCALL SDL_TLSGet(SDL_TLSID id);
* \sa SDL_TLSCreate() * \sa SDL_TLSCreate()
* \sa SDL_TLSGet() * \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++ */ /* Ends C function definitions when using C++ */

View File

@ -50,9 +50,7 @@ typedef struct SDL_LogLevel
} SDL_LogLevel; } SDL_LogLevel;
/* The default log output function */ /* The default log output function */
static void SDL_LogOutput(void *userdata, static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, const char *message);
int category, SDL_LogPriority priority,
const char *message);
static SDL_LogLevel *SDL_loglevels; static SDL_LogLevel *SDL_loglevels;
static SDL_LogPriority SDL_default_priority = DEFAULT_PRIORITY; static SDL_LogPriority SDL_default_priority = DEFAULT_PRIORITY;
@ -312,7 +310,7 @@ static int consoleAttached = 0;
static HANDLE stderrHandle = NULL; static HANDLE stderrHandle = NULL;
#endif #endif
static void static void SDLCALL
SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
const char *message) const char *message)
{ {

View File

@ -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); SDL_DBus_CallVoidMethod(client->servicename, client->icname, FCITX_IC_DBUS_INTERFACE, method, DBUS_TYPE_INVALID);
} }
static void static void SDLCALL
Fcitx_SetCapabilities(void *data, Fcitx_SetCapabilities(void *data,
const char *name, const char *name,
const char *old_val, const char *old_val,
@ -219,7 +219,7 @@ FcitxClientCreateIC(FcitxClient *client)
NULL); NULL);
dbus->connection_flush(dbus->session_conn); 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; return SDL_TRUE;
} }

View File

@ -287,7 +287,7 @@ IBus_GetDBusAddressFilename(void)
static SDL_bool IBus_CheckConnection(SDL_DBusContext *dbus); static SDL_bool IBus_CheckConnection(SDL_DBusContext *dbus);
static void static void SDLCALL
IBus_SetCapabilities(void *data, const char *name, const char *old_val, IBus_SetCapabilities(void *data, const char *name, const char *old_val,
const char *internal_editing) const char *internal_editing)
{ {
@ -336,7 +336,7 @@ IBus_SetupConnection(SDL_DBusContext *dbus, const char* addr)
DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID)) { DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID)) {
SDL_free(input_ctx_path); SDL_free(input_ctx_path);
input_ctx_path = SDL_strdup(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->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); 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; 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)); SDL_memset(&ibus_cursor_rect, 0, sizeof(ibus_cursor_rect));
} }

View File

@ -121,7 +121,8 @@ int SDL_WinRTInitNonXAMLApp(int (*mainFunction)(int, char **))
return 0; 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); SDL_assert(SDL_strcmp(name, SDL_HINT_ORIENTATIONS) == 0);

View File

@ -40,7 +40,7 @@ static int SDL_double_click_radius = 1;
static int static int
SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int x, int y); 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_MouseNormalSpeedScaleChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
{ {
SDL_Mouse *mouse = (SDL_Mouse *)userdata; 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_MouseRelativeSpeedScaleChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
{ {
SDL_Mouse *mouse = (SDL_Mouse *)userdata; 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_TouchMouseEventsChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
{ {
SDL_Mouse *mouse = (SDL_Mouse *)userdata; SDL_Mouse *mouse = (SDL_Mouse *)userdata;

View File

@ -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_GameControllerIgnoreDevicesChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
{ {
SDL_LoadVIDPIDListFromHint(hint, &SDL_ignored_controllers); 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_GameControllerIgnoreDevicesExceptChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
{ {
SDL_LoadVIDPIDListFromHint(hint, &SDL_allowed_controllers); SDL_LoadVIDPIDListFromHint(hint, &SDL_allowed_controllers);

View File

@ -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) SDL_JoystickAllowBackgroundEventsChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
{ {
if (hint && *hint == '1') { if (hint && *hint == '1') {

View File

@ -251,7 +251,7 @@ SDL_SYS_RemoveJoystickDevice(SDL_JoystickDeviceItem *device)
} }
#if TARGET_OS_TV #if TARGET_OS_TV
static void static void SDLCALL
SDL_AppleTVRemoteRotationHintChanged(void *udata, const char *name, const char *oldValue, const char *newValue) SDL_AppleTVRemoteRotationHintChanged(void *udata, const char *name, const char *oldValue, const char *newValue)
{ {
BOOL allowRotation = newValue != NULL && *newValue != '0'; BOOL allowRotation = newValue != NULL && *newValue != '0';

View File

@ -50,7 +50,7 @@ SDL_TLSGet(SDL_TLSID id)
} }
int 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; SDL_TLSData *storage;

View File

@ -71,7 +71,7 @@ typedef struct {
unsigned int limit; unsigned int limit;
struct { struct {
void *data; void *data;
void (*destructor)(void*); void (SDLCALL *destructor)(void*);
} array[1]; } array[1];
} SDL_TLSData; } SDL_TLSData;

View File

@ -60,7 +60,7 @@ SDL_SetSystemTimerResolution(const UINT uPeriod)
#endif #endif
} }
static void static void SDLCALL
SDL_TimerResolutionChanged(void *userdata, const char *name, const char *oldValue, const char *hint) SDL_TimerResolutionChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
{ {
UINT uPeriod; UINT uPeriod;

View File

@ -445,7 +445,7 @@ RLEClipBlit(int w, Uint8 * srcbuf, SDL_Surface * surf_dst,
/* blit a colorkeyed RLE surface */ /* blit a colorkeyed RLE surface */
int int SDLCALL
SDL_RLEBlit(SDL_Surface * surf_src, SDL_Rect * srcrect, SDL_RLEBlit(SDL_Surface * surf_src, SDL_Rect * srcrect,
SDL_Surface * surf_dst, SDL_Rect * dstrect) 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 */ /* blit a pixel-alpha RLE surface */
int int SDLCALL
SDL_RLEAlphaBlit(SDL_Surface * surf_src, SDL_Rect * srcrect, SDL_RLEAlphaBlit(SDL_Surface * surf_src, SDL_Rect * srcrect,
SDL_Surface * surf_dst, SDL_Rect * dstrect) SDL_Surface * surf_dst, SDL_Rect * dstrect)
{ {

View File

@ -23,9 +23,9 @@
/* Useful functions and variables from SDL_RLEaccel.c */ /* Useful functions and variables from SDL_RLEaccel.c */
extern int SDL_RLESurface(SDL_Surface * surface); extern int SDL_RLESurface(SDL_Surface * surface);
extern int SDL_RLEBlit(SDL_Surface * src, SDL_Rect * srcrect, extern int SDLCALL SDL_RLEBlit (SDL_Surface * src, SDL_Rect * srcrect,
SDL_Surface * dst, SDL_Rect * dstrect); SDL_Surface * dst, SDL_Rect * dstrect);
extern int SDL_RLEAlphaBlit(SDL_Surface * src, SDL_Rect * srcrect, extern int SDLCALL SDL_RLEAlphaBlit(SDL_Surface * src, SDL_Rect * srcrect,
SDL_Surface * dst, SDL_Rect * dstrect); SDL_Surface * dst, SDL_Rect * dstrect);
extern void SDL_UnRLESurface(SDL_Surface * surface, int recode); extern void SDL_UnRLESurface(SDL_Surface * surface, int recode);
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */

View File

@ -30,7 +30,7 @@
#include "SDL_pixels_c.h" #include "SDL_pixels_c.h"
/* The general purpose software blit routine */ /* The general purpose software blit routine */
static int static int SDLCALL
SDL_SoftBlit(SDL_Surface * src, SDL_Rect * srcrect, SDL_SoftBlit(SDL_Surface * src, SDL_Rect * srcrect,
SDL_Surface * dst, SDL_Rect * dstrect) SDL_Surface * dst, SDL_Rect * dstrect)
{ {

View File

@ -52,7 +52,7 @@ static void Android_GetWindowCoordinates(float x, float y,
static SDL_bool separate_mouse_and_touch = SDL_FALSE; static SDL_bool separate_mouse_and_touch = SDL_FALSE;
static void static void SDLCALL
SeparateEventsHintWatcher(void *userdata, const char *name, SeparateEventsHintWatcher(void *userdata, const char *name,
const char *oldValue, const char *newValue) const char *oldValue, const char *newValue)
{ {

View File

@ -69,7 +69,7 @@ int main(int argc, char **argv)
return exit_status; return exit_status;
} }
static void static void SDLCALL
SDL_IdleTimerDisabledChanged(void *userdata, const char *name, const char *oldValue, const char *hint) SDL_IdleTimerDisabledChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
{ {
BOOL disable = (hint && *hint != '0'); BOOL disable = (hint && *hint != '0');

View File

@ -40,7 +40,7 @@
#endif #endif
#if TARGET_OS_TV #if TARGET_OS_TV
static void static void SDLCALL
SDL_AppleTVControllerUIHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint) SDL_AppleTVControllerUIHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
{ {
@autoreleasepool { @autoreleasepool {

View File

@ -178,7 +178,8 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window)
} }
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH #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) const char *oldValue, const char *newValue)
{ {
struct qt_extended_surface *qt_extended_surface = userdata; struct qt_extended_surface *qt_extended_surface = userdata;

View File

@ -42,7 +42,8 @@ static void WIN_VideoQuit(_THIS);
SDL_bool g_WindowsEnableMessageLoop = SDL_TRUE; SDL_bool g_WindowsEnableMessageLoop = SDL_TRUE;
SDL_bool g_WindowFrameUsableWhileCursorHidden = 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') { if (newValue && *newValue == '0') {
g_WindowsEnableMessageLoop = SDL_FALSE; 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') { if (newValue && *newValue == '0') {
g_WindowFrameUsableWhileCursorHidden = SDL_FALSE; g_WindowFrameUsableWhileCursorHidden = SDL_FALSE;