Updated source to match SDL function prototype style

This commit is contained in:
Sam Lantinga 2023-05-23 11:29:41 -07:00
parent 737aa881fa
commit ddbdd73258
173 changed files with 481 additions and 942 deletions

View file

@ -537,15 +537,13 @@ int SDL_GetVersion(SDL_version *ver)
} }
/* Get the library source revision */ /* Get the library source revision */
const char * const char *SDL_GetRevision(void)
SDL_GetRevision(void)
{ {
return SDL_REVISION; return SDL_REVISION;
} }
/* Get the name of the platform */ /* Get the name of the platform */
const char * const char *SDL_GetPlatform(void)
SDL_GetPlatform(void)
{ {
#ifdef __AIX__ #ifdef __AIX__
return "AIX"; return "AIX";
@ -616,8 +614,7 @@ SDL_GetPlatform(void)
#endif #endif
} }
SDL_bool SDL_bool SDL_IsTablet(void)
SDL_IsTablet(void)
{ {
#ifdef __ANDROID__ #ifdef __ANDROID__
extern SDL_bool SDL_IsAndroidTablet(void); extern SDL_bool SDL_IsAndroidTablet(void);
@ -635,9 +632,7 @@ SDL_IsTablet(void)
#if (!defined(HAVE_LIBC) || defined(__WATCOMC__)) && !defined(SDL_STATIC_LIB) #if (!defined(HAVE_LIBC) || defined(__WATCOMC__)) && !defined(SDL_STATIC_LIB)
/* Need to include DllMain() on Watcom C for some reason.. */ /* Need to include DllMain() on Watcom C for some reason.. */
BOOL APIENTRY BOOL APIENTRY _DllMainCRTStartup(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
_DllMainCRTStartup(HANDLE hModule,
DWORD ul_reason_for_call, LPVOID lpReserved)
{ {
switch (ul_reason_for_call) { switch (ul_reason_for_call) {
case DLL_PROCESS_ATTACH: case DLL_PROCESS_ATTACH:

View file

@ -318,9 +318,7 @@ static SDL_AssertState SDLCALL SDL_PromptAssertion(const SDL_AssertData *data, v
return state; return state;
} }
SDL_AssertState SDL_AssertState SDL_ReportAssertion(SDL_AssertData *data, const char *func, const char *file, int line)
SDL_ReportAssertion(SDL_AssertData *data, const char *func, const char *file,
int line)
{ {
SDL_AssertState state = SDL_ASSERTION_IGNORE; SDL_AssertState state = SDL_ASSERTION_IGNORE;
static int assertion_running = 0; static int assertion_running = 0;

View file

@ -49,8 +49,7 @@ static void SDL_FreeDataQueueList(SDL_DataQueuePacket *packet)
} }
} }
SDL_DataQueue * SDL_DataQueue *SDL_CreateDataQueue(const size_t _packetlen, const size_t initialslack)
SDL_CreateDataQueue(const size_t _packetlen, const size_t initialslack)
{ {
SDL_DataQueue *queue = (SDL_DataQueue *)SDL_calloc(1, sizeof(SDL_DataQueue)); SDL_DataQueue *queue = (SDL_DataQueue *)SDL_calloc(1, sizeof(SDL_DataQueue));
@ -230,8 +229,7 @@ int SDL_WriteToDataQueue(SDL_DataQueue *queue, const void *_data, const size_t _
return 0; return 0;
} }
size_t size_t SDL_PeekIntoDataQueue(SDL_DataQueue *queue, void *_buf, const size_t _len)
SDL_PeekIntoDataQueue(SDL_DataQueue *queue, void *_buf, const size_t _len)
{ {
size_t len = _len; size_t len = _len;
Uint8 *buf = (Uint8 *)_buf; Uint8 *buf = (Uint8 *)_buf;
@ -259,8 +257,7 @@ SDL_PeekIntoDataQueue(SDL_DataQueue *queue, void *_buf, const size_t _len)
return (size_t)(ptr - buf); return (size_t)(ptr - buf);
} }
size_t size_t SDL_ReadFromDataQueue(SDL_DataQueue *queue, void *_buf, const size_t _len)
SDL_ReadFromDataQueue(SDL_DataQueue *queue, void *_buf, const size_t _len)
{ {
size_t len = _len; size_t len = _len;
Uint8 *buf = (Uint8 *)_buf; Uint8 *buf = (Uint8 *)_buf;
@ -303,8 +300,7 @@ SDL_ReadFromDataQueue(SDL_DataQueue *queue, void *_buf, const size_t _len)
return (size_t)(ptr - buf); return (size_t)(ptr - buf);
} }
size_t size_t SDL_GetDataQueueSize(SDL_DataQueue *queue)
SDL_GetDataQueueSize(SDL_DataQueue *queue)
{ {
size_t retval = 0; size_t retval = 0;
if (queue) { if (queue) {
@ -315,8 +311,7 @@ SDL_GetDataQueueSize(SDL_DataQueue *queue)
return retval; return retval;
} }
SDL_Mutex * SDL_Mutex *SDL_GetDataQueueMutex(SDL_DataQueue *queue)
SDL_GetDataQueueMutex(SDL_DataQueue *queue)
{ {
return queue ? queue->lock : NULL; return queue ? queue->lock : NULL;
} }

View file

@ -60,8 +60,7 @@ int SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
} }
/* Available for backwards compatibility */ /* Available for backwards compatibility */
const char * const char *SDL_GetError(void)
SDL_GetError(void)
{ {
const SDL_error *error = SDL_GetErrBuf(); const SDL_error *error = SDL_GetErrBuf();
return error->error ? error->str : ""; return error->error ? error->str : "";
@ -91,8 +90,7 @@ int SDL_Error(SDL_errorcode code)
} }
} }
char * char *SDL_GetErrorMsg(char *errstr, int maxlen)
SDL_GetErrorMsg(char *errstr, int maxlen)
{ {
const SDL_error *error = SDL_GetErrBuf(); const SDL_error *error = SDL_GetErrBuf();

View file

@ -43,9 +43,7 @@ typedef struct SDL_Hint
static SDL_Hint *SDL_hints; static SDL_Hint *SDL_hints;
SDL_bool SDL_bool SDL_SetHintWithPriority(const char *name, const char *value, SDL_HintPriority priority)
SDL_SetHintWithPriority(const char *name, const char *value,
SDL_HintPriority priority)
{ {
const char *env; const char *env;
SDL_Hint *hint; SDL_Hint *hint;
@ -95,8 +93,7 @@ SDL_SetHintWithPriority(const char *name, const char *value,
return SDL_TRUE; return SDL_TRUE;
} }
SDL_bool SDL_bool SDL_ResetHint(const char *name)
SDL_ResetHint(const char *name)
{ {
const char *env; const char *env;
SDL_Hint *hint; SDL_Hint *hint;
@ -152,14 +149,12 @@ void SDL_ResetHints(void)
} }
} }
SDL_bool SDL_bool SDL_SetHint(const char *name, const char *value)
SDL_SetHint(const char *name, const char *value)
{ {
return SDL_SetHintWithPriority(name, value, SDL_HINT_NORMAL); return SDL_SetHintWithPriority(name, value, SDL_HINT_NORMAL);
} }
const char * const char *SDL_GetHint(const char *name)
SDL_GetHint(const char *name)
{ {
const char *env; const char *env;
SDL_Hint *hint; SDL_Hint *hint;
@ -176,8 +171,7 @@ SDL_GetHint(const char *name)
return env; return env;
} }
SDL_bool SDL_bool SDL_GetStringBoolean(const char *value, SDL_bool default_value)
SDL_GetStringBoolean(const char *value, SDL_bool default_value)
{ {
if (value == NULL || !*value) { if (value == NULL || !*value) {
return default_value; return default_value;
@ -188,8 +182,7 @@ SDL_GetStringBoolean(const char *value, SDL_bool default_value)
return SDL_TRUE; return SDL_TRUE;
} }
SDL_bool SDL_bool SDL_GetHintBoolean(const char *name, SDL_bool default_value)
SDL_GetHintBoolean(const char *name, SDL_bool default_value)
{ {
const char *hint = SDL_GetHint(name); const char *hint = SDL_GetHint(name);
return SDL_GetStringBoolean(hint, default_value); return SDL_GetStringBoolean(hint, default_value);

View file

@ -160,8 +160,7 @@ void SDL_LogSetPriority(int category, SDL_LogPriority priority)
} }
} }
SDL_LogPriority SDL_LogPriority SDL_LogGetPriority(int category)
SDL_LogGetPriority(int category)
{ {
SDL_LogLevel *entry; SDL_LogLevel *entry;

View file

@ -122,8 +122,7 @@ static SDL_INLINE void leaveLock(void *a)
} }
#endif #endif
SDL_bool SDL_bool SDL_AtomicCAS(SDL_AtomicInt *a, int oldval, int newval)
SDL_AtomicCAS(SDL_AtomicInt *a, int oldval, int newval)
{ {
#ifdef HAVE_MSC_ATOMICS #ifdef HAVE_MSC_ATOMICS
SDL_COMPILE_TIME_ASSERT(atomic_cas, sizeof(long) == sizeof(a->value)); SDL_COMPILE_TIME_ASSERT(atomic_cas, sizeof(long) == sizeof(a->value));
@ -152,8 +151,7 @@ SDL_AtomicCAS(SDL_AtomicInt *a, int oldval, int newval)
#endif #endif
} }
SDL_bool SDL_bool SDL_AtomicCASPtr(void **a, void *oldval, void *newval)
SDL_AtomicCASPtr(void **a, void *oldval, void *newval)
{ {
#ifdef HAVE_MSC_ATOMICS #ifdef HAVE_MSC_ATOMICS
return _InterlockedCompareExchangePointer(a, newval, oldval) == oldval; return _InterlockedCompareExchangePointer(a, newval, oldval) == oldval;

View file

@ -57,8 +57,7 @@ extern __inline int _SDL_xchg_watcom(volatile int *a, int v);
/* *INDENT-ON* */ /* clang-format on */ /* *INDENT-ON* */ /* clang-format on */
/* This function is where all the magic happens... */ /* This function is where all the magic happens... */
SDL_bool SDL_bool SDL_AtomicTryLock(SDL_SpinLock *lock)
SDL_AtomicTryLock(SDL_SpinLock *lock)
{ {
#ifdef SDL_ATOMIC_DISABLED #ifdef SDL_ATOMIC_DISABLED
/* Terrible terrible damage */ /* Terrible terrible damage */

View file

@ -789,8 +789,7 @@ int SDL_GetNumAudioDrivers(void)
return SDL_arraysize(bootstrap) - 1; return SDL_arraysize(bootstrap) - 1;
} }
const char * const char *SDL_GetAudioDriver(int index)
SDL_GetAudioDriver(int index)
{ {
if (index >= 0 && index < SDL_GetNumAudioDrivers()) { if (index >= 0 && index < SDL_GetNumAudioDrivers()) {
return bootstrap[index]->name; return bootstrap[index]->name;
@ -893,8 +892,7 @@ int SDL_InitAudio(const char *driver_name)
/* /*
* Get the current audio driver name * Get the current audio driver name
*/ */
const char * const char *SDL_GetCurrentAudioDriver(void)
SDL_GetCurrentAudioDriver(void)
{ {
return current_audio.name; return current_audio.name;
} }
@ -954,8 +952,7 @@ int SDL_GetNumAudioDevices(int iscapture)
return retval; return retval;
} }
const char * const char *SDL_GetAudioDeviceName(int index, int iscapture)
SDL_GetAudioDeviceName(int index, int iscapture)
{ {
SDL_AudioDeviceItem *item; SDL_AudioDeviceItem *item;
int i; int i;
@ -1412,8 +1409,7 @@ static SDL_AudioDeviceID open_audio_device(const char *devname, int iscapture,
return device->id; return device->id;
} }
SDL_AudioDeviceID SDL_AudioDeviceID SDL_OpenAudioDevice(const char *device, int iscapture,
SDL_OpenAudioDevice(const char *device, int iscapture,
const SDL_AudioSpec *desired, SDL_AudioSpec *obtained, const SDL_AudioSpec *desired, SDL_AudioSpec *obtained,
int allowed_changes) int allowed_changes)
{ {
@ -1421,8 +1417,7 @@ SDL_OpenAudioDevice(const char *device, int iscapture,
allowed_changes, 2); allowed_changes, 2);
} }
SDL_AudioStatus SDL_AudioStatus SDL_GetAudioDeviceStatus(SDL_AudioDeviceID devid)
SDL_GetAudioDeviceStatus(SDL_AudioDeviceID devid)
{ {
SDL_AudioDevice *device = get_audio_device(devid); SDL_AudioDevice *device = get_audio_device(devid);
SDL_AudioStatus status = SDL_AUDIO_STOPPED; SDL_AudioStatus status = SDL_AUDIO_STOPPED;

View file

@ -602,8 +602,7 @@ static int SetAudioStreamFormat(SDL_AudioStream *stream, SDL_AudioFormat src_for
return 0; return 0;
} }
SDL_AudioStream * SDL_AudioStream *SDL_CreateAudioStream(SDL_AudioFormat src_format,
SDL_CreateAudioStream(SDL_AudioFormat src_format,
int src_channels, int src_channels,
int src_rate, int src_rate,
SDL_AudioFormat dst_format, SDL_AudioFormat dst_format,

View file

@ -2075,8 +2075,7 @@ static int WaveLoad(SDL_RWops *src, WaveFile *file, SDL_AudioSpec *spec, Uint8 *
return 0; return 0;
} }
SDL_AudioSpec * SDL_AudioSpec *SDL_LoadWAV_RW(SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len)
SDL_LoadWAV_RW(SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len)
{ {
int result; int result;
WaveFile file; WaveFile file;

View file

@ -202,7 +202,7 @@ static int load_pipewire_syms(void)
return 0; return 0;
} }
SDL_FORCE_INLINE SDL_bool pipewire_version_at_least(int major, int minor, int patch) static SDL_bool pipewire_version_at_least(int major, int minor, int patch)
{ {
return (pipewire_version_major >= major) && return (pipewire_version_major >= major) &&
(pipewire_version_major > major || pipewire_version_minor >= minor) && (pipewire_version_major > major || pipewire_version_minor >= minor) &&

View file

@ -73,15 +73,13 @@ uint32_t qsa_playback_devices;
QSA_Device qsa_capture_device[QSA_MAX_DEVICES]; QSA_Device qsa_capture_device[QSA_MAX_DEVICES];
uint32_t qsa_capture_devices; uint32_t qsa_capture_devices;
static SDL_INLINE int static int QSA_SetError(const char *fn, int status)
QSA_SetError(const char *fn, int status)
{ {
return SDL_SetError("QSA: %s() failed: %s", fn, snd_strerror(status)); return SDL_SetError("QSA: %s() failed: %s", fn, snd_strerror(status));
} }
/* !!! FIXME: does this need to be here? Does the SDL version not work? */ /* !!! FIXME: does this need to be here? Does the SDL version not work? */
static void static void QSA_ThreadInit(SDL_AudioDevice *_this)
QSA_ThreadInit(SDL_AudioDevice *_this)
{ {
/* Increase default 10 priority to 25 to avoid jerky sound */ /* Increase default 10 priority to 25 to avoid jerky sound */
struct sched_param param; struct sched_param param;
@ -92,8 +90,7 @@ QSA_ThreadInit(SDL_AudioDevice *_this)
} }
/* PCM channel parameters initialize function */ /* PCM channel parameters initialize function */
static void static void QSA_InitAudioParams(snd_pcm_channel_params_t * cpars)
QSA_InitAudioParams(snd_pcm_channel_params_t * cpars)
{ {
SDL_zerop(cpars); SDL_zerop(cpars);
cpars->channel = SND_PCM_CHANNEL_PLAYBACK; cpars->channel = SND_PCM_CHANNEL_PLAYBACK;
@ -110,8 +107,7 @@ QSA_InitAudioParams(snd_pcm_channel_params_t * cpars)
} }
/* This function waits until it is possible to write a full sound buffer */ /* This function waits until it is possible to write a full sound buffer */
static void static void QSA_WaitDevice(SDL_AudioDevice *_this)
QSA_WaitDevice(SDL_AudioDevice *_this)
{ {
int result; int result;
@ -136,8 +132,7 @@ QSA_WaitDevice(SDL_AudioDevice *_this)
} }
} }
static void static void QSA_PlayDevice(SDL_AudioDevice *_this)
QSA_PlayDevice(SDL_AudioDevice *_this)
{ {
snd_pcm_channel_status_t cstatus; snd_pcm_channel_status_t cstatus;
int written; int written;
@ -229,14 +224,12 @@ QSA_PlayDevice(SDL_AudioDevice *_this)
} }
} }
static Uint8 * static Uint8 *QSA_GetDeviceBuf(SDL_AudioDevice *_this)
QSA_GetDeviceBuf(SDL_AudioDevice *_this)
{ {
return _this->hidden->pcm_buf; return _this->hidden->pcm_buf;
} }
static void static void QSA_CloseDevice(SDL_AudioDevice *_this)
QSA_CloseDevice(SDL_AudioDevice *_this)
{ {
if (_this->hidden->audio_handle != NULL) { if (_this->hidden->audio_handle != NULL) {
#if _NTO_VERSION < 710 #if _NTO_VERSION < 710
@ -257,8 +250,7 @@ QSA_CloseDevice(SDL_AudioDevice *_this)
SDL_free(_this->hidden); SDL_free(_this->hidden);
} }
static int static int QSA_OpenDevice(SDL_AudioDevice *_this, const char *devname)
QSA_OpenDevice(SDL_AudioDevice *_this, const char *devname)
{ {
#if 0 #if 0
/* !!! FIXME: SDL2 used to pass this handle. What's the alternative? */ /* !!! FIXME: SDL2 used to pass this handle. What's the alternative? */
@ -426,8 +418,7 @@ QSA_OpenDevice(SDL_AudioDevice *_this, const char *devname)
return 0; return 0;
} }
static void static void QSA_DetectDevices(void)
QSA_DetectDevices(void)
{ {
uint32_t it; uint32_t it;
uint32_t cards; uint32_t cards;
@ -572,8 +563,7 @@ QSA_DetectDevices(void)
} }
} }
static void static void QSA_Deinitialize(void)
QSA_Deinitialize(void)
{ {
/* Clear devices array on shutdown */ /* Clear devices array on shutdown */
/* !!! FIXME: we zero these on init...any reason to do it here? */ /* !!! FIXME: we zero these on init...any reason to do it here? */
@ -583,8 +573,7 @@ QSA_Deinitialize(void)
qsa_capture_devices = 0; qsa_capture_devices = 0;
} }
static SDL_bool static SDL_bool QSA_Init(SDL_AudioDriverImpl * impl)
QSA_Init(SDL_AudioDriverImpl * impl)
{ {
/* Clear devices array */ /* Clear devices array */
SDL_zeroa(qsa_playback_device); SDL_zeroa(qsa_playback_device);

View file

@ -220,8 +220,7 @@ static void kbd_register_emerg_cleanup(SDL_EVDEV_keyboard_state *kbd)
} }
} }
SDL_EVDEV_keyboard_state * SDL_EVDEV_keyboard_state *SDL_EVDEV_kbd_init(void)
SDL_EVDEV_kbd_init(void)
{ {
SDL_EVDEV_keyboard_state *kbd; SDL_EVDEV_keyboard_state *kbd;
struct mouse_info mData; struct mouse_info mData;

View file

@ -104,8 +104,7 @@ static int StartBeApp(void *unused)
} }
static int static int StartBeLooper()
StartBeLooper()
{ {
if (!be_app) { if (!be_app) {
SDL_AppThread = SDL_CreateThreadInternal(StartBeApp, "SDLApplication", 0, NULL); SDL_AppThread = SDL_CreateThreadInternal(StartBeApp, "SDLApplication", 0, NULL);
@ -140,8 +139,7 @@ StartBeLooper()
/* Initialize the Be Application, if it's not already started */ /* Initialize the Be Application, if it's not already started */
int int SDL_InitBeApp(void)
SDL_InitBeApp(void)
{ {
/* Create the BApplication that handles appserver interaction */ /* Create the BApplication that handles appserver interaction */
if (SDL_BeAppActive <= 0) { if (SDL_BeAppActive <= 0) {
@ -159,8 +157,7 @@ SDL_InitBeApp(void)
} }
/* Quit the Be Application, if there's nothing left to do */ /* Quit the Be Application, if there's nothing left to do */
void void SDL_QuitBeApp(void)
SDL_QuitBeApp(void)
{ {
/* Decrement the application reference count */ /* Decrement the application reference count */
--SDL_BeAppActive; --SDL_BeAppActive;

View file

@ -190,8 +190,7 @@ void SDL_DBus_Quit(void)
inhibit_handle = NULL; inhibit_handle = NULL;
} }
SDL_DBusContext * SDL_DBusContext *SDL_DBus_GetContext(void)
SDL_DBus_GetContext(void)
{ {
if (dbus_handle == NULL || !dbus.session_conn) { if (dbus_handle == NULL || !dbus.session_conn) {
SDL_DBus_Init(); SDL_DBus_Init();
@ -243,8 +242,7 @@ static SDL_bool SDL_DBus_CallMethodInternal(DBusConnection *conn, const char *no
return retval; return retval;
} }
SDL_bool SDL_bool SDL_DBus_CallMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...)
SDL_DBus_CallMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...)
{ {
SDL_bool retval; SDL_bool retval;
va_list ap; va_list ap;
@ -254,8 +252,7 @@ SDL_DBus_CallMethodOnConnection(DBusConnection *conn, const char *node, const ch
return retval; return retval;
} }
SDL_bool SDL_bool SDL_DBus_CallMethod(const char *node, const char *path, const char *interface, const char *method, ...)
SDL_DBus_CallMethod(const char *node, const char *path, const char *interface, const char *method, ...)
{ {
SDL_bool retval; SDL_bool retval;
va_list ap; va_list ap;
@ -312,8 +309,7 @@ static SDL_bool SDL_DBus_CallWithBasicReply(DBusConnection *conn, DBusMessage *m
return retval; return retval;
} }
SDL_bool SDL_bool SDL_DBus_CallVoidMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...)
SDL_DBus_CallVoidMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...)
{ {
SDL_bool retval; SDL_bool retval;
va_list ap; va_list ap;
@ -323,8 +319,7 @@ SDL_DBus_CallVoidMethodOnConnection(DBusConnection *conn, const char *node, cons
return retval; return retval;
} }
SDL_bool SDL_bool SDL_DBus_CallVoidMethod(const char *node, const char *path, const char *interface, const char *method, ...)
SDL_DBus_CallVoidMethod(const char *node, const char *path, const char *interface, const char *method, ...)
{ {
SDL_bool retval; SDL_bool retval;
va_list ap; va_list ap;
@ -334,8 +329,7 @@ SDL_DBus_CallVoidMethod(const char *node, const char *path, const char *interfac
return retval; return retval;
} }
SDL_bool SDL_bool SDL_DBus_QueryPropertyOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result)
SDL_DBus_QueryPropertyOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result)
{ {
SDL_bool retval = SDL_FALSE; SDL_bool retval = SDL_FALSE;
@ -352,8 +346,7 @@ SDL_DBus_QueryPropertyOnConnection(DBusConnection *conn, const char *node, const
return retval; return retval;
} }
SDL_bool SDL_bool SDL_DBus_QueryProperty(const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result)
SDL_DBus_QueryProperty(const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result)
{ {
return SDL_DBus_QueryPropertyOnConnection(dbus.session_conn, node, path, interface, property, expectedtype, result); return SDL_DBus_QueryPropertyOnConnection(dbus.session_conn, node, path, interface, property, expectedtype, result);
} }
@ -404,8 +397,7 @@ failed:
return SDL_FALSE; return SDL_FALSE;
} }
SDL_bool SDL_bool SDL_DBus_ScreensaverInhibit(SDL_bool inhibit)
SDL_DBus_ScreensaverInhibit(SDL_bool inhibit)
{ {
const char *default_inhibit_reason = "Playing a game"; const char *default_inhibit_reason = "Playing a game";

View file

@ -295,8 +295,7 @@ static void kbd_register_emerg_cleanup(SDL_EVDEV_keyboard_state *kbd)
} }
} }
SDL_EVDEV_keyboard_state * SDL_EVDEV_keyboard_state *SDL_EVDEV_kbd_init(void)
SDL_EVDEV_kbd_init(void)
{ {
SDL_EVDEV_keyboard_state *kbd; SDL_EVDEV_keyboard_state *kbd;
char flag_state; char flag_state;
@ -804,8 +803,7 @@ void SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *state, unsigned int keycode
#elif !defined(SDL_INPUT_FBSDKBIO) /* !SDL_INPUT_LINUXKD */ #elif !defined(SDL_INPUT_FBSDKBIO) /* !SDL_INPUT_LINUXKD */
SDL_EVDEV_keyboard_state * SDL_EVDEV_keyboard_state *SDL_EVDEV_kbd_init(void)
SDL_EVDEV_kbd_init(void)
{ {
return NULL; return NULL;
} }

View file

@ -81,8 +81,7 @@ static char *GetAppName(void)
return SDL_strdup("SDL_App"); return SDL_strdup("SDL_App");
} }
static size_t static size_t Fcitx_GetPreeditString(SDL_DBusContext *dbus,
Fcitx_GetPreeditString(SDL_DBusContext *dbus,
DBusMessage *msg, DBusMessage *msg,
char **ret, char **ret,
Sint32 *start_pos, Sint32 *start_pos,
@ -367,8 +366,7 @@ static Uint32 Fcitx_ModState(void)
return fcitx_mods; return fcitx_mods;
} }
SDL_bool SDL_bool SDL_Fcitx_Init(void)
SDL_Fcitx_Init(void)
{ {
fcitx_client.dbus = SDL_DBus_GetContext(); fcitx_client.dbus = SDL_DBus_GetContext();
@ -404,8 +402,7 @@ void SDL_Fcitx_Reset(void)
FcitxClientICCallMethod(&fcitx_client, "CloseIC"); FcitxClientICCallMethod(&fcitx_client, "CloseIC");
} }
SDL_bool SDL_bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
{ {
Uint32 mod_state = Fcitx_ModState(); Uint32 mod_state = Fcitx_ModState();
Uint32 handled = SDL_FALSE; Uint32 handled = SDL_FALSE;

View file

@ -556,8 +556,7 @@ static SDL_bool IBus_CheckConnection(SDL_DBusContext *dbus)
return SDL_FALSE; return SDL_FALSE;
} }
SDL_bool SDL_bool SDL_IBus_Init(void)
SDL_IBus_Init(void)
{ {
SDL_bool result = SDL_FALSE; SDL_bool result = SDL_FALSE;
SDL_DBusContext *dbus = SDL_DBus_GetContext(); SDL_DBusContext *dbus = SDL_DBus_GetContext();
@ -672,8 +671,7 @@ void SDL_IBus_Reset(void)
IBus_SimpleMessage("Reset"); IBus_SimpleMessage("Reset");
} }
SDL_bool SDL_bool SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
{ {
Uint32 result = 0; Uint32 result = 0;
SDL_DBusContext *dbus = SDL_DBus_GetContext(); SDL_DBusContext *dbus = SDL_DBus_GetContext();

View file

@ -83,8 +83,7 @@ static void InitIME(void)
#endif /* HAVE_IBUS_IBUS_H */ #endif /* HAVE_IBUS_IBUS_H */
} }
SDL_bool SDL_bool SDL_IME_Init(void)
SDL_IME_Init(void)
{ {
InitIME(); InitIME();
@ -127,8 +126,7 @@ void SDL_IME_Reset(void)
} }
} }
SDL_bool SDL_bool SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
{ {
if (SDL_IME_ProcessKeyEvent_Real) { if (SDL_IME_ProcessKeyEvent_Real) {
return SDL_IME_ProcessKeyEvent_Real(keysym, keycode, state); return SDL_IME_ProcessKeyEvent_Real(keysym, keycode, state);

View file

@ -44,8 +44,7 @@ typedef struct SystemThemeData
static SystemThemeData system_theme_data; static SystemThemeData system_theme_data;
static SDL_bool static SDL_bool DBus_ExtractThemeVariant(DBusMessageIter *iter, SDL_SystemTheme *theme) {
DBus_ExtractThemeVariant(DBusMessageIter *iter, SDL_SystemTheme *theme) {
SDL_DBusContext *dbus = system_theme_data.dbus; SDL_DBusContext *dbus = system_theme_data.dbus;
Uint32 color_scheme; Uint32 color_scheme;
DBusMessageIter variant_iter; DBusMessageIter variant_iter;
@ -70,8 +69,7 @@ DBus_ExtractThemeVariant(DBusMessageIter *iter, SDL_SystemTheme *theme) {
return SDL_TRUE; return SDL_TRUE;
} }
static DBusHandlerResult static DBusHandlerResult DBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *data) {
DBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *data) {
SDL_DBusContext *dbus = (SDL_DBusContext *)data; SDL_DBusContext *dbus = (SDL_DBusContext *)data;
if (dbus->message_is_signal(msg, SIGNAL_INTERFACE, SIGNAL_NAME)) { if (dbus->message_is_signal(msg, SIGNAL_INTERFACE, SIGNAL_NAME)) {
@ -108,8 +106,7 @@ not_our_signal:
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
} }
SDL_bool SDL_bool SDL_SystemTheme_Init(void)
SDL_SystemTheme_Init(void)
{ {
SDL_DBusContext *dbus = SDL_DBus_GetContext(); SDL_DBusContext *dbus = SDL_DBus_GetContext();
DBusMessage *msg; DBusMessage *msg;
@ -153,8 +150,7 @@ incorrect_type:
return SDL_TRUE; return SDL_TRUE;
} }
SDL_SystemTheme SDL_SystemTheme SDL_SystemTheme_Get(void)
SDL_SystemTheme_Get(void)
{ {
return system_theme_data.theme; return system_theme_data.theme;
} }

View file

@ -215,8 +215,7 @@ int SDL_UDEV_Scan(void)
return 0; return 0;
} }
SDL_bool SDL_bool SDL_UDEV_GetProductInfo(const char *device_path, Uint16 *vendor, Uint16 *product, Uint16 *version)
SDL_UDEV_GetProductInfo(const char *device_path, Uint16 *vendor, Uint16 *product, Uint16 *version)
{ {
struct udev_enumerate *enumerate = NULL; struct udev_enumerate *enumerate = NULL;
struct udev_list_entry *devs = NULL; struct udev_list_entry *devs = NULL;
@ -543,8 +542,7 @@ void SDL_UDEV_DelCallback(SDL_UDEV_Callback cb)
} }
} }
const SDL_UDEV_Symbols * const SDL_UDEV_Symbols *SDL_UDEV_GetUdevSyms(void)
SDL_UDEV_GetUdevSyms(void)
{ {
if (SDL_UDEV_Init() < 0) { if (SDL_UDEV_Init() < 0) {
SDL_SetError("Could not initialize UDEV"); SDL_SetError("Could not initialize UDEV");

View file

@ -505,8 +505,7 @@ int SDL_IMMDevice_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int isca
return 0; return 0;
} }
SDL_AudioFormat SDL_AudioFormat WaveFormatToSDLFormat(WAVEFORMATEX *waveformat)
WaveFormatToSDLFormat(WAVEFORMATEX *waveformat)
{ {
if ((waveformat->wFormatTag == WAVE_FORMAT_IEEE_FLOAT) && (waveformat->wBitsPerSample == 32)) { if ((waveformat->wFormatTag == WAVE_FORMAT_IEEE_FLOAT) && (waveformat->wBitsPerSample == 32)) {
return SDL_AUDIO_F32SYS; return SDL_AUDIO_F32SYS;

View file

@ -245,8 +245,7 @@ has the same problem.)
WASAPI doesn't need this. This is just for DirectSound/WinMM. WASAPI doesn't need this. This is just for DirectSound/WinMM.
*/ */
char * char *WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid)
WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid)
{ {
#if defined(__WINRT__) || defined(__XBOXONE__) || defined(__XBOXSERIES__) #if defined(__WINRT__) || defined(__XBOXONE__) || defined(__XBOXSERIES__)
return WIN_StringToUTF8(name); /* No registry access on WinRT/UWP and Xbox, go with what we've got. */ return WIN_StringToUTF8(name); /* No registry access on WinRT/UWP and Xbox, go with what we've got. */
@ -343,15 +342,13 @@ BOOL WIN_IsRectEmpty(const RECT *rect)
#include <shellapi.h> /* CommandLineToArgvW() */ #include <shellapi.h> /* CommandLineToArgvW() */
/* Pop up an out of memory message, returns to Windows */ /* Pop up an out of memory message, returns to Windows */
static int static int OutOfMemory(void)
OutOfMemory(void)
{ {
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal Error", "Out of memory - aborting", NULL); SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal Error", "Out of memory - aborting", NULL);
return -1; return -1;
} }
DECLSPEC int DECLSPEC int SDL_RunApp(int _argc, char* _argv[], SDL_main_func mainFunction, void * reserved)
SDL_RunApp(int _argc, char* _argv[], SDL_main_func mainFunction, void * reserved)
{ {
/* Gets the arguments with GetCommandLine, converts them to argc and argv /* Gets the arguments with GetCommandLine, converts them to argc and argv

View file

@ -928,86 +928,72 @@ static Uint32 SDL_GetCPUFeatures(void)
#define CPU_FEATURE_AVAILABLE(f) ((SDL_GetCPUFeatures() & (f)) ? SDL_TRUE : SDL_FALSE) #define CPU_FEATURE_AVAILABLE(f) ((SDL_GetCPUFeatures() & (f)) ? SDL_TRUE : SDL_FALSE)
SDL_bool SDL_bool SDL_HasAltiVec(void)
SDL_HasAltiVec(void)
{ {
return CPU_FEATURE_AVAILABLE(CPU_HAS_ALTIVEC); return CPU_FEATURE_AVAILABLE(CPU_HAS_ALTIVEC);
} }
SDL_bool SDL_bool SDL_HasMMX(void)
SDL_HasMMX(void)
{ {
return CPU_FEATURE_AVAILABLE(CPU_HAS_MMX); return CPU_FEATURE_AVAILABLE(CPU_HAS_MMX);
} }
SDL_bool SDL_bool SDL_HasSSE(void)
SDL_HasSSE(void)
{ {
return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE); return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE);
} }
SDL_bool SDL_bool SDL_HasSSE2(void)
SDL_HasSSE2(void)
{ {
return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE2); return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE2);
} }
SDL_bool SDL_bool SDL_HasSSE3(void)
SDL_HasSSE3(void)
{ {
return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE3); return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE3);
} }
SDL_bool SDL_bool SDL_HasSSE41(void)
SDL_HasSSE41(void)
{ {
return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE41); return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE41);
} }
SDL_bool SDL_bool SDL_HasSSE42(void)
SDL_HasSSE42(void)
{ {
return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE42); return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE42);
} }
SDL_bool SDL_bool SDL_HasAVX(void)
SDL_HasAVX(void)
{ {
return CPU_FEATURE_AVAILABLE(CPU_HAS_AVX); return CPU_FEATURE_AVAILABLE(CPU_HAS_AVX);
} }
SDL_bool SDL_bool SDL_HasAVX2(void)
SDL_HasAVX2(void)
{ {
return CPU_FEATURE_AVAILABLE(CPU_HAS_AVX2); return CPU_FEATURE_AVAILABLE(CPU_HAS_AVX2);
} }
SDL_bool SDL_bool SDL_HasAVX512F(void)
SDL_HasAVX512F(void)
{ {
return CPU_FEATURE_AVAILABLE(CPU_HAS_AVX512F); return CPU_FEATURE_AVAILABLE(CPU_HAS_AVX512F);
} }
SDL_bool SDL_bool SDL_HasARMSIMD(void)
SDL_HasARMSIMD(void)
{ {
return CPU_FEATURE_AVAILABLE(CPU_HAS_ARM_SIMD); return CPU_FEATURE_AVAILABLE(CPU_HAS_ARM_SIMD);
} }
SDL_bool SDL_bool SDL_HasNEON(void)
SDL_HasNEON(void)
{ {
return CPU_FEATURE_AVAILABLE(CPU_HAS_NEON); return CPU_FEATURE_AVAILABLE(CPU_HAS_NEON);
} }
SDL_bool SDL_bool SDL_HasLSX(void)
SDL_HasLSX(void)
{ {
return CPU_FEATURE_AVAILABLE(CPU_HAS_LSX); return CPU_FEATURE_AVAILABLE(CPU_HAS_LSX);
} }
SDL_bool SDL_bool SDL_HasLASX(void)
SDL_HasLASX(void)
{ {
return CPU_FEATURE_AVAILABLE(CPU_HAS_LASX); return CPU_FEATURE_AVAILABLE(CPU_HAS_LASX);
} }
@ -1089,8 +1075,7 @@ int SDL_GetSystemRAM(void)
return SDL_SystemRAM; return SDL_SystemRAM;
} }
size_t size_t SDL_SIMDGetAlignment(void)
SDL_SIMDGetAlignment(void)
{ {
if (SDL_SIMDAlignment == 0xFFFFFFFF) { if (SDL_SIMDAlignment == 0xFFFFFFFF) {
SDL_GetCPUFeatures(); /* make sure this has been calculated */ SDL_GetCPUFeatures(); /* make sure this has been calculated */

View file

@ -643,8 +643,7 @@ static const char *SDL_scancode_names[SDL_NUM_SCANCODES] = {
}; };
/* Taken from SDL_iconv() */ /* Taken from SDL_iconv() */
char * char *SDL_UCS4ToUTF8(Uint32 ch, char *dst)
SDL_UCS4ToUTF8(Uint32 ch, char *dst)
{ {
Uint8 *p = (Uint8 *)dst; Uint8 *p = (Uint8 *)dst;
if (ch <= 0x7F) { if (ch <= 0x7F) {
@ -759,8 +758,7 @@ void SDL_SetScancodeName(SDL_Scancode scancode, const char *name)
SDL_scancode_names[scancode] = name; SDL_scancode_names[scancode] = name;
} }
SDL_Window * SDL_Window *SDL_GetKeyboardFocus(void)
SDL_GetKeyboardFocus(void)
{ {
SDL_Keyboard *keyboard = &SDL_keyboard; SDL_Keyboard *keyboard = &SDL_keyboard;
@ -1029,8 +1027,7 @@ void SDL_ReleaseAutoReleaseKeys(void)
} }
} }
SDL_bool SDL_bool SDL_HardwareKeyboardKeyPressed(void)
SDL_HardwareKeyboardKeyPressed(void)
{ {
SDL_Keyboard *keyboard = &SDL_keyboard; SDL_Keyboard *keyboard = &SDL_keyboard;
SDL_Scancode scancode; SDL_Scancode scancode;
@ -1110,8 +1107,7 @@ void SDL_QuitKeyboard(void)
{ {
} }
const Uint8 * const Uint8 *SDL_GetKeyboardState(int *numkeys)
SDL_GetKeyboardState(int *numkeys)
{ {
SDL_Keyboard *keyboard = &SDL_keyboard; SDL_Keyboard *keyboard = &SDL_keyboard;
@ -1121,8 +1117,7 @@ SDL_GetKeyboardState(int *numkeys)
return keyboard->keystate; return keyboard->keystate;
} }
SDL_Keymod SDL_Keymod SDL_GetModState(void)
SDL_GetModState(void)
{ {
SDL_Keyboard *keyboard = &SDL_keyboard; SDL_Keyboard *keyboard = &SDL_keyboard;
@ -1147,8 +1142,7 @@ void SDL_ToggleModState(const SDL_Keymod modstate, const SDL_bool toggle)
} }
} }
SDL_Keycode SDL_Keycode SDL_GetKeyFromScancode(SDL_Scancode scancode)
SDL_GetKeyFromScancode(SDL_Scancode scancode)
{ {
SDL_Keyboard *keyboard = &SDL_keyboard; SDL_Keyboard *keyboard = &SDL_keyboard;
@ -1160,8 +1154,7 @@ SDL_GetKeyFromScancode(SDL_Scancode scancode)
return keyboard->keymap[scancode]; return keyboard->keymap[scancode];
} }
SDL_Keycode SDL_Keycode SDL_GetDefaultKeyFromScancode(SDL_Scancode scancode)
SDL_GetDefaultKeyFromScancode(SDL_Scancode scancode)
{ {
if (((int)scancode) < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) { if (((int)scancode) < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) {
SDL_InvalidParamError("scancode"); SDL_InvalidParamError("scancode");
@ -1171,8 +1164,7 @@ SDL_GetDefaultKeyFromScancode(SDL_Scancode scancode)
return SDL_default_keymap[scancode]; return SDL_default_keymap[scancode];
} }
SDL_Scancode SDL_Scancode SDL_GetScancodeFromKey(SDL_Keycode key)
SDL_GetScancodeFromKey(SDL_Keycode key)
{ {
SDL_Keyboard *keyboard = &SDL_keyboard; SDL_Keyboard *keyboard = &SDL_keyboard;
SDL_Scancode scancode; SDL_Scancode scancode;
@ -1186,8 +1178,7 @@ SDL_GetScancodeFromKey(SDL_Keycode key)
return SDL_SCANCODE_UNKNOWN; return SDL_SCANCODE_UNKNOWN;
} }
const char * const char *SDL_GetScancodeName(SDL_Scancode scancode)
SDL_GetScancodeName(SDL_Scancode scancode)
{ {
const char *name; const char *name;
if (((int)scancode) < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) { if (((int)scancode) < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) {
@ -1225,8 +1216,7 @@ SDL_Scancode SDL_GetScancodeFromName(const char *name)
return SDL_SCANCODE_UNKNOWN; return SDL_SCANCODE_UNKNOWN;
} }
const char * const char *SDL_GetKeyName(SDL_Keycode key)
SDL_GetKeyName(SDL_Keycode key)
{ {
static char name[8]; static char name[8];
char *end; char *end;
@ -1263,8 +1253,7 @@ SDL_GetKeyName(SDL_Keycode key)
} }
} }
SDL_Keycode SDL_Keycode SDL_GetKeyFromName(const char *name)
SDL_GetKeyFromName(const char *name)
{ {
SDL_Keycode key; SDL_Keycode key;

View file

@ -387,8 +387,7 @@ static const struct {
}; };
/* *INDENT-ON* */ /* clang-format on */ /* *INDENT-ON* */ /* clang-format on */
SDL_Scancode SDL_Scancode SDL_GetScancodeFromKeySym(Uint32 keysym, Uint32 keycode)
SDL_GetScancodeFromKeySym(Uint32 keysym, Uint32 keycode)
{ {
int i; int i;
Uint32 linux_keycode = 0; Uint32 linux_keycode = 0;

View file

@ -217,8 +217,7 @@ void SDL_SetDefaultCursor(SDL_Cursor *cursor)
} }
} }
SDL_Mouse * SDL_Mouse *SDL_GetMouse(void)
SDL_GetMouse(void)
{ {
return &SDL_mouse; return &SDL_mouse;
} }
@ -236,8 +235,7 @@ static Uint32 GetButtonState(SDL_Mouse *mouse, SDL_bool include_touch)
return buttonstate; return buttonstate;
} }
SDL_Window * SDL_Window *SDL_GetMouseFocus(void)
SDL_GetMouseFocus(void)
{ {
SDL_Mouse *mouse = SDL_GetMouse(); SDL_Mouse *mouse = SDL_GetMouse();
@ -252,8 +250,7 @@ SDL_GetMouseFocus(void)
* -flibit * -flibit
*/ */
#if 0 #if 0
void void SDL_ResetMouse(void)
SDL_ResetMouse(void)
{ {
SDL_Mouse *mouse = SDL_GetMouse(); SDL_Mouse *mouse = SDL_GetMouse();
Uint32 buttonState = GetButtonState(mouse, SDL_FALSE); Uint32 buttonState = GetButtonState(mouse, SDL_FALSE);
@ -1069,8 +1066,7 @@ int SDL_SetRelativeMouseMode(SDL_bool enabled)
return 0; return 0;
} }
SDL_bool SDL_bool SDL_GetRelativeMouseMode(void)
SDL_GetRelativeMouseMode(void)
{ {
SDL_Mouse *mouse = SDL_GetMouse(); SDL_Mouse *mouse = SDL_GetMouse();
@ -1155,9 +1151,7 @@ int SDL_CaptureMouse(SDL_bool enabled)
return SDL_UpdateMouseCapture(SDL_FALSE); return SDL_UpdateMouseCapture(SDL_FALSE);
} }
SDL_Cursor * SDL_Cursor *SDL_CreateCursor(const Uint8 *data, const Uint8 *mask, int w, int h, int hot_x, int hot_y)
SDL_CreateCursor(const Uint8 *data, const Uint8 *mask,
int w, int h, int hot_x, int hot_y)
{ {
SDL_Surface *surface; SDL_Surface *surface;
SDL_Cursor *cursor; SDL_Cursor *cursor;
@ -1200,8 +1194,7 @@ SDL_CreateCursor(const Uint8 *data, const Uint8 *mask,
return cursor; return cursor;
} }
SDL_Cursor * SDL_Cursor *SDL_CreateColorCursor(SDL_Surface *surface, int hot_x, int hot_y)
SDL_CreateColorCursor(SDL_Surface *surface, int hot_x, int hot_y)
{ {
SDL_Mouse *mouse = SDL_GetMouse(); SDL_Mouse *mouse = SDL_GetMouse();
SDL_Surface *temp = NULL; SDL_Surface *temp = NULL;
@ -1243,8 +1236,7 @@ SDL_CreateColorCursor(SDL_Surface *surface, int hot_x, int hot_y)
return cursor; return cursor;
} }
SDL_Cursor * SDL_Cursor *SDL_CreateSystemCursor(SDL_SystemCursor id)
SDL_CreateSystemCursor(SDL_SystemCursor id)
{ {
SDL_Mouse *mouse = SDL_GetMouse(); SDL_Mouse *mouse = SDL_GetMouse();
SDL_Cursor *cursor; SDL_Cursor *cursor;
@ -1311,8 +1303,7 @@ int SDL_SetCursor(SDL_Cursor *cursor)
return 0; return 0;
} }
SDL_Cursor * SDL_Cursor *SDL_GetCursor(void)
SDL_GetCursor(void)
{ {
SDL_Mouse *mouse = SDL_GetMouse(); SDL_Mouse *mouse = SDL_GetMouse();
@ -1322,8 +1313,7 @@ SDL_GetCursor(void)
return mouse->cur_cursor; return mouse->cur_cursor;
} }
SDL_Cursor * SDL_Cursor *SDL_GetDefaultCursor(void)
SDL_GetDefaultCursor(void)
{ {
SDL_Mouse *mouse = SDL_GetMouse(); SDL_Mouse *mouse = SDL_GetMouse();

View file

@ -49,8 +49,7 @@ int SDL_GetNumTouchDevices(void)
return SDL_num_touch; return SDL_num_touch;
} }
SDL_TouchID SDL_TouchID SDL_GetTouchDevice(int index)
SDL_GetTouchDevice(int index)
{ {
if (index < 0 || index >= SDL_num_touch) { if (index < 0 || index >= SDL_num_touch) {
SDL_SetError("Unknown touch device index %d", index); SDL_SetError("Unknown touch device index %d", index);
@ -59,8 +58,7 @@ SDL_GetTouchDevice(int index)
return SDL_touchDevices[index]->id; return SDL_touchDevices[index]->id;
} }
const char * const char *SDL_GetTouchName(int index)
SDL_GetTouchName(int index)
{ {
if (index < 0 || index >= SDL_num_touch) { if (index < 0 || index >= SDL_num_touch) {
SDL_SetError("Unknown touch device"); SDL_SetError("Unknown touch device");
@ -83,8 +81,7 @@ static int SDL_GetTouchIndex(SDL_TouchID id)
return -1; return -1;
} }
SDL_Touch * SDL_Touch *SDL_GetTouch(SDL_TouchID id)
SDL_GetTouch(SDL_TouchID id)
{ {
int index = SDL_GetTouchIndex(id); int index = SDL_GetTouchIndex(id);
if (index < 0 || index >= SDL_num_touch) { if (index < 0 || index >= SDL_num_touch) {
@ -99,8 +96,7 @@ SDL_GetTouch(SDL_TouchID id)
return SDL_touchDevices[index]; return SDL_touchDevices[index];
} }
SDL_TouchDeviceType SDL_TouchDeviceType SDL_GetTouchDeviceType(SDL_TouchID id)
SDL_GetTouchDeviceType(SDL_TouchID id)
{ {
SDL_Touch *touch = SDL_GetTouch(id); SDL_Touch *touch = SDL_GetTouch(id);
if (touch) { if (touch) {
@ -138,8 +134,7 @@ int SDL_GetNumTouchFingers(SDL_TouchID touchID)
return 0; return 0;
} }
SDL_Finger * SDL_Finger *SDL_GetTouchFinger(SDL_TouchID touchID, int index)
SDL_GetTouchFinger(SDL_TouchID touchID, int index)
{ {
SDL_Touch *touch = SDL_GetTouch(touchID); SDL_Touch *touch = SDL_GetTouch(touchID);
if (touch == NULL) { if (touch == NULL) {

View file

@ -500,8 +500,7 @@ static int SDLCALL mem_close(SDL_RWops *context)
/* Functions to create SDL_RWops structures from various data sources */ /* Functions to create SDL_RWops structures from various data sources */
SDL_RWops * SDL_RWops *SDL_RWFromFile(const char *file, const char *mode)
SDL_RWFromFile(const char *file, const char *mode)
{ {
SDL_RWops *rwops = NULL; SDL_RWops *rwops = NULL;
if (file == NULL || !*file || mode == NULL || !*mode) { if (file == NULL || !*file || mode == NULL || !*mode) {
@ -593,8 +592,7 @@ SDL_RWFromFile(const char *file, const char *mode)
return rwops; return rwops;
} }
SDL_RWops * SDL_RWops *SDL_RWFromMem(void *mem, int size)
SDL_RWFromMem(void *mem, int size)
{ {
SDL_RWops *rwops = NULL; SDL_RWops *rwops = NULL;
if (mem == NULL) { if (mem == NULL) {
@ -621,8 +619,7 @@ SDL_RWFromMem(void *mem, int size)
return rwops; return rwops;
} }
SDL_RWops * SDL_RWops *SDL_RWFromConstMem(const void *mem, int size)
SDL_RWFromConstMem(const void *mem, int size)
{ {
SDL_RWops *rwops = NULL; SDL_RWops *rwops = NULL;
if (mem == NULL) { if (mem == NULL) {
@ -649,8 +646,7 @@ SDL_RWFromConstMem(const void *mem, int size)
return rwops; return rwops;
} }
SDL_RWops * SDL_RWops *SDL_CreateRW(void)
SDL_CreateRW(void)
{ {
SDL_RWops *area; SDL_RWops *area;
@ -825,49 +821,42 @@ Uint64 SDL_ReadBE64(SDL_RWops *src)
return SDL_SwapBE64(value); return SDL_SwapBE64(value);
} }
size_t size_t SDL_WriteU8(SDL_RWops *dst, Uint8 value)
SDL_WriteU8(SDL_RWops *dst, Uint8 value)
{ {
return (SDL_RWwrite(dst, &value, sizeof(value)) == sizeof(value)) ? 1 : 0; return (SDL_RWwrite(dst, &value, sizeof(value)) == sizeof(value)) ? 1 : 0;
} }
size_t size_t SDL_WriteLE16(SDL_RWops *dst, Uint16 value)
SDL_WriteLE16(SDL_RWops *dst, Uint16 value)
{ {
const Uint16 swapped = SDL_SwapLE16(value); const Uint16 swapped = SDL_SwapLE16(value);
return (SDL_RWwrite(dst, &swapped, sizeof(swapped)) == sizeof(swapped)) ? 1 : 0; return (SDL_RWwrite(dst, &swapped, sizeof(swapped)) == sizeof(swapped)) ? 1 : 0;
} }
size_t size_t SDL_WriteBE16(SDL_RWops *dst, Uint16 value)
SDL_WriteBE16(SDL_RWops *dst, Uint16 value)
{ {
const Uint16 swapped = SDL_SwapBE16(value); const Uint16 swapped = SDL_SwapBE16(value);
return (SDL_RWwrite(dst, &swapped, sizeof(swapped)) == sizeof(swapped)) ? 1 : 0; return (SDL_RWwrite(dst, &swapped, sizeof(swapped)) == sizeof(swapped)) ? 1 : 0;
} }
size_t size_t SDL_WriteLE32(SDL_RWops *dst, Uint32 value)
SDL_WriteLE32(SDL_RWops *dst, Uint32 value)
{ {
const Uint32 swapped = SDL_SwapLE32(value); const Uint32 swapped = SDL_SwapLE32(value);
return (SDL_RWwrite(dst, &swapped, sizeof(swapped)) == sizeof(swapped)) ? 1 : 0; return (SDL_RWwrite(dst, &swapped, sizeof(swapped)) == sizeof(swapped)) ? 1 : 0;
} }
size_t size_t SDL_WriteBE32(SDL_RWops *dst, Uint32 value)
SDL_WriteBE32(SDL_RWops *dst, Uint32 value)
{ {
const Uint32 swapped = SDL_SwapBE32(value); const Uint32 swapped = SDL_SwapBE32(value);
return (SDL_RWwrite(dst, &swapped, sizeof(swapped)) == sizeof(swapped)) ? 1 : 0; return (SDL_RWwrite(dst, &swapped, sizeof(swapped)) == sizeof(swapped)) ? 1 : 0;
} }
size_t size_t SDL_WriteLE64(SDL_RWops *dst, Uint64 value)
SDL_WriteLE64(SDL_RWops *dst, Uint64 value)
{ {
const Uint64 swapped = SDL_SwapLE64(value); const Uint64 swapped = SDL_SwapLE64(value);
return (SDL_RWwrite(dst, &swapped, sizeof(swapped)) == sizeof(swapped)) ? 1 : 0; return (SDL_RWwrite(dst, &swapped, sizeof(swapped)) == sizeof(swapped)) ? 1 : 0;
} }
size_t size_t SDL_WriteBE64(SDL_RWops *dst, Uint64 value)
SDL_WriteBE64(SDL_RWops *dst, Uint64 value)
{ {
const Uint64 swapped = SDL_SwapBE64(value); const Uint64 swapped = SDL_SwapBE64(value);
return (SDL_RWwrite(dst, &swapped, sizeof(swapped)) == sizeof(swapped)) ? 1 : 0; return (SDL_RWwrite(dst, &swapped, sizeof(swapped)) == sizeof(swapped)) ? 1 : 0;

View file

@ -22,21 +22,20 @@
#include "SDL_rwopsromfs.h" #include "SDL_rwopsromfs.h"
/* Checks if the mode is a kind of reading */ /* Checks if the mode is a kind of reading */
SDL_FORCE_INLINE SDL_bool IsReadMode(const char *mode); static SDL_bool IsReadMode(const char *mode);
/* Checks if the file starts with the given prefix */ /* Checks if the file starts with the given prefix */
SDL_FORCE_INLINE SDL_bool HasPrefix(const char *file, const char *prefix); static SDL_bool HasPrefix(const char *file, const char *prefix);
SDL_FORCE_INLINE FILE *TryOpenFile(const char *file, const char *mode); static FILE *TryOpenFile(const char *file, const char *mode);
SDL_FORCE_INLINE FILE *TryOpenInRomfs(const char *file, const char *mode); static FILE *TryOpenInRomfs(const char *file, const char *mode);
/* Nintendo 3DS applications may embed resources in the executable. The /* Nintendo 3DS applications may embed resources in the executable. The
resources are stored in a special read-only partition prefixed with resources are stored in a special read-only partition prefixed with
'romfs:/'. As such, when opening a file, we should first try the romfs 'romfs:/'. As such, when opening a file, we should first try the romfs
unless sdmc is specifically mentionned. unless sdmc is specifically mentionned.
*/ */
FILE * FILE *N3DS_FileOpen(const char *file, const char *mode)
N3DS_FileOpen(const char *file, const char *mode)
{ {
/* romfs are read-only */ /* romfs are read-only */
if (!IsReadMode(mode)) { if (!IsReadMode(mode)) {
@ -51,20 +50,17 @@ N3DS_FileOpen(const char *file, const char *mode)
return TryOpenFile(file, mode); return TryOpenFile(file, mode);
} }
SDL_FORCE_INLINE SDL_bool static SDL_bool IsReadMode(const char *mode)
IsReadMode(const char *mode)
{ {
return SDL_strchr(mode, 'r') != NULL; return SDL_strchr(mode, 'r') != NULL;
} }
SDL_FORCE_INLINE SDL_bool static SDL_bool HasPrefix(const char *file, const char *prefix)
HasPrefix(const char *file, const char *prefix)
{ {
return SDL_strncmp(prefix, file, SDL_strlen(prefix)) == 0; return SDL_strncmp(prefix, file, SDL_strlen(prefix)) == 0;
} }
SDL_FORCE_INLINE FILE * static FILE *TryOpenFile(const char *file, const char *mode)
TryOpenFile(const char *file, const char *mode)
{ {
FILE *fp = NULL; FILE *fp = NULL;
@ -76,8 +72,7 @@ TryOpenFile(const char *file, const char *mode)
return fp; return fp;
} }
SDL_FORCE_INLINE FILE * FILE *TryOpenInRomfs(const char *file, const char *mode)
TryOpenInRomfs(const char *file, const char *mode)
{ {
FILE *fp = NULL; FILE *fp = NULL;
char *prefixed_filepath = NULL; char *prefixed_filepath = NULL;

View file

@ -27,16 +27,14 @@
#include <unistd.h> #include <unistd.h>
char * char *SDL_GetBasePath(void)
SDL_GetBasePath(void)
{ {
/* The current working directory is / on Android */ /* The current working directory is / on Android */
SDL_Unsupported(); SDL_Unsupported();
return NULL; return NULL;
} }
char * char *SDL_GetPrefPath(const char *org, const char *app)
SDL_GetPrefPath(const char *org, const char *app)
{ {
const char *path = SDL_AndroidGetInternalStoragePath(); const char *path = SDL_AndroidGetInternalStoragePath();
if (path) { if (path) {

View file

@ -29,8 +29,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
char * char *SDL_GetBasePath(void)
SDL_GetBasePath(void)
{ {
@autoreleasepool { @autoreleasepool {
NSBundle *bundle = [NSBundle mainBundle]; NSBundle *bundle = [NSBundle mainBundle];
@ -64,8 +63,7 @@ SDL_GetBasePath(void)
} }
} }
char * char *SDL_GetPrefPath(const char *org, const char *app)
SDL_GetPrefPath(const char *org, const char *app)
{ {
@autoreleasepool { @autoreleasepool {
char *retval = NULL; char *retval = NULL;

View file

@ -29,15 +29,13 @@
#include <emscripten/emscripten.h> #include <emscripten/emscripten.h>
char * char *SDL_GetBasePath(void)
SDL_GetBasePath(void)
{ {
char *retval = "/"; char *retval = "/";
return SDL_strdup(retval); return SDL_strdup(retval);
} }
char * char *SDL_GetPrefPath(const char *org, const char *app)
SDL_GetPrefPath(const char *org, const char *app)
{ {
const char *append = "/libsdl/"; const char *append = "/libsdl/";
char *retval; char *retval;

View file

@ -32,8 +32,7 @@
#include <storage/Path.h> #include <storage/Path.h>
char * char *SDL_GetBasePath(void)
SDL_GetBasePath(void)
{ {
char name[MAXPATHLEN]; char name[MAXPATHLEN];
@ -64,8 +63,7 @@ SDL_GetBasePath(void)
} }
char * char *SDL_GetPrefPath(const char *org, const char *app)
SDL_GetPrefPath(const char *org, const char *app)
{ {
// !!! FIXME: is there a better way to do this? // !!! FIXME: is there a better way to do this?
const char *home = SDL_getenv("HOME"); const char *home = SDL_getenv("HOME");

View file

@ -29,18 +29,16 @@
#include <dirent.h> #include <dirent.h>
#include <errno.h> #include <errno.h>
SDL_FORCE_INLINE char *MakePrefPath(const char *app); static char *MakePrefPath(const char *app);
SDL_FORCE_INLINE int CreatePrefPathDir(const char *pref); static int CreatePrefPathDir(const char *pref);
char * char *SDL_GetBasePath(void)
SDL_GetBasePath(void)
{ {
char *base_path = SDL_strdup("romfs:/"); char *base_path = SDL_strdup("romfs:/");
return base_path; return base_path;
} }
char * char *SDL_GetPrefPath(const char *org, const char *app)
SDL_GetPrefPath(const char *org, const char *app)
{ {
char *pref_path = NULL; char *pref_path = NULL;
if (app == NULL) { if (app == NULL) {
@ -68,8 +66,7 @@ char *SDL_GetPath(SDL_Folder folder)
return NULL; return NULL;
} }
SDL_FORCE_INLINE char * static char *MakePrefPath(const char *app)
MakePrefPath(const char *app)
{ {
char *pref_path; char *pref_path;
if (SDL_asprintf(&pref_path, "sdmc:/3ds/%s/", app) < 0) { if (SDL_asprintf(&pref_path, "sdmc:/3ds/%s/", app) < 0) {
@ -79,8 +76,7 @@ MakePrefPath(const char *app)
return pref_path; return pref_path;
} }
SDL_FORCE_INLINE int static int CreatePrefPathDir(const char *pref)
CreatePrefPathDir(const char *pref)
{ {
int result = mkdir(pref, 0666); int result = mkdir(pref, 0666);

View file

@ -28,8 +28,7 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* System dependent filesystem routines */ /* System dependent filesystem routines */
char * char *SDL_GetBasePath(void)
SDL_GetBasePath(void)
{ {
char *retval; char *retval;
size_t len; size_t len;
@ -75,8 +74,7 @@ static void recursive_mkdir(const char *dir)
mkdir(tmp, S_IRWXU); mkdir(tmp, S_IRWXU);
} }
char * char *SDL_GetPrefPath(const char *org, const char *app)
SDL_GetPrefPath(const char *org, const char *app)
{ {
char *retval = NULL; char *retval = NULL;
size_t len; size_t len;

View file

@ -28,8 +28,7 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* System dependent filesystem routines */ /* System dependent filesystem routines */
char * char *SDL_GetBasePath(void)
SDL_GetBasePath(void)
{ {
char *retval = NULL; char *retval = NULL;
size_t len; size_t len;
@ -43,8 +42,7 @@ SDL_GetBasePath(void)
return retval; return retval;
} }
char * char *SDL_GetPrefPath(const char *org, const char *app)
SDL_GetPrefPath(const char *org, const char *app)
{ {
char *retval = NULL; char *retval = NULL;
size_t len; size_t len;

View file

@ -125,8 +125,7 @@ static _kernel_oserror *createDirectoryRecursive(char *path)
return _kernel_swi(OS_File, &regs, &regs); return _kernel_swi(OS_File, &regs, &regs);
} }
char * char *SDL_GetBasePath(void)
SDL_GetBasePath(void)
{ {
_kernel_swi_regs regs; _kernel_swi_regs regs;
_kernel_oserror *error; _kernel_oserror *error;
@ -153,8 +152,7 @@ SDL_GetBasePath(void)
return retval; return retval;
} }
char * char *SDL_GetPrefPath(const char *org, const char *app)
SDL_GetPrefPath(const char *org, const char *app)
{ {
char *canon, *dir, *retval; char *canon, *dir, *retval;
size_t len; size_t len;

View file

@ -120,8 +120,7 @@ static char *search_path_for_binary(const char *bin)
} }
#endif #endif
char * char *SDL_GetBasePath(void)
SDL_GetBasePath(void)
{ {
char *retval = NULL; char *retval = NULL;
@ -259,8 +258,7 @@ SDL_GetBasePath(void)
return retval; return retval;
} }
char * char *SDL_GetPrefPath(const char *org, const char *app)
SDL_GetPrefPath(const char *org, const char *app)
{ {
/* /*
* We use XDG's base directory spec, even if you're not on Linux. * We use XDG's base directory spec, even if you're not on Linux.
@ -361,8 +359,7 @@ SDL_GetPrefPath(const char *org, const char *app)
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
static char * static char *xdg_user_dir_lookup_with_fallback (const char *type, const char *fallback)
xdg_user_dir_lookup_with_fallback (const char *type, const char *fallback)
{ {
FILE *file; FILE *file;
char *home_dir, *config_home, *config_file; char *home_dir, *config_home, *config_file;
@ -491,8 +488,7 @@ error2:
return NULL; return NULL;
} }
static char * static char *xdg_user_dir_lookup (const char *type)
xdg_user_dir_lookup (const char *type)
{ {
char *dir, *home_dir, *user_dir; char *dir, *home_dir, *user_dir;

View file

@ -34,16 +34,14 @@
#include <limits.h> #include <limits.h>
#include <fcntl.h> #include <fcntl.h>
char * char *SDL_GetBasePath(void)
SDL_GetBasePath(void)
{ {
const char *basepath = "app0:/"; const char *basepath = "app0:/";
char *retval = SDL_strdup(basepath); char *retval = SDL_strdup(basepath);
return retval; return retval;
} }
char * char *SDL_GetPrefPath(const char *org, const char *app)
SDL_GetPrefPath(const char *org, const char *app)
{ {
const char *envr = "ux0:/data/"; const char *envr = "ux0:/data/";
char *retval = NULL; char *retval = NULL;

View file

@ -334,22 +334,19 @@ done:
#endif /* SDL_FILESYSTEM_WINDOWS */ #endif /* SDL_FILESYSTEM_WINDOWS */
#ifdef SDL_FILESYSTEM_XBOX #ifdef SDL_FILESYSTEM_XBOX
char * char *SDL_GetBasePath(void)
SDL_GetBasePath(void)
{ {
SDL_Unsupported(); SDL_Unsupported();
return NULL; return NULL;
} }
char * char *SDL_GetPrefPath(const char *org, const char *app)
SDL_GetPrefPath(const char *org, const char *app)
{ {
SDL_Unsupported(); SDL_Unsupported();
return NULL; return NULL;
} }
char * char *SDL_GetPath(SDL_Folder folder)
SDL_GetPath(SDL_Folder folder)
{ {
SDL_Unsupported(); SDL_Unsupported();
return NULL; return NULL;

View file

@ -85,8 +85,7 @@ int SDL_NumHaptics(void)
/* /*
* Gets the name of a Haptic device by index. * Gets the name of a Haptic device by index.
*/ */
const char * const char *SDL_HapticName(int device_index)
SDL_HapticName(int device_index)
{ {
if ((device_index < 0) || (device_index >= SDL_NumHaptics())) { if ((device_index < 0) || (device_index >= SDL_NumHaptics())) {
SDL_SetError("Haptic: There are %d haptic devices available", SDL_SetError("Haptic: There are %d haptic devices available",
@ -99,8 +98,7 @@ SDL_HapticName(int device_index)
/* /*
* Opens a Haptic device. * Opens a Haptic device.
*/ */
SDL_Haptic * SDL_Haptic *SDL_HapticOpen(int device_index)
SDL_HapticOpen(int device_index)
{ {
SDL_Haptic *haptic; SDL_Haptic *haptic;
SDL_Haptic *hapticlist; SDL_Haptic *hapticlist;
@ -211,8 +209,7 @@ int SDL_MouseIsHaptic(void)
/* /*
* Returns the haptic device if mouse is haptic or NULL elsewise. * Returns the haptic device if mouse is haptic or NULL elsewise.
*/ */
SDL_Haptic * SDL_Haptic *SDL_HapticOpenFromMouse(void)
SDL_HapticOpenFromMouse(void)
{ {
int device_index; int device_index;
@ -257,8 +254,7 @@ int SDL_JoystickIsHaptic(SDL_Joystick *joystick)
/* /*
* Opens a haptic device from a joystick. * Opens a haptic device from a joystick.
*/ */
SDL_Haptic * SDL_Haptic *SDL_HapticOpenFromJoystick(SDL_Joystick *joystick)
SDL_HapticOpenFromJoystick(SDL_Joystick *joystick)
{ {
SDL_Haptic *haptic; SDL_Haptic *haptic;
SDL_Haptic *hapticlist; SDL_Haptic *hapticlist;
@ -415,8 +411,7 @@ int SDL_HapticNumEffectsPlaying(SDL_Haptic *haptic)
/* /*
* Returns supported effects by the device. * Returns supported effects by the device.
*/ */
unsigned int unsigned int SDL_HapticQuery(SDL_Haptic *haptic)
SDL_HapticQuery(SDL_Haptic *haptic)
{ {
if (!ValidHaptic(haptic)) { if (!ValidHaptic(haptic)) {
return 0; /* same as if no effects were supported */ return 0; /* same as if no effects were supported */

View file

@ -78,8 +78,7 @@ static SDL_hapticlist_item *HapticByDevId(int device_id)
return NULL; return NULL;
} }
const char * const char *SDL_SYS_HapticName(int index)
SDL_SYS_HapticName(int index)
{ {
SDL_hapticlist_item *item = HapticByOrder(index); SDL_hapticlist_item *item = HapticByOrder(index);
if (item == NULL) { if (item == NULL) {

View file

@ -316,8 +316,7 @@ int MacHaptic_MaybeRemoveDevice(io_object_t device)
/* /*
* Return the name of a haptic device, does not need to be opened. * Return the name of a haptic device, does not need to be opened.
*/ */
const char * const char *SDL_SYS_HapticName(int index)
SDL_SYS_HapticName(int index)
{ {
SDL_hapticlist_item *item; SDL_hapticlist_item *item;
item = HapticByDevIndex(index); item = HapticByDevIndex(index);

View file

@ -39,8 +39,7 @@ int SDL_SYS_NumHaptics(void)
return 0; return 0;
} }
const char * const char *SDL_SYS_HapticName(int index)
SDL_SYS_HapticName(int index)
{ {
SDL_SYS_LogicError(); SDL_SYS_LogicError();
return NULL; return NULL;

View file

@ -344,8 +344,7 @@ static const char *SDL_SYS_HapticNameFromFD(int fd)
/* /*
* Return the name of a haptic device, does not need to be opened. * Return the name of a haptic device, does not need to be opened.
*/ */
const char * const char *SDL_SYS_HapticName(int index)
SDL_SYS_HapticName(int index)
{ {
SDL_hapticlist_item *item; SDL_hapticlist_item *item;
int fd; int fd;

View file

@ -130,8 +130,7 @@ static SDL_hapticlist_item *HapticByDevIndex(int device_index)
/* /*
* Return the name of a haptic device, does not need to be opened. * Return the name of a haptic device, does not need to be opened.
*/ */
const char * const char *SDL_SYS_HapticName(int index)
SDL_SYS_HapticName(int index)
{ {
SDL_hapticlist_item *item = HapticByDevIndex(index); SDL_hapticlist_item *item = HapticByDevIndex(index);
return item->name; return item->name;

View file

@ -193,14 +193,12 @@ static int SDL_inotify_init1(void)
} }
#endif #endif
static int static int StrHasPrefix(const char *string, const char *prefix)
StrHasPrefix(const char *string, const char *prefix)
{ {
return SDL_strncmp(string, prefix, SDL_strlen(prefix)) == 0; return SDL_strncmp(string, prefix, SDL_strlen(prefix)) == 0;
} }
static int static int StrIsInteger(const char *string)
StrIsInteger(const char *string)
{ {
const char *p; const char *p;
@ -218,8 +216,7 @@ StrIsInteger(const char *string)
} }
#endif /* HAVE_INOTIFY */ #endif /* HAVE_INOTIFY */
static void static void HIDAPI_InitializeDiscovery(void)
HIDAPI_InitializeDiscovery(void)
{ {
SDL_HIDAPI_discovery.m_bInitialized = SDL_TRUE; SDL_HIDAPI_discovery.m_bInitialized = SDL_TRUE;
SDL_HIDAPI_discovery.m_unDeviceChangeCounter = 1; SDL_HIDAPI_discovery.m_unDeviceChangeCounter = 1;
@ -358,8 +355,7 @@ HIDAPI_InitializeDiscovery(void)
} }
} }
static void static void HIDAPI_UpdateDiscovery(void)
HIDAPI_UpdateDiscovery(void)
{ {
if (!SDL_HIDAPI_discovery.m_bInitialized) { if (!SDL_HIDAPI_discovery.m_bInitialized) {
HIDAPI_InitializeDiscovery(); HIDAPI_InitializeDiscovery();
@ -476,8 +472,7 @@ HIDAPI_UpdateDiscovery(void)
} }
} }
static void static void HIDAPI_ShutdownDiscovery(void)
HIDAPI_ShutdownDiscovery(void)
{ {
if (!SDL_HIDAPI_discovery.m_bInitialized) { if (!SDL_HIDAPI_discovery.m_bInitialized) {
return; return;
@ -808,8 +803,7 @@ static struct
#ifndef __FreeBSD__ #ifndef __FreeBSD__
/* this is awkwardly inlined, so we need to re-implement it here /* this is awkwardly inlined, so we need to re-implement it here
* so we can override the libusb_control_transfer call */ * so we can override the libusb_control_transfer call */
static int static int SDL_libusb_get_string_descriptor(libusb_device_handle *dev,
SDL_libusb_get_string_descriptor(libusb_device_handle *dev,
uint8_t descriptor_index, uint16_t lang_id, uint8_t descriptor_index, uint16_t lang_id,
unsigned char *data, int length) unsigned char *data, int length)
{ {
@ -960,8 +954,7 @@ static char device_magic;
#if defined(HAVE_PLATFORM_BACKEND) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB) #if defined(HAVE_PLATFORM_BACKEND) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB)
static SDL_hid_device * static SDL_hid_device *CreateHIDDeviceWrapper(void *device, const struct hidapi_backend *backend)
CreateHIDDeviceWrapper(void *device, const struct hidapi_backend *backend)
{ {
SDL_hid_device *wrapper = (SDL_hid_device *)SDL_malloc(sizeof(*wrapper)); SDL_hid_device *wrapper = (SDL_hid_device *)SDL_malloc(sizeof(*wrapper));
wrapper->magic = &device_magic; wrapper->magic = &device_magic;

View file

@ -222,8 +222,7 @@ struct hid_device_ {
BOOL use_hid_write_output_report; BOOL use_hid_write_output_report;
}; };
static BOOL static BOOL IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor)
IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor)
{ {
OSVERSIONINFOEXW osvi; OSVERSIONINFOEXW osvi;
DWORDLONG const dwlConditionMask = VerSetConditionMask( DWORDLONG const dwlConditionMask = VerSetConditionMask(

View file

@ -1736,8 +1736,7 @@ static GCControllerDirectionPad *GetDirectionalPadForController(GCController *co
static char elementName[256]; static char elementName[256];
const char * const char *IOS_GetAppleSFSymbolsNameForButton(SDL_Gamepad *gamepad, SDL_GamepadButton button)
IOS_GetAppleSFSymbolsNameForButton(SDL_Gamepad *gamepad, SDL_GamepadButton button)
{ {
elementName[0] = '\0'; elementName[0] = '\0';
#if defined(SDL_JOYSTICK_MFI) && defined(ENABLE_PHYSICAL_INPUT_PROFILE) #if defined(SDL_JOYSTICK_MFI) && defined(ENABLE_PHYSICAL_INPUT_PROFILE)
@ -1852,8 +1851,7 @@ IOS_GetAppleSFSymbolsNameForButton(SDL_Gamepad *gamepad, SDL_GamepadButton butto
return elementName; return elementName;
} }
const char * const char *IOS_GetAppleSFSymbolsNameForAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis)
IOS_GetAppleSFSymbolsNameForAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis)
{ {
elementName[0] = '\0'; elementName[0] = '\0';
#if defined(SDL_JOYSTICK_MFI) && defined(ENABLE_PHYSICAL_INPUT_PROFILE) #if defined(SDL_JOYSTICK_MFI) && defined(ENABLE_PHYSICAL_INPUT_PROFILE)

View file

@ -699,15 +699,13 @@ static void DARWIN_JoystickDetect(void)
} }
} }
const char * const char *DARWIN_JoystickGetDeviceName(int device_index)
DARWIN_JoystickGetDeviceName(int device_index)
{ {
recDevice *device = GetDeviceForIndex(device_index); recDevice *device = GetDeviceForIndex(device_index);
return device ? device->product : "UNKNOWN"; return device ? device->product : "UNKNOWN";
} }
const char * const char *DARWIN_JoystickGetDevicePath(int device_index)
DARWIN_JoystickGetDevicePath(int device_index)
{ {
return NULL; return NULL;
} }

View file

@ -1783,8 +1783,7 @@ static void HandleSimpleControllerState(SDL_Joystick *joystick, SDL_DriverSwitch
ctx->m_lastSimpleState = *packet; ctx->m_lastSimpleState = *packet;
} }
static void static void SendSensorUpdate(Uint64 timestamp, SDL_Joystick *joystick, SDL_DriverSwitch_Context *ctx, SDL_SensorType type, Uint64 sensor_timestamp, const Sint16 *values)
SendSensorUpdate(Uint64 timestamp, SDL_Joystick *joystick, SDL_DriverSwitch_Context *ctx, SDL_SensorType type, Uint64 sensor_timestamp, const Sint16 *values)
{ {
float data[3]; float data[3];

View file

@ -1240,8 +1240,7 @@ SDL_bool HIDAPI_IsDevicePresent(Uint16 vendor_id, Uint16 product_id, Uint16 vers
return result; return result;
} }
SDL_JoystickType SDL_JoystickType HIDAPI_GetJoystickTypeFromGUID(SDL_JoystickGUID guid)
HIDAPI_GetJoystickTypeFromGUID(SDL_JoystickGUID guid)
{ {
SDL_HIDAPI_Device *device; SDL_HIDAPI_Device *device;
SDL_JoystickType type = SDL_JOYSTICK_TYPE_UNKNOWN; SDL_JoystickType type = SDL_JOYSTICK_TYPE_UNKNOWN;
@ -1258,8 +1257,7 @@ HIDAPI_GetJoystickTypeFromGUID(SDL_JoystickGUID guid)
return type; return type;
} }
SDL_GamepadType SDL_GamepadType HIDAPI_GetGamepadTypeFromGUID(SDL_JoystickGUID guid)
HIDAPI_GetGamepadTypeFromGUID(SDL_JoystickGUID guid)
{ {
SDL_HIDAPI_Device *device; SDL_HIDAPI_Device *device;
SDL_GamepadType type = SDL_GAMEPAD_TYPE_UNKNOWN; SDL_GamepadType type = SDL_GAMEPAD_TYPE_UNKNOWN;

View file

@ -591,8 +591,7 @@ err:
#undef CHECK #undef CHECK
} }
SDL_bool SDL_bool SDL_DINPUT_JoystickPresent(Uint16 vendor_id, Uint16 product_id, Uint16 version_number)
SDL_DINPUT_JoystickPresent(Uint16 vendor_id, Uint16 product_id, Uint16 version_number)
{ {
Joystick_PresentData data; Joystick_PresentData data;
@ -1176,8 +1175,7 @@ void SDL_DINPUT_JoystickDetect(JoyStick_DeviceData **pContext)
{ {
} }
SDL_bool SDL_bool SDL_DINPUT_JoystickPresent(Uint16 vendor, Uint16 product, Uint16 version)
SDL_DINPUT_JoystickPresent(Uint16 vendor, Uint16 product, Uint16 version)
{ {
return SDL_FALSE; return SDL_FALSE;
} }

View file

@ -878,14 +878,12 @@ static int RAWINPUT_JoystickGetCount(void)
return SDL_RAWINPUT_numjoysticks; return SDL_RAWINPUT_numjoysticks;
} }
SDL_bool SDL_bool RAWINPUT_IsEnabled()
RAWINPUT_IsEnabled()
{ {
return SDL_RAWINPUT_inited; return SDL_RAWINPUT_inited;
} }
SDL_bool SDL_bool RAWINPUT_IsDevicePresent(Uint16 vendor_id, Uint16 product_id, Uint16 version, const char *name)
RAWINPUT_IsDevicePresent(Uint16 vendor_id, Uint16 product_id, Uint16 version, const char *name)
{ {
SDL_RAWINPUT_Device *device; SDL_RAWINPUT_Device *device;
@ -1886,8 +1884,7 @@ static void RAWINPUT_JoystickClose(SDL_Joystick *joystick)
} }
} }
SDL_bool SDL_bool RAWINPUT_RegisterNotifications(HWND hWnd)
RAWINPUT_RegisterNotifications(HWND hWnd)
{ {
RAWINPUTDEVICE rid[SDL_arraysize(subscribed_devices)]; RAWINPUTDEVICE rid[SDL_arraysize(subscribed_devices)];
int i; int i;

View file

@ -86,8 +86,7 @@ static SDL_Locale *build_locales_from_csv_string(char *csv)
return retval; return retval;
} }
SDL_Locale * SDL_Locale *SDL_GetPreferredLocales(void)
SDL_GetPreferredLocales(void)
{ {
char locbuf[128]; /* enough for 21 "xx_YY," language strings. */ char locbuf[128]; /* enough for 21 "xx_YY," language strings. */
const char *hint = SDL_GetHint(SDL_HINT_PREFERRED_LOCALES); const char *hint = SDL_GetHint(SDL_HINT_PREFERRED_LOCALES);

View file

@ -26,8 +26,7 @@
#include "SDL_internal.h" #include "SDL_internal.h"
#include "../SDL_syslocale.h" #include "../SDL_syslocale.h"
int int SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
{ {
BLocaleRoster *roster = BLocaleRoster::Default(); BLocaleRoster *roster = BLocaleRoster::Default();
roster->Refresh(); roster->Refresh();

View file

@ -27,7 +27,7 @@
/* Used when the CFGU fails to work. */ /* Used when the CFGU fails to work. */
#define BAD_LOCALE 255 #define BAD_LOCALE 255
SDL_FORCE_INLINE u8 GetLocaleIndex(void); static u8 GetLocaleIndex(void);
int SDL_SYS_GetPreferredLocales(char *buf, size_t buflen) int SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
{ {
@ -42,8 +42,7 @@ int SDL_SYS_GetPreferredLocales(char *buf, size_t buflen)
return 0; return 0;
} }
SDL_FORCE_INLINE u8 static u8 GetLocaleIndex(void)
GetLocaleIndex(void)
{ {
u8 current_locale; u8 current_locale;
if (R_FAILED(cfguInit())) { if (R_FAILED(cfguInit())) {

View file

@ -23,8 +23,7 @@
#include "../SDL_sysurl.h" #include "../SDL_sysurl.h"
#include <Url.h> #include <Url.h>
int int SDL_SYS_OpenURL(const char *url)
SDL_SYS_OpenURL(const char *url)
{ {
BUrl burl(url); BUrl burl(url);
const status_t rc = burl.OpenWithPreferredApplication(false); const status_t rc = burl.OpenWithPreferredApplication(false);

View file

@ -84,8 +84,7 @@ static SDL_GetPowerInfo_Impl implementations[] = {
}; };
#endif #endif
SDL_PowerState SDL_PowerState SDL_GetPowerInfo(int *seconds, int *percent)
SDL_GetPowerInfo(int *seconds, int *percent)
{ {
#ifndef SDL_POWER_DISABLED #ifndef SDL_POWER_DISABLED
const int total = sizeof(implementations) / sizeof(implementations[0]); const int total = sizeof(implementations) / sizeof(implementations[0]);

View file

@ -27,8 +27,7 @@
#include "../../core/android/SDL_android.h" #include "../../core/android/SDL_android.h"
SDL_bool SDL_bool SDL_GetPowerInfo_Android(SDL_PowerState *state, int *seconds, int *percent)
SDL_GetPowerInfo_Android(SDL_PowerState *state, int *seconds, int *percent)
{ {
int battery; int battery;
int plugged; int plugged;

View file

@ -25,8 +25,7 @@
#include <emscripten/html5.h> #include <emscripten/html5.h>
SDL_bool SDL_bool SDL_GetPowerInfo_Emscripten(SDL_PowerState *state, int *seconds, int *percent)
SDL_GetPowerInfo_Emscripten(SDL_PowerState *state, int *seconds, int *percent)
{ {
EmscriptenBatteryEvent batteryState; EmscriptenBatteryEvent batteryState;
int haveBattery = 0; int haveBattery = 0;

View file

@ -40,8 +40,7 @@
#define APM_DEVICE_ALL 1 #define APM_DEVICE_ALL 1
#define APM_BIOS_CALL (B_DEVICE_OP_CODES_END + 3) #define APM_BIOS_CALL (B_DEVICE_OP_CODES_END + 3)
SDL_bool SDL_bool SDL_GetPowerInfo_Haiku(SDL_PowerState *state, int *seconds, int *percent)
SDL_GetPowerInfo_Haiku(SDL_PowerState *state, int *seconds, int *percent)
{ {
const int fd = open("/dev/misc/apm", O_RDONLY | O_CLOEXEC); const int fd = open("/dev/misc/apm", O_RDONLY | O_CLOEXEC);
SDL_bool need_details = SDL_FALSE; SDL_bool need_details = SDL_FALSE;

View file

@ -228,9 +228,7 @@ static void check_proc_acpi_ac_adapter(const char *node, SDL_bool *have_ac)
} }
} }
SDL_bool SDL_bool SDL_GetPowerInfo_Linux_proc_acpi(SDL_PowerState *state, int *seconds, int *percent)
SDL_GetPowerInfo_Linux_proc_acpi(SDL_PowerState *state,
int *seconds, int *percent)
{ {
struct dirent *dent = NULL; struct dirent *dent = NULL;
DIR *dirp = NULL; DIR *dirp = NULL;
@ -313,9 +311,7 @@ static SDL_bool int_string(char *str, int *val)
} }
/* http://lxr.linux.no/linux+v2.6.29/drivers/char/apm-emulation.c */ /* http://lxr.linux.no/linux+v2.6.29/drivers/char/apm-emulation.c */
SDL_bool SDL_bool SDL_GetPowerInfo_Linux_proc_apm(SDL_PowerState *state, int *seconds, int *percent)
SDL_GetPowerInfo_Linux_proc_apm(SDL_PowerState *state,
int *seconds, int *percent)
{ {
SDL_bool need_details = SDL_FALSE; SDL_bool need_details = SDL_FALSE;
int ac_status = 0; int ac_status = 0;
@ -421,8 +417,7 @@ SDL_GetPowerInfo_Linux_proc_apm(SDL_PowerState *state,
return SDL_TRUE; return SDL_TRUE;
} }
SDL_bool SDL_bool SDL_GetPowerInfo_Linux_sys_class_power_supply(SDL_PowerState *state, int *seconds, int *percent)
SDL_GetPowerInfo_Linux_sys_class_power_supply(SDL_PowerState *state, int *seconds, int *percent)
{ {
const char *base = sys_class_power_supply_path; const char *base = sys_class_power_supply_path;
struct dirent *dent; struct dirent *dent;
@ -611,8 +606,7 @@ static void check_upower_device(DBusConnection *conn, const char *path, SDL_Powe
} }
#endif #endif
SDL_bool SDL_bool SDL_GetPowerInfo_Linux_org_freedesktop_upower(SDL_PowerState *state, int *seconds, int *percent)
SDL_GetPowerInfo_Linux_org_freedesktop_upower(SDL_PowerState *state, int *seconds, int *percent)
{ {
SDL_bool retval = SDL_FALSE; SDL_bool retval = SDL_FALSE;

View file

@ -136,8 +136,7 @@ static void checkps(CFDictionaryRef dict, SDL_bool *have_ac, SDL_bool *have_batt
#undef GETVAL #undef GETVAL
#undef STRMATCH #undef STRMATCH
SDL_bool SDL_bool SDL_GetPowerInfo_MacOSX(SDL_PowerState *state, int *seconds, int *percent)
SDL_GetPowerInfo_MacOSX(SDL_PowerState *state, int *seconds, int *percent)
{ {
CFTypeRef blob = IOPSCopyPowerSourcesInfo(); CFTypeRef blob = IOPSCopyPowerSourcesInfo();

View file

@ -25,15 +25,14 @@
#include <3ds.h> #include <3ds.h>
SDL_FORCE_INLINE SDL_PowerState GetPowerState(void); static SDL_PowerState GetPowerState(void);
SDL_FORCE_INLINE int ReadStateFromPTMU(bool *is_plugged, u8 *is_charging); static int ReadStateFromPTMU(bool *is_plugged, u8 *is_charging);
SDL_FORCE_INLINE int GetBatteryPercentage(void); static int GetBatteryPercentage(void);
#define BATTERY_PERCENT_REG 0xB #define BATTERY_PERCENT_REG 0xB
#define BATTERY_PERCENT_REG_SIZE 2 #define BATTERY_PERCENT_REG_SIZE 2
SDL_bool SDL_bool SDL_GetPowerInfo_N3DS(SDL_PowerState *state, int *seconds, int *percent)
SDL_GetPowerInfo_N3DS(SDL_PowerState *state, int *seconds, int *percent)
{ {
*state = GetPowerState(); *state = GetPowerState();
*percent = GetBatteryPercentage(); *percent = GetBatteryPercentage();
@ -42,8 +41,7 @@ SDL_GetPowerInfo_N3DS(SDL_PowerState *state, int *seconds, int *percent)
return SDL_TRUE; return SDL_TRUE;
} }
SDL_FORCE_INLINE SDL_PowerState static SDL_PowerState GetPowerState(void)
GetPowerState(void)
{ {
bool is_plugged; bool is_plugged;
u8 is_charging; u8 is_charging;
@ -63,8 +61,7 @@ GetPowerState(void)
return SDL_POWERSTATE_ON_BATTERY; return SDL_POWERSTATE_ON_BATTERY;
} }
SDL_FORCE_INLINE int static int ReadStateFromPTMU(bool *is_plugged, u8 *is_charging)
ReadStateFromPTMU(bool *is_plugged, u8 *is_charging)
{ {
if (R_FAILED(ptmuInit())) { if (R_FAILED(ptmuInit())) {
return SDL_SetError("Failed to initialise PTMU service"); return SDL_SetError("Failed to initialise PTMU service");
@ -84,8 +81,7 @@ ReadStateFromPTMU(bool *is_plugged, u8 *is_charging)
return 0; return 0;
} }
SDL_FORCE_INLINE int static int GetBatteryPercentage(void)
GetBatteryPercentage(void)
{ {
u8 data[BATTERY_PERCENT_REG_SIZE]; u8 data[BATTERY_PERCENT_REG_SIZE];

View file

@ -26,9 +26,7 @@
#include <psppower.h> #include <psppower.h>
SDL_bool SDL_bool SDL_GetPowerInfo_PSP(SDL_PowerState *state, int *seconds, int *percent)
SDL_GetPowerInfo_PSP(SDL_PowerState *state, int *seconds,
int *percent)
{ {
int battery = scePowerIsBatteryExist(); int battery = scePowerIsBatteryExist();
int plugged = scePowerIsPowerOnline(); int plugged = scePowerIsPowerOnline();

View file

@ -50,8 +50,7 @@ void SDL_UIKit_UpdateBatteryMonitoring(void)
} }
#endif /* !TARGET_OS_TV */ #endif /* !TARGET_OS_TV */
SDL_bool SDL_bool SDL_GetPowerInfo_UIKit(SDL_PowerState *state, int *seconds, int *percent)
SDL_GetPowerInfo_UIKit(SDL_PowerState *state, int *seconds, int *percent)
{ {
#if TARGET_OS_TV #if TARGET_OS_TV
*state = SDL_POWERSTATE_NO_BATTERY; *state = SDL_POWERSTATE_NO_BATTERY;

View file

@ -26,9 +26,7 @@
#include <psp2/power.h> #include <psp2/power.h>
SDL_bool SDL_bool SDL_GetPowerInfo_VITA(SDL_PowerState *state, int *seconds, int *percent)
SDL_GetPowerInfo_VITA(SDL_PowerState *state, int *seconds,
int *percent)
{ {
int battery = 1; int battery = 1;
int plugged = scePowerIsPowerOnline(); int plugged = scePowerIsPowerOnline();

View file

@ -25,8 +25,7 @@
#include "../../core/windows/SDL_windows.h" #include "../../core/windows/SDL_windows.h"
SDL_bool SDL_bool SDL_GetPowerInfo_Windows(SDL_PowerState *state, int *seconds, int *percent)
SDL_GetPowerInfo_Windows(SDL_PowerState *state, int *seconds, int *percent)
{ {
SYSTEM_POWER_STATUS status; SYSTEM_POWER_STATUS status;
SDL_bool need_details = SDL_FALSE; SDL_bool need_details = SDL_FALSE;

View file

@ -27,8 +27,7 @@
#include "SDL_yuv_sw_c.h" #include "SDL_yuv_sw_c.h"
#include "../video/SDL_yuv_c.h" #include "../video/SDL_yuv_c.h"
SDL_SW_YUVTexture * SDL_SW_YUVTexture *SDL_SW_CreateYUVTexture(Uint32 format, int w, int h)
SDL_SW_CreateYUVTexture(Uint32 format, int w, int h)
{ {
SDL_SW_YUVTexture *swdata; SDL_SW_YUVTexture *swdata;

View file

@ -1538,8 +1538,7 @@ static int D3D_SetVSync(SDL_Renderer *renderer, const int vsync)
return 0; return 0;
} }
SDL_Renderer * SDL_Renderer *D3D_CreateRenderer(SDL_Window *window, Uint32 flags)
D3D_CreateRenderer(SDL_Window *window, Uint32 flags)
{ {
SDL_Renderer *renderer; SDL_Renderer *renderer;
D3D_RenderData *data; D3D_RenderData *data;
@ -1730,8 +1729,7 @@ SDL_RenderDriver D3D_RenderDriver = {
#if defined(__WIN32__) || defined(__WINGDK__) #if defined(__WIN32__) || defined(__WINGDK__)
/* This function needs to always exist on Windows, for the Dynamic API. */ /* This function needs to always exist on Windows, for the Dynamic API. */
IDirect3DDevice9 * IDirect3DDevice9 *SDL_GetRenderD3D9Device(SDL_Renderer *renderer)
SDL_GetRenderD3D9Device(SDL_Renderer *renderer)
{ {
IDirect3DDevice9 *device = NULL; IDirect3DDevice9 *device = NULL;

View file

@ -2293,8 +2293,7 @@ static int D3D11_SetVSync(SDL_Renderer *renderer, const int vsync)
} }
#endif #endif
SDL_Renderer * SDL_Renderer *D3D11_CreateRenderer(SDL_Window *window, Uint32 flags)
D3D11_CreateRenderer(SDL_Window *window, Uint32 flags)
{ {
SDL_Renderer *renderer; SDL_Renderer *renderer;
D3D11_RenderData *data; D3D11_RenderData *data;
@ -2401,8 +2400,7 @@ SDL_RenderDriver D3D11_RenderDriver = {
#if defined(__WIN32__) || defined(__WINGDK__) #if defined(__WIN32__) || defined(__WINGDK__)
/* This function needs to always exist on Windows, for the Dynamic API. */ /* This function needs to always exist on Windows, for the Dynamic API. */
ID3D11Device * ID3D11Device *SDL_GetRenderD3D11Device(SDL_Renderer *renderer)
SDL_GetRenderD3D11Device(SDL_Renderer *renderer)
{ {
ID3D11Device *device = NULL; ID3D11Device *device = NULL;

View file

@ -2943,8 +2943,7 @@ static int D3D12_SetVSync(SDL_Renderer *renderer, const int vsync)
return 0; return 0;
} }
SDL_Renderer * SDL_Renderer *D3D12_CreateRenderer(SDL_Window *window, Uint32 flags)
D3D12_CreateRenderer(SDL_Window *window, Uint32 flags)
{ {
SDL_Renderer *renderer; SDL_Renderer *renderer;
D3D12_RenderData *data; D3D12_RenderData *data;

View file

@ -549,8 +549,7 @@ static SDL_bool METAL_SupportsBlendMode(SDL_Renderer *renderer, SDL_BlendMode bl
return SDL_TRUE; return SDL_TRUE;
} }
static int static int METAL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
METAL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
{ {
@autoreleasepool { @autoreleasepool {
METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->driverdata; METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->driverdata;
@ -1465,8 +1464,7 @@ static int METAL_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd,
} }
} }
static int static int METAL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect,
METAL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect,
Uint32 pixel_format, void *pixels, int pitch) Uint32 pixel_format, void *pixels, int pitch)
{ {
@autoreleasepool { @autoreleasepool {

View file

@ -145,8 +145,7 @@ typedef struct
GL_FBOList *fbo; GL_FBOList *fbo;
} GL_TextureData; } GL_TextureData;
SDL_FORCE_INLINE const char * static const char *GL_TranslateError(GLenum error)
GL_TranslateError(GLenum error)
{ {
#define GL_ERROR_TRANSLATE(e) \ #define GL_ERROR_TRANSLATE(e) \
case e: \ case e: \
@ -166,8 +165,7 @@ GL_TranslateError(GLenum error)
#undef GL_ERROR_TRANSLATE #undef GL_ERROR_TRANSLATE
} }
SDL_FORCE_INLINE void static void GL_ClearErrors(SDL_Renderer *renderer)
GL_ClearErrors(SDL_Renderer *renderer)
{ {
GL_RenderData *data = (GL_RenderData *)renderer->driverdata; GL_RenderData *data = (GL_RenderData *)renderer->driverdata;
@ -192,8 +190,7 @@ GL_ClearErrors(SDL_Renderer *renderer)
} }
} }
SDL_FORCE_INLINE int static int GL_CheckAllErrors(const char *prefix, SDL_Renderer *renderer, const char *file, int line, const char *function)
GL_CheckAllErrors(const char *prefix, SDL_Renderer *renderer, const char *file, int line, const char *function)
{ {
GL_RenderData *data = (GL_RenderData *)renderer->driverdata; GL_RenderData *data = (GL_RenderData *)renderer->driverdata;
int ret = 0; int ret = 0;
@ -400,8 +397,7 @@ static SDL_bool GL_SupportsBlendMode(SDL_Renderer *renderer, SDL_BlendMode blend
return SDL_TRUE; return SDL_TRUE;
} }
SDL_FORCE_INLINE SDL_bool static SDL_bool convert_format(GL_RenderData *renderdata, Uint32 pixel_format,
convert_format(GL_RenderData *renderdata, Uint32 pixel_format,
GLint *internalFormat, GLenum *format, GLenum *type) GLint *internalFormat, GLenum *format, GLenum *type)
{ {
switch (pixel_format) { switch (pixel_format) {

View file

@ -488,8 +488,7 @@ static void DestroyShaderProgram(GL_ShaderContext *ctx, GL_ShaderData *data)
ctx->glDeleteObjectARB(data->program); ctx->glDeleteObjectARB(data->program);
} }
GL_ShaderContext * GL_ShaderContext *GL_CreateShaderContext(void)
GL_CreateShaderContext(void)
{ {
GL_ShaderContext *ctx; GL_ShaderContext *ctx;
SDL_bool shaders_supported; SDL_bool shaders_supported;

View file

@ -175,8 +175,7 @@ typedef struct GLES2_RenderData
static const float inv255f = 1.0f / 255.0f; static const float inv255f = 1.0f / 255.0f;
SDL_FORCE_INLINE const char * static const char *GL_TranslateError(GLenum error)
GL_TranslateError(GLenum error)
{ {
#define GL_ERROR_TRANSLATE(e) \ #define GL_ERROR_TRANSLATE(e) \
case e: \ case e: \
@ -193,8 +192,7 @@ GL_TranslateError(GLenum error)
#undef GL_ERROR_TRANSLATE #undef GL_ERROR_TRANSLATE
} }
SDL_FORCE_INLINE void static void GL_ClearErrors(SDL_Renderer *renderer)
GL_ClearErrors(SDL_Renderer *renderer)
{ {
GLES2_RenderData *data = (GLES2_RenderData *)renderer->driverdata; GLES2_RenderData *data = (GLES2_RenderData *)renderer->driverdata;
@ -206,8 +204,7 @@ GL_ClearErrors(SDL_Renderer *renderer)
} }
} }
SDL_FORCE_INLINE int static int GL_CheckAllErrors(const char *prefix, SDL_Renderer *renderer, const char *file, int line, const char *function)
GL_CheckAllErrors(const char *prefix, SDL_Renderer *renderer, const char *file, int line, const char *function)
{ {
GLES2_RenderData *data = (GLES2_RenderData *)renderer->driverdata; GLES2_RenderData *data = (GLES2_RenderData *)renderer->driverdata;
int ret = 0; int ret = 0;

View file

@ -1290,8 +1290,7 @@ static int PSP_SetVSync(SDL_Renderer *renderer, const int vsync)
return 0; return 0;
} }
SDL_Renderer * SDL_Renderer *PSP_CreateRenderer(SDL_Window *window, Uint32 flags)
PSP_CreateRenderer(SDL_Window *window, Uint32 flags)
{ {
SDL_Renderer *renderer; SDL_Renderer *renderer;

View file

@ -1089,8 +1089,7 @@ static void SW_SelectBestFormats(SDL_Renderer *renderer, Uint32 format)
} }
} }
SDL_Renderer * SDL_Renderer *SW_CreateRendererForSurface(SDL_Surface *surface)
SW_CreateRendererForSurface(SDL_Surface *surface)
{ {
SDL_Renderer *renderer; SDL_Renderer *renderer;
SW_RenderData *data; SW_RenderData *data;

View file

@ -486,8 +486,7 @@ When using the NONE and MOD modes, color and alpha modulation must be applied be
*/ */
SDL_Surface * SDL_Surface *SDLgfx_rotateSurface(SDL_Surface *src, double angle, int smooth, int flipx, int flipy,
SDLgfx_rotateSurface(SDL_Surface *src, double angle, int smooth, int flipx, int flipy,
const SDL_Rect *rect_dest, double cangle, double sangle, const SDL_FPoint *center) const SDL_Rect *rect_dest, double cangle, double sangle, const SDL_FPoint *center)
{ {
SDL_Surface *rz_dst; SDL_Surface *rz_dst;

View file

@ -209,8 +209,7 @@ static int VITA_GXM_SetVSync(SDL_Renderer *renderer, const int vsync)
return 0; return 0;
} }
SDL_Renderer * SDL_Renderer *VITA_GXM_CreateRenderer(SDL_Window *window, Uint32 flags)
VITA_GXM_CreateRenderer(SDL_Window *window, Uint32 flags)
{ {
SDL_Renderer *renderer; SDL_Renderer *renderer;
VITA_GXM_RenderData *data; VITA_GXM_RenderData *data;

View file

@ -980,8 +980,7 @@ static SceGxmColorFormat tex_format_to_color_format(SceGxmTextureFormat format)
} }
} }
gxm_texture * gxm_texture *create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsigned int h, SceGxmTextureFormat format, unsigned int isRenderTarget, unsigned int *return_w, unsigned int *return_h, unsigned int *return_pitch, float *return_wscale)
create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsigned int h, SceGxmTextureFormat format, unsigned int isRenderTarget, unsigned int *return_w, unsigned int *return_h, unsigned int *return_pitch, float *return_wscale)
{ {
gxm_texture *texture = SDL_calloc(1, sizeof(gxm_texture)); gxm_texture *texture = SDL_calloc(1, sizeof(gxm_texture));
int aligned_w = ALIGN(w, 8); int aligned_w = ALIGN(w, 8);

View file

@ -38,12 +38,11 @@ typedef struct
static SDL_N3DSSensor N3DS_sensors[N3DS_SENSOR_COUNT]; static SDL_N3DSSensor N3DS_sensors[N3DS_SENSOR_COUNT];
SDL_FORCE_INLINE int InitN3DSServices(void); static int InitN3DSServices(void);
SDL_FORCE_INLINE void UpdateN3DSAccelerometer(SDL_Sensor *sensor); static void UpdateN3DSAccelerometer(SDL_Sensor *sensor);
SDL_FORCE_INLINE void UpdateN3DSGyroscope(SDL_Sensor *sensor); static void UpdateN3DSGyroscope(SDL_Sensor *sensor);
SDL_FORCE_INLINE SDL_bool static SDL_bool IsDeviceIndexValid(int device_index)
IsDeviceIndexValid(int device_index)
{ {
return device_index >= 0 && device_index < N3DS_SENSOR_COUNT; return device_index >= 0 && device_index < N3DS_SENSOR_COUNT;
} }
@ -61,8 +60,7 @@ static int N3DS_SensorInit(void)
return 0; return 0;
} }
SDL_FORCE_INLINE int static int InitN3DSServices(void)
InitN3DSServices(void)
{ {
if (R_FAILED(hidInit())) { if (R_FAILED(hidInit())) {
return -1; return -1;
@ -143,8 +141,7 @@ static void N3DS_SensorUpdate(SDL_Sensor *sensor)
} }
} }
SDL_FORCE_INLINE void static void UpdateN3DSAccelerometer(SDL_Sensor *sensor)
UpdateN3DSAccelerometer(SDL_Sensor *sensor)
{ {
static accelVector previous_state = { 0, 0, 0 }; static accelVector previous_state = { 0, 0, 0 };
accelVector current_state; accelVector current_state;
@ -161,8 +158,7 @@ UpdateN3DSAccelerometer(SDL_Sensor *sensor)
} }
} }
SDL_FORCE_INLINE void static void UpdateN3DSGyroscope(SDL_Sensor *sensor)
UpdateN3DSGyroscope(SDL_Sensor *sensor)
{ {
static angularRate previous_state = { 0, 0, 0 }; static angularRate previous_state = { 0, 0, 0 };
angularRate current_state; angularRate current_state;

View file

@ -161,8 +161,7 @@ int SDL_setenv(const char *name, const char *value, int overwrite)
/* Retrieve a variable named "name" from the environment */ /* Retrieve a variable named "name" from the environment */
#ifdef HAVE_GETENV #ifdef HAVE_GETENV
char * char *SDL_getenv(const char *name)
SDL_getenv(const char *name)
{ {
#ifdef __ANDROID__ #ifdef __ANDROID__
/* Make sure variables from the application manifest are available */ /* Make sure variables from the application manifest are available */
@ -177,8 +176,7 @@ SDL_getenv(const char *name)
return getenv(name); return getenv(name);
} }
#elif defined(__WIN32__) || defined(__WINGDK__) #elif defined(__WIN32__) || defined(__WINGDK__)
char * char *SDL_getenv(const char *name)
SDL_getenv(const char *name)
{ {
size_t bufferlen; size_t bufferlen;
@ -204,8 +202,7 @@ SDL_getenv(const char *name)
return SDL_envmem; return SDL_envmem;
} }
#else #else
char * char *SDL_getenv(const char *name)
SDL_getenv(const char *name)
{ {
size_t len, i; size_t len, i;
char *value; char *value;

View file

@ -32,8 +32,7 @@
SDL_COMPILE_TIME_ASSERT(iconv_t, sizeof(iconv_t) <= sizeof(SDL_iconv_t)); SDL_COMPILE_TIME_ASSERT(iconv_t, sizeof(iconv_t) <= sizeof(SDL_iconv_t));
SDL_iconv_t SDL_iconv_t SDL_iconv_open(const char *tocode, const char *fromcode)
SDL_iconv_open(const char *tocode, const char *fromcode)
{ {
return (SDL_iconv_t)((uintptr_t)iconv_open(tocode, fromcode)); return (SDL_iconv_t)((uintptr_t)iconv_open(tocode, fromcode));
} }
@ -43,8 +42,7 @@ int SDL_iconv_close(SDL_iconv_t cd)
return iconv_close((iconv_t)((uintptr_t)cd)); return iconv_close((iconv_t)((uintptr_t)cd));
} }
size_t size_t SDL_iconv(SDL_iconv_t cd,
SDL_iconv(SDL_iconv_t cd,
const char **inbuf, size_t *inbytesleft, const char **inbuf, size_t *inbytesleft,
char **outbuf, size_t *outbytesleft) char **outbuf, size_t *outbytesleft)
{ {
@ -188,8 +186,7 @@ static const char *getlocale(char *buffer, size_t bufsize)
return buffer; return buffer;
} }
SDL_iconv_t SDL_iconv_t SDL_iconv_open(const char *tocode, const char *fromcode)
SDL_iconv_open(const char *tocode, const char *fromcode)
{ {
int src_fmt = ENCODING_UNKNOWN; int src_fmt = ENCODING_UNKNOWN;
int dst_fmt = ENCODING_UNKNOWN; int dst_fmt = ENCODING_UNKNOWN;
@ -228,8 +225,7 @@ SDL_iconv_open(const char *tocode, const char *fromcode)
return (SDL_iconv_t)-1; return (SDL_iconv_t)-1;
} }
size_t size_t SDL_iconv(SDL_iconv_t cd,
SDL_iconv(SDL_iconv_t cd,
const char **inbuf, size_t *inbytesleft, const char **inbuf, size_t *inbytesleft,
char **outbuf, size_t *outbytesleft) char **outbuf, size_t *outbytesleft)
{ {
@ -781,9 +777,7 @@ int SDL_iconv_close(SDL_iconv_t cd)
#endif /* !HAVE_ICONV */ #endif /* !HAVE_ICONV */
char * char *SDL_iconv_string(const char *tocode, const char *fromcode, const char *inbuf, size_t inbytesleft)
SDL_iconv_string(const char *tocode, const char *fromcode, const char *inbuf,
size_t inbytesleft)
{ {
SDL_iconv_t cd; SDL_iconv_t cd;
char *string; char *string;

View file

@ -22,8 +22,7 @@
#ifdef HAVE_QSORT #ifdef HAVE_QSORT
void void SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *))
SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *))
{ {
qsort(base, nmemb, size, compare); qsort(base, nmemb, size, compare);
} }

View file

@ -50,8 +50,7 @@ static unsigned UTF8_GetTrailingBytes(unsigned char c)
} }
#if !defined(HAVE_VSSCANF) || !defined(HAVE_STRTOL) || !defined(HAVE_STRTOUL) || !defined(HAVE_STRTOD) #if !defined(HAVE_VSSCANF) || !defined(HAVE_STRTOL) || !defined(HAVE_STRTOUL) || !defined(HAVE_STRTOD)
static size_t static size_t SDL_ScanLong(const char *text, int count, int radix, long *valuep)
SDL_ScanLong(const char *text, int count, int radix, long *valuep)
{ {
const char *textstart = text; const char *textstart = text;
long value = 0; long value = 0;
@ -95,8 +94,7 @@ SDL_ScanLong(const char *text, int count, int radix, long *valuep)
#endif #endif
#if !defined(HAVE_VSSCANF) || !defined(HAVE_STRTOUL) || !defined(HAVE_STRTOD) #if !defined(HAVE_VSSCANF) || !defined(HAVE_STRTOUL) || !defined(HAVE_STRTOD)
static size_t static size_t SDL_ScanUnsignedLong(const char *text, int count, int radix, unsigned long *valuep)
SDL_ScanUnsignedLong(const char *text, int count, int radix, unsigned long *valuep)
{ {
const char *textstart = text; const char *textstart = text;
unsigned long value = 0; unsigned long value = 0;
@ -135,8 +133,7 @@ SDL_ScanUnsignedLong(const char *text, int count, int radix, unsigned long *valu
#endif #endif
#ifndef HAVE_VSSCANF #ifndef HAVE_VSSCANF
static size_t static size_t SDL_ScanUintPtrT(const char *text, int radix, uintptr_t *valuep)
SDL_ScanUintPtrT(const char *text, int radix, uintptr_t *valuep)
{ {
const char *textstart = text; const char *textstart = text;
uintptr_t value = 0; uintptr_t value = 0;
@ -167,8 +164,7 @@ SDL_ScanUintPtrT(const char *text, int radix, uintptr_t *valuep)
#endif #endif
#if !defined(HAVE_VSSCANF) || !defined(HAVE_STRTOLL) || !defined(HAVE_STRTOULL) #if !defined(HAVE_VSSCANF) || !defined(HAVE_STRTOLL) || !defined(HAVE_STRTOULL)
static size_t static size_t SDL_ScanLongLong(const char *text, int count, int radix, Sint64 *valuep)
SDL_ScanLongLong(const char *text, int count, int radix, Sint64 *valuep)
{ {
const char *textstart = text; const char *textstart = text;
Sint64 value = 0; Sint64 value = 0;
@ -212,8 +208,7 @@ SDL_ScanLongLong(const char *text, int count, int radix, Sint64 *valuep)
#endif #endif
#if !defined(HAVE_VSSCANF) || !defined(HAVE_STRTOULL) #if !defined(HAVE_VSSCANF) || !defined(HAVE_STRTOULL)
static size_t static size_t SDL_ScanUnsignedLongLong(const char *text, int count, int radix, Uint64 *valuep)
SDL_ScanUnsignedLongLong(const char *text, int count, int radix, Uint64 *valuep)
{ {
const char *textstart = text; const char *textstart = text;
Uint64 value = 0; Uint64 value = 0;
@ -252,8 +247,7 @@ SDL_ScanUnsignedLongLong(const char *text, int count, int radix, Uint64 *valuep)
#endif #endif
#if !defined(HAVE_VSSCANF) || !defined(HAVE_STRTOD) #if !defined(HAVE_VSSCANF) || !defined(HAVE_STRTOD)
static size_t static size_t SDL_ScanFloat(const char *text, double *valuep)
SDL_ScanFloat(const char *text, double *valuep)
{ {
const char *textstart = text; const char *textstart = text;
unsigned long lvalue = 0; unsigned long lvalue = 0;
@ -339,8 +333,7 @@ int SDL_memcmp(const void *s1, const void *s2, size_t len)
#endif /* HAVE_MEMCMP */ #endif /* HAVE_MEMCMP */
} }
size_t size_t SDL_strlen(const char *string)
SDL_strlen(const char *string)
{ {
#ifdef HAVE_STRLEN #ifdef HAVE_STRLEN
return strlen(string); return strlen(string);
@ -353,8 +346,7 @@ SDL_strlen(const char *string)
#endif /* HAVE_STRLEN */ #endif /* HAVE_STRLEN */
} }
size_t size_t SDL_wcslen(const wchar_t *string)
SDL_wcslen(const wchar_t *string)
{ {
#ifdef HAVE_WCSLEN #ifdef HAVE_WCSLEN
return wcslen(string); return wcslen(string);
@ -367,8 +359,7 @@ SDL_wcslen(const wchar_t *string)
#endif /* HAVE_WCSLEN */ #endif /* HAVE_WCSLEN */
} }
size_t size_t SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen)
SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen)
{ {
#ifdef HAVE_WCSLCPY #ifdef HAVE_WCSLCPY
return wcslcpy(dst, src, maxlen); return wcslcpy(dst, src, maxlen);
@ -383,8 +374,7 @@ SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxle
#endif /* HAVE_WCSLCPY */ #endif /* HAVE_WCSLCPY */
} }
size_t size_t SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen)
SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen)
{ {
#ifdef HAVE_WCSLCAT #ifdef HAVE_WCSLCAT
return wcslcat(dst, src, maxlen); return wcslcat(dst, src, maxlen);
@ -398,8 +388,7 @@ SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t max
#endif /* HAVE_WCSLCAT */ #endif /* HAVE_WCSLCAT */
} }
wchar_t * wchar_t *SDL_wcsdup(const wchar_t *string)
SDL_wcsdup(const wchar_t *string)
{ {
size_t len = ((SDL_wcslen(string) + 1) * sizeof(wchar_t)); size_t len = ((SDL_wcslen(string) + 1) * sizeof(wchar_t));
wchar_t *newstr = (wchar_t *)SDL_malloc(len); wchar_t *newstr = (wchar_t *)SDL_malloc(len);
@ -409,8 +398,7 @@ SDL_wcsdup(const wchar_t *string)
return newstr; return newstr;
} }
wchar_t * wchar_t *SDL_wcsstr(const wchar_t *haystack, const wchar_t *needle)
SDL_wcsstr(const wchar_t *haystack, const wchar_t *needle)
{ {
#ifdef HAVE_WCSSTR #ifdef HAVE_WCSSTR
return SDL_const_cast(wchar_t *, wcsstr(haystack, needle)); return SDL_const_cast(wchar_t *, wcsstr(haystack, needle));
@ -542,8 +530,7 @@ int SDL_wcsncasecmp(const wchar_t *str1, const wchar_t *str2, size_t maxlen)
#endif /* HAVE__WCSNICMP */ #endif /* HAVE__WCSNICMP */
} }
size_t size_t SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen)
SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen)
{ {
#ifdef HAVE_STRLCPY #ifdef HAVE_STRLCPY
return strlcpy(dst, src, maxlen); return strlcpy(dst, src, maxlen);
@ -558,8 +545,7 @@ SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen)
#endif /* HAVE_STRLCPY */ #endif /* HAVE_STRLCPY */
} }
size_t size_t SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_bytes)
SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_bytes)
{ {
size_t src_bytes = SDL_strlen(src); size_t src_bytes = SDL_strlen(src);
size_t bytes = SDL_min(src_bytes, dst_bytes - 1); size_t bytes = SDL_min(src_bytes, dst_bytes - 1);
@ -590,8 +576,7 @@ SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_
return bytes; return bytes;
} }
size_t size_t SDL_utf8strlen(const char *str)
SDL_utf8strlen(const char *str)
{ {
size_t retval = 0; size_t retval = 0;
const char *p = str; const char *p = str;
@ -607,8 +592,7 @@ SDL_utf8strlen(const char *str)
return retval; return retval;
} }
size_t size_t SDL_utf8strnlen(const char *str, size_t bytes)
SDL_utf8strnlen(const char *str, size_t bytes)
{ {
size_t retval = 0; size_t retval = 0;
const char *p = str; const char *p = str;
@ -624,8 +608,7 @@ SDL_utf8strnlen(const char *str, size_t bytes)
return retval; return retval;
} }
size_t size_t SDL_strlcat(SDL_INOUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen)
SDL_strlcat(SDL_INOUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen)
{ {
#ifdef HAVE_STRLCAT #ifdef HAVE_STRLCAT
return strlcat(dst, src, maxlen); return strlcat(dst, src, maxlen);
@ -639,8 +622,7 @@ SDL_strlcat(SDL_INOUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen)
#endif /* HAVE_STRLCAT */ #endif /* HAVE_STRLCAT */
} }
char * char *SDL_strdup(const char *string)
SDL_strdup(const char *string)
{ {
size_t len = SDL_strlen(string) + 1; size_t len = SDL_strlen(string) + 1;
char *newstr = (char *)SDL_malloc(len); char *newstr = (char *)SDL_malloc(len);
@ -650,8 +632,7 @@ SDL_strdup(const char *string)
return newstr; return newstr;
} }
char * char *SDL_strrev(char *string)
SDL_strrev(char *string)
{ {
#ifdef HAVE__STRREV #ifdef HAVE__STRREV
return _strrev(string); return _strrev(string);
@ -669,8 +650,7 @@ SDL_strrev(char *string)
#endif /* HAVE__STRREV */ #endif /* HAVE__STRREV */
} }
char * char *SDL_strupr(char *string)
SDL_strupr(char *string)
{ {
#ifdef HAVE__STRUPR #ifdef HAVE__STRUPR
return _strupr(string); return _strupr(string);
@ -684,8 +664,7 @@ SDL_strupr(char *string)
#endif /* HAVE__STRUPR */ #endif /* HAVE__STRUPR */
} }
char * char *SDL_strlwr(char *string)
SDL_strlwr(char *string)
{ {
#ifdef HAVE__STRLWR #ifdef HAVE__STRLWR
return _strlwr(string); return _strlwr(string);
@ -699,8 +678,7 @@ SDL_strlwr(char *string)
#endif /* HAVE__STRLWR */ #endif /* HAVE__STRLWR */
} }
char * char *SDL_strchr(const char *string, int c)
SDL_strchr(const char *string, int c)
{ {
#ifdef HAVE_STRCHR #ifdef HAVE_STRCHR
return SDL_const_cast(char *, strchr(string, c)); return SDL_const_cast(char *, strchr(string, c));
@ -720,8 +698,7 @@ SDL_strchr(const char *string, int c)
#endif /* HAVE_STRCHR */ #endif /* HAVE_STRCHR */
} }
char * char *SDL_strrchr(const char *string, int c)
SDL_strrchr(const char *string, int c)
{ {
#ifdef HAVE_STRRCHR #ifdef HAVE_STRRCHR
return SDL_const_cast(char *, strrchr(string, c)); return SDL_const_cast(char *, strrchr(string, c));
@ -739,8 +716,7 @@ SDL_strrchr(const char *string, int c)
#endif /* HAVE_STRRCHR */ #endif /* HAVE_STRRCHR */
} }
char * char *SDL_strstr(const char *haystack, const char *needle)
SDL_strstr(const char *haystack, const char *needle)
{ {
#ifdef HAVE_STRSTR #ifdef HAVE_STRSTR
return SDL_const_cast(char *, strstr(haystack, needle)); return SDL_const_cast(char *, strstr(haystack, needle));
@ -756,8 +732,7 @@ SDL_strstr(const char *haystack, const char *needle)
#endif /* HAVE_STRSTR */ #endif /* HAVE_STRSTR */
} }
char * char *SDL_strcasestr(const char *haystack, const char *needle)
SDL_strcasestr(const char *haystack, const char *needle)
{ {
#ifdef HAVE_STRCASESTR #ifdef HAVE_STRCASESTR
return SDL_const_cast(char *, strcasestr(haystack, needle)); return SDL_const_cast(char *, strcasestr(haystack, needle));
@ -783,8 +758,7 @@ static const char ntoa_table[] = {
}; };
#endif /* ntoa() conversion table */ #endif /* ntoa() conversion table */
char * char *SDL_itoa(int value, char *string, int radix)
SDL_itoa(int value, char *string, int radix)
{ {
#ifdef HAVE_ITOA #ifdef HAVE_ITOA
return itoa(value, string, radix); return itoa(value, string, radix);
@ -793,8 +767,7 @@ SDL_itoa(int value, char *string, int radix)
#endif /* HAVE_ITOA */ #endif /* HAVE_ITOA */
} }
char * char *SDL_uitoa(unsigned int value, char *string, int radix)
SDL_uitoa(unsigned int value, char *string, int radix)
{ {
#ifdef HAVE__UITOA #ifdef HAVE__UITOA
return _uitoa(value, string, radix); return _uitoa(value, string, radix);
@ -803,8 +776,7 @@ SDL_uitoa(unsigned int value, char *string, int radix)
#endif /* HAVE__UITOA */ #endif /* HAVE__UITOA */
} }
char * char *SDL_ltoa(long value, char *string, int radix)
SDL_ltoa(long value, char *string, int radix)
{ {
#ifdef HAVE__LTOA #ifdef HAVE__LTOA
return _ltoa(value, string, radix); return _ltoa(value, string, radix);
@ -822,8 +794,7 @@ SDL_ltoa(long value, char *string, int radix)
#endif /* HAVE__LTOA */ #endif /* HAVE__LTOA */
} }
char * char *SDL_ultoa(unsigned long value, char *string, int radix)
SDL_ultoa(unsigned long value, char *string, int radix)
{ {
#ifdef HAVE__ULTOA #ifdef HAVE__ULTOA
return _ultoa(value, string, radix); return _ultoa(value, string, radix);
@ -847,8 +818,7 @@ SDL_ultoa(unsigned long value, char *string, int radix)
#endif /* HAVE__ULTOA */ #endif /* HAVE__ULTOA */
} }
char * char *SDL_lltoa(Sint64 value, char *string, int radix)
SDL_lltoa(Sint64 value, char *string, int radix)
{ {
#ifdef HAVE__I64TOA #ifdef HAVE__I64TOA
return _i64toa(value, string, radix); return _i64toa(value, string, radix);
@ -866,8 +836,7 @@ SDL_lltoa(Sint64 value, char *string, int radix)
#endif /* HAVE__I64TOA */ #endif /* HAVE__I64TOA */
} }
char * char *SDL_ulltoa(Uint64 value, char *string, int radix)
SDL_ulltoa(Uint64 value, char *string, int radix)
{ {
#ifdef HAVE__UI64TOA #ifdef HAVE__UI64TOA
return _ui64toa(value, string, radix); return _ui64toa(value, string, radix);
@ -1477,8 +1446,7 @@ typedef struct
int precision; int precision;
} SDL_FormatInfo; } SDL_FormatInfo;
static size_t static size_t SDL_PrintString(char *text, size_t maxlen, SDL_FormatInfo *info, const char *string)
SDL_PrintString(char *text, size_t maxlen, SDL_FormatInfo *info, const char *string)
{ {
size_t length = 0; size_t length = 0;
size_t slen, sz; size_t slen, sz;
@ -1563,8 +1531,7 @@ static void SDL_IntPrecisionAdjust(char *num, size_t maxlen, SDL_FormatInfo *inf
} }
} }
static size_t static size_t SDL_PrintLong(char *text, size_t maxlen, SDL_FormatInfo *info, long value)
SDL_PrintLong(char *text, size_t maxlen, SDL_FormatInfo *info, long value)
{ {
char num[130], *p = num; char num[130], *p = num;
@ -1577,8 +1544,7 @@ SDL_PrintLong(char *text, size_t maxlen, SDL_FormatInfo *info, long value)
return SDL_PrintString(text, maxlen, info, num); return SDL_PrintString(text, maxlen, info, num);
} }
static size_t static size_t SDL_PrintUnsignedLong(char *text, size_t maxlen, SDL_FormatInfo *info, unsigned long value)
SDL_PrintUnsignedLong(char *text, size_t maxlen, SDL_FormatInfo *info, unsigned long value)
{ {
char num[130]; char num[130];
@ -1587,8 +1553,7 @@ SDL_PrintUnsignedLong(char *text, size_t maxlen, SDL_FormatInfo *info, unsigned
return SDL_PrintString(text, maxlen, info, num); return SDL_PrintString(text, maxlen, info, num);
} }
static size_t static size_t SDL_PrintLongLong(char *text, size_t maxlen, SDL_FormatInfo *info, Sint64 value)
SDL_PrintLongLong(char *text, size_t maxlen, SDL_FormatInfo *info, Sint64 value)
{ {
char num[130], *p = num; char num[130], *p = num;
@ -1601,8 +1566,7 @@ SDL_PrintLongLong(char *text, size_t maxlen, SDL_FormatInfo *info, Sint64 value)
return SDL_PrintString(text, maxlen, info, num); return SDL_PrintString(text, maxlen, info, num);
} }
static size_t static size_t SDL_PrintUnsignedLongLong(char *text, size_t maxlen, SDL_FormatInfo *info, Uint64 value)
SDL_PrintUnsignedLongLong(char *text, size_t maxlen, SDL_FormatInfo *info, Uint64 value)
{ {
char num[130]; char num[130];
@ -1611,8 +1575,7 @@ SDL_PrintUnsignedLongLong(char *text, size_t maxlen, SDL_FormatInfo *info, Uint6
return SDL_PrintString(text, maxlen, info, num); return SDL_PrintString(text, maxlen, info, num);
} }
static size_t static size_t SDL_PrintFloat(char *text, size_t maxlen, SDL_FormatInfo *info, double arg, SDL_bool g)
SDL_PrintFloat(char *text, size_t maxlen, SDL_FormatInfo *info, double arg, SDL_bool g)
{ {
char num[327]; char num[327];
size_t length = 0; size_t length = 0;

View file

@ -64,8 +64,7 @@ static void SDL_snprintfcat(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL
va_end(ap); va_end(ap);
} }
SDLTest_CommonState * SDLTest_CommonState *SDLTest_CommonCreateState(char **argv, Uint32 flags)
SDLTest_CommonCreateState(char **argv, Uint32 flags)
{ {
int i; int i;
SDLTest_CommonState *state; SDLTest_CommonState *state;
@ -124,8 +123,7 @@ SDLTest_CommonCreateState(char **argv, Uint32 flags)
return state; return state;
} }
void void SDLTest_CommonDestroyState(SDLTest_CommonState *state) {
SDLTest_CommonDestroyState(SDLTest_CommonState *state) {
SDLTest_LogAllocations(); SDLTest_LogAllocations();
SDL_free(state); SDL_free(state);
} }
@ -674,8 +672,7 @@ static char *common_usage_video = NULL;
static char *common_usage_audio = NULL; static char *common_usage_audio = NULL;
static char *common_usage_videoaudio = NULL; static char *common_usage_videoaudio = NULL;
SDL_bool SDL_bool SDLTest_CommonDefaultArgs(SDLTest_CommonState *state, const int argc, char **argv)
SDLTest_CommonDefaultArgs(SDLTest_CommonState *state, const int argc, char **argv)
{ {
int i = 1; int i = 1;
while (i < argc) { while (i < argc) {
@ -1115,8 +1112,7 @@ static SDL_HitTestResult SDLCALL SDLTest_ExampleHitTestCallback(SDL_Window *win,
return SDL_HITTEST_NORMAL; return SDL_HITTEST_NORMAL;
} }
SDL_bool SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state)
SDLTest_CommonInit(SDLTest_CommonState *state)
{ {
int i, j, m, n, w, h; int i, j, m, n, w, h;
const SDL_DisplayMode *fullscreen_mode; const SDL_DisplayMode *fullscreen_mode;

View file

@ -440,14 +440,12 @@ SDLTest_RandomDouble(void)
return r; return r;
} }
char * char *SDLTest_RandomAsciiString(void)
SDLTest_RandomAsciiString(void)
{ {
return SDLTest_RandomAsciiStringWithMaximumLength(255); return SDLTest_RandomAsciiStringWithMaximumLength(255);
} }
char * char *SDLTest_RandomAsciiStringWithMaximumLength(int maxLength)
SDLTest_RandomAsciiStringWithMaximumLength(int maxLength)
{ {
int size; int size;
@ -463,8 +461,7 @@ SDLTest_RandomAsciiStringWithMaximumLength(int maxLength)
return SDLTest_RandomAsciiStringOfSize(size); return SDLTest_RandomAsciiStringOfSize(size);
} }
char * char *SDLTest_RandomAsciiStringOfSize(int size)
SDLTest_RandomAsciiStringOfSize(int size)
{ {
char *string; char *string;
int counter; int counter;

View file

@ -60,8 +60,7 @@ static Uint32 SDLTest_TestCaseTimeout = 3600;
* *
* \returns The generated seed string * \returns The generated seed string
*/ */
char * char *SDLTest_GenerateRunSeed(const int length)
SDLTest_GenerateRunSeed(const int length)
{ {
char *seed = NULL; char *seed = NULL;
SDLTest_RandomContext randomContext; SDLTest_RandomContext randomContext;

View file

@ -35,8 +35,7 @@
/* work around compiler warning on older GCCs. */ /* work around compiler warning on older GCCs. */
#if (defined(__GNUC__) && (__GNUC__ <= 2)) #if (defined(__GNUC__) && (__GNUC__ <= 2))
static size_t static size_t strftime_gcc2_workaround(char *s, size_t max, const char *fmt, const struct tm *tm)
strftime_gcc2_workaround(char *s, size_t max, const char *fmt, const struct tm *tm)
{ {
return strftime(s, max, fmt, tm); return strftime(s, max, fmt, tm);
} }
@ -57,8 +56,7 @@ strftime_gcc2_workaround(char *s, size_t max, const char *fmt, const struct tm *
* *
* \return Ascii representation of the timestamp in localtime in the format '08/23/01 14:55:02' * \return Ascii representation of the timestamp in localtime in the format '08/23/01 14:55:02'
*/ */
static const char * static const char *SDLTest_TimestampToString(const time_t timestamp)
SDLTest_TimestampToString(const time_t timestamp)
{ {
time_t copy; time_t copy;
static char buffer[64]; static char buffer[64];

View file

@ -26,8 +26,7 @@
#include "SDL_systhread.h" #include "SDL_systhread.h"
#include "../SDL_error_c.h" #include "../SDL_error_c.h"
SDL_TLSID SDL_TLSID SDL_TLSCreate(void)
SDL_TLSCreate(void)
{ {
static SDL_AtomicInt SDL_tls_id; static SDL_AtomicInt SDL_tls_id;
return SDL_AtomicIncRef(&SDL_tls_id) + 1; return SDL_AtomicIncRef(&SDL_tls_id) + 1;
@ -112,8 +111,7 @@ typedef struct SDL_TLSEntry
static SDL_Mutex *SDL_generic_TLS_mutex; static SDL_Mutex *SDL_generic_TLS_mutex;
static SDL_TLSEntry *SDL_generic_TLS; static SDL_TLSEntry *SDL_generic_TLS;
SDL_TLSData * SDL_TLSData *SDL_Generic_GetTLSData(void)
SDL_Generic_GetTLSData(void)
{ {
SDL_threadID thread = SDL_ThreadID(); SDL_threadID thread = SDL_ThreadID();
SDL_TLSEntry *entry; SDL_TLSEntry *entry;
@ -215,8 +213,7 @@ static void SDLCALL SDL_FreeErrBuf(void *data)
#endif #endif
/* Routine to get the thread-specific error variable */ /* Routine to get the thread-specific error variable */
SDL_error * SDL_error *SDL_GetErrBuf(void)
SDL_GetErrBuf(void)
{ {
#ifdef SDL_THREADS_DISABLED #ifdef SDL_THREADS_DISABLED
return SDL_GetStaticErrBuf(); return SDL_GetStaticErrBuf();
@ -317,14 +314,12 @@ void SDL_RunThread(SDL_Thread *thread)
#endif #endif
#ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD #ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
SDL_Thread * SDL_Thread *SDL_CreateThreadWithStackSize(int(SDLCALL *fn)(void *),
SDL_CreateThreadWithStackSize(int(SDLCALL *fn)(void *),
const char *name, const size_t stacksize, void *data, const char *name, const size_t stacksize, void *data,
pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentBeginThread pfnBeginThread,
pfnSDL_CurrentEndThread pfnEndThread) pfnSDL_CurrentEndThread pfnEndThread)
#else #else
SDL_Thread * SDL_Thread *SDL_CreateThreadWithStackSize(int(SDLCALL *fn)(void *),
SDL_CreateThreadWithStackSize(int(SDLCALL *fn)(void *),
const char *name, const size_t stacksize, void *data) const char *name, const size_t stacksize, void *data)
#endif #endif
{ {
@ -372,14 +367,12 @@ SDL_CreateThreadWithStackSize(int(SDLCALL *fn)(void *),
} }
#ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD #ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
DECLSPEC SDL_Thread *SDLCALL DECLSPEC SDL_Thread *SDLCALL SDL_CreateThread(int(SDLCALL *fn)(void *),
SDL_CreateThread(int(SDLCALL *fn)(void *),
const char *name, void *data, const char *name, void *data,
pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentBeginThread pfnBeginThread,
pfnSDL_CurrentEndThread pfnEndThread) pfnSDL_CurrentEndThread pfnEndThread)
#else #else
DECLSPEC SDL_Thread *SDLCALL DECLSPEC SDL_Thread *SDLCALL SDL_CreateThread(int(SDLCALL *fn)(void *),
SDL_CreateThread(int(SDLCALL *fn)(void *),
const char *name, void *data) const char *name, void *data)
#endif #endif
{ {
@ -405,8 +398,7 @@ SDL_CreateThread(int(SDLCALL *fn)(void *),
#endif #endif
} }
SDL_Thread * SDL_Thread *SDL_CreateThreadInternal(int(SDLCALL *fn)(void *), const char *name,
SDL_CreateThreadInternal(int(SDLCALL *fn)(void *), const char *name,
const size_t stacksize, void *data) const size_t stacksize, void *data)
{ {
#ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD #ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
@ -416,8 +408,7 @@ SDL_CreateThreadInternal(int(SDLCALL *fn)(void *), const char *name,
#endif #endif
} }
SDL_threadID SDL_threadID SDL_GetThreadID(SDL_Thread *thread)
SDL_GetThreadID(SDL_Thread *thread)
{ {
SDL_threadID id; SDL_threadID id;
@ -429,8 +420,7 @@ SDL_GetThreadID(SDL_Thread *thread)
return id; return id;
} }
const char * const char *SDL_GetThreadName(SDL_Thread *thread)
SDL_GetThreadName(SDL_Thread *thread)
{ {
if (thread) { if (thread) {
return thread->name; return thread->name;

View file

@ -50,8 +50,7 @@ typedef struct SDL_cond_generic
} SDL_cond_generic; } SDL_cond_generic;
/* Create a condition variable */ /* Create a condition variable */
SDL_Condition * SDL_Condition *SDL_CreateCondition_generic(void)
SDL_CreateCondition_generic(void)
{ {
SDL_cond_generic *cond; SDL_cond_generic *cond;

View file

@ -32,8 +32,7 @@ struct SDL_Mutex
}; };
/* Create a mutex */ /* Create a mutex */
SDL_Mutex * SDL_Mutex *SDL_CreateMutex(void)
SDL_CreateMutex(void)
{ {
SDL_Mutex *mutex; SDL_Mutex *mutex;

View file

@ -26,8 +26,7 @@
#ifdef SDL_THREADS_DISABLED #ifdef SDL_THREADS_DISABLED
SDL_Semaphore * SDL_Semaphore *SDL_CreateSemaphore(Uint32 initial_value)
SDL_CreateSemaphore(Uint32 initial_value)
{ {
SDL_SetError("SDL not built with thread support"); SDL_SetError("SDL not built with thread support");
return (SDL_Semaphore *)0; return (SDL_Semaphore *)0;
@ -62,8 +61,7 @@ struct SDL_Semaphore
SDL_Condition *count_nonzero; SDL_Condition *count_nonzero;
}; };
SDL_Semaphore * SDL_Semaphore *SDL_CreateSemaphore(Uint32 initial_value)
SDL_CreateSemaphore(Uint32 initial_value)
{ {
SDL_Semaphore *sem; SDL_Semaphore *sem;

View file

@ -40,8 +40,7 @@ void SDL_SYS_SetupThread(const char *name)
return; return;
} }
SDL_threadID SDL_threadID SDL_ThreadID(void)
SDL_ThreadID(void)
{ {
return 0; return 0;
} }

View file

@ -22,8 +22,7 @@
#include "SDL_internal.h" #include "SDL_internal.h"
#include "../SDL_thread_c.h" #include "../SDL_thread_c.h"
SDL_TLSData * SDL_TLSData *SDL_SYS_GetTLSData(void)
SDL_SYS_GetTLSData(void)
{ {
return SDL_Generic_GetTLSData(); return SDL_Generic_GetTLSData();
} }

View file

@ -32,8 +32,7 @@ struct SDL_Condition
}; };
/* Create a condition variable */ /* Create a condition variable */
SDL_Condition * SDL_Condition *SDL_CreateCondition(void)
SDL_CreateCondition(void)
{ {
SDL_Condition *cond = (SDL_Condition *)SDL_malloc(sizeof(SDL_Condition)); SDL_Condition *cond = (SDL_Condition *)SDL_malloc(sizeof(SDL_Condition));
if (cond) { if (cond) {

Some files were not shown because too many files have changed in this diff Show more