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
+4 -9
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:
+1 -3
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;
+5 -10
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;
} }
+2 -4
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();
+6 -13
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);
+1 -2
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;
+2 -4
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;
+1 -2
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 */
+5 -10
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;
+1 -2
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,
+1 -2
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;
+1 -1
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) &&
+11 -22
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);
+1 -2
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;
+3 -6
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;
+8 -16
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";
+2 -4
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;
} }
+3 -6
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;
+2 -4
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();
+2 -4
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);
+4 -8
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;
} }
+2 -4
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");
+1 -2
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;
+3 -6
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
+15 -30
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 */
+11 -22
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;
+1 -2
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;
+9 -19
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();
+5 -10
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) {
+11 -22
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;
+9 -14
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;
+2 -4
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) {
+2 -4
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;
@@ -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;
+2 -4
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");
+6 -10
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);
+2 -4
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;
+2 -4
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;
+2 -4
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;
+4 -8
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;
+2 -4
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;
+3 -6
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;
+5 -10
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 */
+1 -2
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) {
+1 -2
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);
+1 -2
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;
+1 -2
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;
+1 -2
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;
+7 -14
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;
+1 -2
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(

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