Use SDLCALL for callbacks in public APIs

This commit is contained in:
Cameron Cawley
2022-05-18 22:12:05 +01:00
committed by Sam Lantinga
parent ffab9f46b5
commit 0cca71a846
15 changed files with 30 additions and 26 deletions

View File

@@ -362,7 +362,7 @@ typedef struct
WAVEFORMATEXTENSIBLE fmt;
} EndpointItem;
static int sort_endpoints(const void *_a, const void *_b)
static int SDLCALL sort_endpoints(const void *_a, const void *_b)
{
LPWSTR a = ((const EndpointItem *) _a)->devid;
LPWSTR b = ((const EndpointItem *) _b)->devid;

View File

@@ -53,7 +53,7 @@ typedef struct SDL_HIDAPI_RumbleContext
static SDL_HIDAPI_RumbleContext rumble_context;
static int SDL_HIDAPI_RumbleThread(void *data)
static int SDLCALL SDL_HIDAPI_RumbleThread(void *data)
{
SDL_HIDAPI_RumbleContext *ctx = (SDL_HIDAPI_RumbleContext *)data;

View File

@@ -683,7 +683,7 @@ EnumDevObjectsCallback(LPCDIDEVICEOBJECTINSTANCE pDeviceObject, LPVOID pContext)
/* Sort using the data offset into the DInput struct.
* This gives a reasonable ordering for the inputs.
*/
static int
static int SDLCALL
SortDevFunc(const void *a, const void *b)
{
const input_t *inputA = (const input_t*)a;

View File

@@ -1069,7 +1069,7 @@ RAWINPUT_JoystickGetDeviceInstanceID(int device_index)
return RAWINPUT_GetDeviceByIndex(device_index)->joystick_id;
}
static int
static int SDLCALL
RAWINPUT_SortValueCaps(const void *A, const void *B)
{
HIDP_VALUE_CAPS *capsA = (HIDP_VALUE_CAPS *)A;

View File

@@ -330,7 +330,7 @@ SDL_WaitForDeviceNotification(SDL_DeviceNotificationData *data, SDL_mutex *mutex
static SDL_DeviceNotificationData s_notification_data;
/* Function/thread to scan the system for joysticks. */
static int
static int SDLCALL
SDL_JoystickThread(void *_data)
{
#if SDL_JOYSTICK_XINPUT

View File

@@ -733,7 +733,7 @@ extern "C"
maximum supported value of n differs across systems, but is in all
cases less than the maximum representable value of a size_t.
*/
void *dlmalloc(size_t);
void * SDLCALL dlmalloc(size_t);
/*
free(void* p)
@@ -742,14 +742,14 @@ extern "C"
It has no effect if p is null. If p was not malloced or already
freed, free(p) will by default cause the current program to abort.
*/
void dlfree(void *);
void SDLCALL dlfree(void *);
/*
calloc(size_t n_elements, size_t element_size);
Returns a pointer to n_elements * element_size bytes, with all locations
set to zero.
*/
void *dlcalloc(size_t, size_t);
void * SDLCALL dlcalloc(size_t, size_t);
/*
realloc(void* p, size_t n)
@@ -774,7 +774,7 @@ extern "C"
to be used as an argument to realloc is not supported.
*/
void *dlrealloc(void *, size_t);
void * SDLCALL dlrealloc(void *, size_t);
/*
memalign(size_t alignment, size_t n);

View File

@@ -169,7 +169,7 @@ SDLTest_GenerateExecKey(const char *runSeed, const char *suiteName, const char *
* \return Timer id or -1 on failure.
*/
static SDL_TimerID
SDLTest_SetTestTimeout(int timeout, void (*callback)(void))
SDLTest_SetTestTimeout(int timeout, void (SDLCALL *callback)(void))
{
Uint32 timeoutInMilliseconds;
SDL_TimerID timerID;
@@ -209,7 +209,7 @@ SDLTest_SetTestTimeout(int timeout, void (*callback)(void))
#if defined(__WATCOMC__)
#pragma aux SDLTest_BailOut aborts;
#endif
static SDL_NORETURN void
static SDL_NORETURN void SDLCALL
SDLTest_BailOut(void)
{
SDLTest_LogError("TestCaseTimeout timer expired. Aborting test run.");

View File

@@ -341,7 +341,7 @@ SDL_DestroyWindowTexture(SDL_VideoDevice *unused, SDL_Window * window)
SDL_free(data);
}
static int
static int SDLCALL
cmpmodes(const void *A, const void *B)
{
const SDL_DisplayMode *a = (const SDL_DisplayMode *) A;

View File

@@ -29,6 +29,7 @@
#include "SDL_timer.h"
#include "SDL_vkeys.h"
#include "SDL_hints.h"
#include "SDL_main.h"
#include "../../events/SDL_events_c.h"
#include "../../events/SDL_touch_c.h"
#include "../../events/scancodes_windows.h"