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 */
const char *
SDL_GetRevision(void)
const char *SDL_GetRevision(void)
{
return SDL_REVISION;
}
/* Get the name of the platform */
const char *
SDL_GetPlatform(void)
const char *SDL_GetPlatform(void)
{
#ifdef __AIX__
return "AIX";
@@ -616,8 +614,7 @@ SDL_GetPlatform(void)
#endif
}
SDL_bool
SDL_IsTablet(void)
SDL_bool SDL_IsTablet(void)
{
#ifdef __ANDROID__
extern SDL_bool SDL_IsAndroidTablet(void);
@@ -635,9 +632,7 @@ SDL_IsTablet(void)
#if (!defined(HAVE_LIBC) || defined(__WATCOMC__)) && !defined(SDL_STATIC_LIB)
/* Need to include DllMain() on Watcom C for some reason.. */
BOOL APIENTRY
_DllMainCRTStartup(HANDLE hModule,
DWORD ul_reason_for_call, LPVOID lpReserved)
BOOL APIENTRY _DllMainCRTStartup(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch (ul_reason_for_call) {
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;
}
SDL_AssertState
SDL_ReportAssertion(SDL_AssertData *data, const char *func, const char *file,
int line)
SDL_AssertState SDL_ReportAssertion(SDL_AssertData *data, const char *func, const char *file, int line)
{
SDL_AssertState state = SDL_ASSERTION_IGNORE;
static int assertion_running = 0;
+5 -10
View File
@@ -49,8 +49,7 @@ static void SDL_FreeDataQueueList(SDL_DataQueuePacket *packet)
}
}
SDL_DataQueue *
SDL_CreateDataQueue(const size_t _packetlen, const size_t initialslack)
SDL_DataQueue *SDL_CreateDataQueue(const size_t _packetlen, const size_t initialslack)
{
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;
}
size_t
SDL_PeekIntoDataQueue(SDL_DataQueue *queue, void *_buf, const size_t _len)
size_t SDL_PeekIntoDataQueue(SDL_DataQueue *queue, void *_buf, const size_t _len)
{
size_t len = _len;
Uint8 *buf = (Uint8 *)_buf;
@@ -259,8 +257,7 @@ SDL_PeekIntoDataQueue(SDL_DataQueue *queue, void *_buf, const size_t _len)
return (size_t)(ptr - buf);
}
size_t
SDL_ReadFromDataQueue(SDL_DataQueue *queue, void *_buf, const size_t _len)
size_t SDL_ReadFromDataQueue(SDL_DataQueue *queue, void *_buf, const size_t _len)
{
size_t len = _len;
Uint8 *buf = (Uint8 *)_buf;
@@ -303,8 +300,7 @@ SDL_ReadFromDataQueue(SDL_DataQueue *queue, void *_buf, const size_t _len)
return (size_t)(ptr - buf);
}
size_t
SDL_GetDataQueueSize(SDL_DataQueue *queue)
size_t SDL_GetDataQueueSize(SDL_DataQueue *queue)
{
size_t retval = 0;
if (queue) {
@@ -315,8 +311,7 @@ SDL_GetDataQueueSize(SDL_DataQueue *queue)
return retval;
}
SDL_Mutex *
SDL_GetDataQueueMutex(SDL_DataQueue *queue)
SDL_Mutex *SDL_GetDataQueueMutex(SDL_DataQueue *queue)
{
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 */
const char *
SDL_GetError(void)
const char *SDL_GetError(void)
{
const SDL_error *error = SDL_GetErrBuf();
return error->error ? error->str : "";
@@ -91,8 +90,7 @@ int SDL_Error(SDL_errorcode code)
}
}
char *
SDL_GetErrorMsg(char *errstr, int maxlen)
char *SDL_GetErrorMsg(char *errstr, int maxlen)
{
const SDL_error *error = SDL_GetErrBuf();
+6 -13
View File
@@ -43,9 +43,7 @@ typedef struct SDL_Hint
static SDL_Hint *SDL_hints;
SDL_bool
SDL_SetHintWithPriority(const char *name, const char *value,
SDL_HintPriority priority)
SDL_bool SDL_SetHintWithPriority(const char *name, const char *value, SDL_HintPriority priority)
{
const char *env;
SDL_Hint *hint;
@@ -95,8 +93,7 @@ SDL_SetHintWithPriority(const char *name, const char *value,
return SDL_TRUE;
}
SDL_bool
SDL_ResetHint(const char *name)
SDL_bool SDL_ResetHint(const char *name)
{
const char *env;
SDL_Hint *hint;
@@ -152,14 +149,12 @@ void SDL_ResetHints(void)
}
}
SDL_bool
SDL_SetHint(const char *name, const char *value)
SDL_bool SDL_SetHint(const char *name, const char *value)
{
return SDL_SetHintWithPriority(name, value, SDL_HINT_NORMAL);
}
const char *
SDL_GetHint(const char *name)
const char *SDL_GetHint(const char *name)
{
const char *env;
SDL_Hint *hint;
@@ -176,8 +171,7 @@ SDL_GetHint(const char *name)
return env;
}
SDL_bool
SDL_GetStringBoolean(const char *value, SDL_bool default_value)
SDL_bool SDL_GetStringBoolean(const char *value, SDL_bool default_value)
{
if (value == NULL || !*value) {
return default_value;
@@ -188,8 +182,7 @@ SDL_GetStringBoolean(const char *value, SDL_bool default_value)
return SDL_TRUE;
}
SDL_bool
SDL_GetHintBoolean(const char *name, SDL_bool default_value)
SDL_bool SDL_GetHintBoolean(const char *name, SDL_bool default_value)
{
const char *hint = SDL_GetHint(name);
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_LogGetPriority(int category)
SDL_LogPriority SDL_LogGetPriority(int category)
{
SDL_LogLevel *entry;
+2 -4
View File
@@ -122,8 +122,7 @@ static SDL_INLINE void leaveLock(void *a)
}
#endif
SDL_bool
SDL_AtomicCAS(SDL_AtomicInt *a, int oldval, int newval)
SDL_bool SDL_AtomicCAS(SDL_AtomicInt *a, int oldval, int newval)
{
#ifdef HAVE_MSC_ATOMICS
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
}
SDL_bool
SDL_AtomicCASPtr(void **a, void *oldval, void *newval)
SDL_bool SDL_AtomicCASPtr(void **a, void *oldval, void *newval)
{
#ifdef HAVE_MSC_ATOMICS
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 */
/* This function is where all the magic happens... */
SDL_bool
SDL_AtomicTryLock(SDL_SpinLock *lock)
SDL_bool SDL_AtomicTryLock(SDL_SpinLock *lock)
{
#ifdef SDL_ATOMIC_DISABLED
/* Terrible terrible damage */
+5 -10
View File
@@ -789,8 +789,7 @@ int SDL_GetNumAudioDrivers(void)
return SDL_arraysize(bootstrap) - 1;
}
const char *
SDL_GetAudioDriver(int index)
const char *SDL_GetAudioDriver(int index)
{
if (index >= 0 && index < SDL_GetNumAudioDrivers()) {
return bootstrap[index]->name;
@@ -893,8 +892,7 @@ int SDL_InitAudio(const char *driver_name)
/*
* Get the current audio driver name
*/
const char *
SDL_GetCurrentAudioDriver(void)
const char *SDL_GetCurrentAudioDriver(void)
{
return current_audio.name;
}
@@ -954,8 +952,7 @@ int SDL_GetNumAudioDevices(int iscapture)
return retval;
}
const char *
SDL_GetAudioDeviceName(int index, int iscapture)
const char *SDL_GetAudioDeviceName(int index, int iscapture)
{
SDL_AudioDeviceItem *item;
int i;
@@ -1412,8 +1409,7 @@ static SDL_AudioDeviceID open_audio_device(const char *devname, int iscapture,
return device->id;
}
SDL_AudioDeviceID
SDL_OpenAudioDevice(const char *device, int iscapture,
SDL_AudioDeviceID SDL_OpenAudioDevice(const char *device, int iscapture,
const SDL_AudioSpec *desired, SDL_AudioSpec *obtained,
int allowed_changes)
{
@@ -1421,8 +1417,7 @@ SDL_OpenAudioDevice(const char *device, int iscapture,
allowed_changes, 2);
}
SDL_AudioStatus
SDL_GetAudioDeviceStatus(SDL_AudioDeviceID devid)
SDL_AudioStatus SDL_GetAudioDeviceStatus(SDL_AudioDeviceID devid)
{
SDL_AudioDevice *device = get_audio_device(devid);
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;
}
SDL_AudioStream *
SDL_CreateAudioStream(SDL_AudioFormat src_format,
SDL_AudioStream *SDL_CreateAudioStream(SDL_AudioFormat src_format,
int src_channels,
int src_rate,
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;
}
SDL_AudioSpec *
SDL_LoadWAV_RW(SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len)
SDL_AudioSpec *SDL_LoadWAV_RW(SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len)
{
int result;
WaveFile file;
+1 -1
View File
@@ -202,7 +202,7 @@ static int load_pipewire_syms(void)
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) &&
(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];
uint32_t qsa_capture_devices;
static SDL_INLINE int
QSA_SetError(const char *fn, int status)
static int QSA_SetError(const char *fn, int 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? */
static void
QSA_ThreadInit(SDL_AudioDevice *_this)
static void QSA_ThreadInit(SDL_AudioDevice *_this)
{
/* Increase default 10 priority to 25 to avoid jerky sound */
struct sched_param param;
@@ -92,8 +90,7 @@ QSA_ThreadInit(SDL_AudioDevice *_this)
}
/* PCM channel parameters initialize function */
static void
QSA_InitAudioParams(snd_pcm_channel_params_t * cpars)
static void QSA_InitAudioParams(snd_pcm_channel_params_t * cpars)
{
SDL_zerop(cpars);
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 */
static void
QSA_WaitDevice(SDL_AudioDevice *_this)
static void QSA_WaitDevice(SDL_AudioDevice *_this)
{
int result;
@@ -136,8 +132,7 @@ QSA_WaitDevice(SDL_AudioDevice *_this)
}
}
static void
QSA_PlayDevice(SDL_AudioDevice *_this)
static void QSA_PlayDevice(SDL_AudioDevice *_this)
{
snd_pcm_channel_status_t cstatus;
int written;
@@ -229,14 +224,12 @@ QSA_PlayDevice(SDL_AudioDevice *_this)
}
}
static Uint8 *
QSA_GetDeviceBuf(SDL_AudioDevice *_this)
static Uint8 *QSA_GetDeviceBuf(SDL_AudioDevice *_this)
{
return _this->hidden->pcm_buf;
}
static void
QSA_CloseDevice(SDL_AudioDevice *_this)
static void QSA_CloseDevice(SDL_AudioDevice *_this)
{
if (_this->hidden->audio_handle != NULL) {
#if _NTO_VERSION < 710
@@ -257,8 +250,7 @@ QSA_CloseDevice(SDL_AudioDevice *_this)
SDL_free(_this->hidden);
}
static int
QSA_OpenDevice(SDL_AudioDevice *_this, const char *devname)
static int QSA_OpenDevice(SDL_AudioDevice *_this, const char *devname)
{
#if 0
/* !!! 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;
}
static void
QSA_DetectDevices(void)
static void QSA_DetectDevices(void)
{
uint32_t it;
uint32_t cards;
@@ -572,8 +563,7 @@ QSA_DetectDevices(void)
}
}
static void
QSA_Deinitialize(void)
static void QSA_Deinitialize(void)
{
/* Clear devices array on shutdown */
/* !!! FIXME: we zero these on init...any reason to do it here? */
@@ -583,8 +573,7 @@ QSA_Deinitialize(void)
qsa_capture_devices = 0;
}
static SDL_bool
QSA_Init(SDL_AudioDriverImpl * impl)
static SDL_bool QSA_Init(SDL_AudioDriverImpl * impl)
{
/* Clear devices array */
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_kbd_init(void)
SDL_EVDEV_keyboard_state *SDL_EVDEV_kbd_init(void)
{
SDL_EVDEV_keyboard_state *kbd;
struct mouse_info mData;
+3 -6
View File
@@ -104,8 +104,7 @@ static int StartBeApp(void *unused)
}
static int
StartBeLooper()
static int StartBeLooper()
{
if (!be_app) {
SDL_AppThread = SDL_CreateThreadInternal(StartBeApp, "SDLApplication", 0, NULL);
@@ -140,8 +139,7 @@ StartBeLooper()
/* Initialize the Be Application, if it's not already started */
int
SDL_InitBeApp(void)
int SDL_InitBeApp(void)
{
/* Create the BApplication that handles appserver interaction */
if (SDL_BeAppActive <= 0) {
@@ -159,8 +157,7 @@ SDL_InitBeApp(void)
}
/* Quit the Be Application, if there's nothing left to do */
void
SDL_QuitBeApp(void)
void SDL_QuitBeApp(void)
{
/* Decrement the application reference count */
--SDL_BeAppActive;
+8 -16
View File
@@ -190,8 +190,7 @@ void SDL_DBus_Quit(void)
inhibit_handle = NULL;
}
SDL_DBusContext *
SDL_DBus_GetContext(void)
SDL_DBusContext *SDL_DBus_GetContext(void)
{
if (dbus_handle == NULL || !dbus.session_conn) {
SDL_DBus_Init();
@@ -243,8 +242,7 @@ static SDL_bool SDL_DBus_CallMethodInternal(DBusConnection *conn, const char *no
return retval;
}
SDL_bool
SDL_DBus_CallMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...)
SDL_bool SDL_DBus_CallMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...)
{
SDL_bool retval;
va_list ap;
@@ -254,8 +252,7 @@ SDL_DBus_CallMethodOnConnection(DBusConnection *conn, const char *node, const ch
return retval;
}
SDL_bool
SDL_DBus_CallMethod(const char *node, const char *path, const char *interface, const char *method, ...)
SDL_bool SDL_DBus_CallMethod(const char *node, const char *path, const char *interface, const char *method, ...)
{
SDL_bool retval;
va_list ap;
@@ -312,8 +309,7 @@ static SDL_bool SDL_DBus_CallWithBasicReply(DBusConnection *conn, DBusMessage *m
return retval;
}
SDL_bool
SDL_DBus_CallVoidMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...)
SDL_bool SDL_DBus_CallVoidMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...)
{
SDL_bool retval;
va_list ap;
@@ -323,8 +319,7 @@ SDL_DBus_CallVoidMethodOnConnection(DBusConnection *conn, const char *node, cons
return retval;
}
SDL_bool
SDL_DBus_CallVoidMethod(const char *node, const char *path, const char *interface, const char *method, ...)
SDL_bool SDL_DBus_CallVoidMethod(const char *node, const char *path, const char *interface, const char *method, ...)
{
SDL_bool retval;
va_list ap;
@@ -334,8 +329,7 @@ SDL_DBus_CallVoidMethod(const char *node, const char *path, const char *interfac
return retval;
}
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_bool 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;
@@ -352,8 +346,7 @@ SDL_DBus_QueryPropertyOnConnection(DBusConnection *conn, const char *node, const
return retval;
}
SDL_bool
SDL_DBus_QueryProperty(const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result)
SDL_bool 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);
}
@@ -404,8 +397,7 @@ failed:
return SDL_FALSE;
}
SDL_bool
SDL_DBus_ScreensaverInhibit(SDL_bool inhibit)
SDL_bool SDL_DBus_ScreensaverInhibit(SDL_bool inhibit)
{
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_kbd_init(void)
SDL_EVDEV_keyboard_state *SDL_EVDEV_kbd_init(void)
{
SDL_EVDEV_keyboard_state *kbd;
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 */
SDL_EVDEV_keyboard_state *
SDL_EVDEV_kbd_init(void)
SDL_EVDEV_keyboard_state *SDL_EVDEV_kbd_init(void)
{
return NULL;
}
+3 -6
View File
@@ -81,8 +81,7 @@ static char *GetAppName(void)
return SDL_strdup("SDL_App");
}
static size_t
Fcitx_GetPreeditString(SDL_DBusContext *dbus,
static size_t Fcitx_GetPreeditString(SDL_DBusContext *dbus,
DBusMessage *msg,
char **ret,
Sint32 *start_pos,
@@ -367,8 +366,7 @@ static Uint32 Fcitx_ModState(void)
return fcitx_mods;
}
SDL_bool
SDL_Fcitx_Init(void)
SDL_bool SDL_Fcitx_Init(void)
{
fcitx_client.dbus = SDL_DBus_GetContext();
@@ -404,8 +402,7 @@ void SDL_Fcitx_Reset(void)
FcitxClientICCallMethod(&fcitx_client, "CloseIC");
}
SDL_bool
SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
SDL_bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
{
Uint32 mod_state = Fcitx_ModState();
Uint32 handled = SDL_FALSE;
+2 -4
View File
@@ -556,8 +556,7 @@ static SDL_bool IBus_CheckConnection(SDL_DBusContext *dbus)
return SDL_FALSE;
}
SDL_bool
SDL_IBus_Init(void)
SDL_bool SDL_IBus_Init(void)
{
SDL_bool result = SDL_FALSE;
SDL_DBusContext *dbus = SDL_DBus_GetContext();
@@ -672,8 +671,7 @@ void SDL_IBus_Reset(void)
IBus_SimpleMessage("Reset");
}
SDL_bool
SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
SDL_bool SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
{
Uint32 result = 0;
SDL_DBusContext *dbus = SDL_DBus_GetContext();
+2 -4
View File
@@ -83,8 +83,7 @@ static void InitIME(void)
#endif /* HAVE_IBUS_IBUS_H */
}
SDL_bool
SDL_IME_Init(void)
SDL_bool SDL_IME_Init(void)
{
InitIME();
@@ -127,8 +126,7 @@ void SDL_IME_Reset(void)
}
}
SDL_bool
SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
SDL_bool SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
{
if (SDL_IME_ProcessKeyEvent_Real) {
return SDL_IME_ProcessKeyEvent_Real(keysym, keycode, state);
+5 -9
View File
@@ -44,8 +44,7 @@ typedef struct SystemThemeData
static SystemThemeData system_theme_data;
static SDL_bool
DBus_ExtractThemeVariant(DBusMessageIter *iter, SDL_SystemTheme *theme) {
static SDL_bool DBus_ExtractThemeVariant(DBusMessageIter *iter, SDL_SystemTheme *theme) {
SDL_DBusContext *dbus = system_theme_data.dbus;
Uint32 color_scheme;
DBusMessageIter variant_iter;
@@ -70,8 +69,7 @@ DBus_ExtractThemeVariant(DBusMessageIter *iter, SDL_SystemTheme *theme) {
return SDL_TRUE;
}
static DBusHandlerResult
DBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *data) {
static DBusHandlerResult DBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *data) {
SDL_DBusContext *dbus = (SDL_DBusContext *)data;
if (dbus->message_is_signal(msg, SIGNAL_INTERFACE, SIGNAL_NAME)) {
@@ -108,14 +106,13 @@ not_our_signal:
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
SDL_bool
SDL_SystemTheme_Init(void)
SDL_bool SDL_SystemTheme_Init(void)
{
SDL_DBusContext *dbus = SDL_DBus_GetContext();
DBusMessage *msg;
static const char *namespace = SIGNAL_NAMESPACE;
static const char *key = SIGNAL_KEY;
system_theme_data.theme = SDL_SYSTEM_THEME_UNKNOWN;
system_theme_data.dbus = dbus;
if (dbus == NULL) {
@@ -153,8 +150,7 @@ incorrect_type:
return SDL_TRUE;
}
SDL_SystemTheme
SDL_SystemTheme_Get(void)
SDL_SystemTheme SDL_SystemTheme_Get(void)
{
return system_theme_data.theme;
}
+2 -4
View File
@@ -215,8 +215,7 @@ int SDL_UDEV_Scan(void)
return 0;
}
SDL_bool
SDL_UDEV_GetProductInfo(const char *device_path, Uint16 *vendor, Uint16 *product, Uint16 *version)
SDL_bool SDL_UDEV_GetProductInfo(const char *device_path, Uint16 *vendor, Uint16 *product, Uint16 *version)
{
struct udev_enumerate *enumerate = NULL;
struct udev_list_entry *devs = NULL;
@@ -543,8 +542,7 @@ void SDL_UDEV_DelCallback(SDL_UDEV_Callback cb)
}
}
const SDL_UDEV_Symbols *
SDL_UDEV_GetUdevSyms(void)
const SDL_UDEV_Symbols *SDL_UDEV_GetUdevSyms(void)
{
if (SDL_UDEV_Init() < 0) {
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;
}
SDL_AudioFormat
WaveFormatToSDLFormat(WAVEFORMATEX *waveformat)
SDL_AudioFormat WaveFormatToSDLFormat(WAVEFORMATEX *waveformat)
{
if ((waveformat->wFormatTag == WAVE_FORMAT_IEEE_FLOAT) && (waveformat->wBitsPerSample == 32)) {
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.
*/
char *
WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid)
char *WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid)
{
#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. */
@@ -343,15 +342,13 @@ BOOL WIN_IsRectEmpty(const RECT *rect)
#include <shellapi.h> /* CommandLineToArgvW() */
/* Pop up an out of memory message, returns to Windows */
static int
OutOfMemory(void)
static int OutOfMemory(void)
{
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal Error", "Out of memory - aborting", NULL);
return -1;
}
DECLSPEC int
SDL_RunApp(int _argc, char* _argv[], SDL_main_func mainFunction, void * reserved)
DECLSPEC int SDL_RunApp(int _argc, char* _argv[], SDL_main_func mainFunction, void * reserved)
{
/* 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)
SDL_bool
SDL_HasAltiVec(void)
SDL_bool SDL_HasAltiVec(void)
{
return CPU_FEATURE_AVAILABLE(CPU_HAS_ALTIVEC);
}
SDL_bool
SDL_HasMMX(void)
SDL_bool SDL_HasMMX(void)
{
return CPU_FEATURE_AVAILABLE(CPU_HAS_MMX);
}
SDL_bool
SDL_HasSSE(void)
SDL_bool SDL_HasSSE(void)
{
return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE);
}
SDL_bool
SDL_HasSSE2(void)
SDL_bool SDL_HasSSE2(void)
{
return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE2);
}
SDL_bool
SDL_HasSSE3(void)
SDL_bool SDL_HasSSE3(void)
{
return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE3);
}
SDL_bool
SDL_HasSSE41(void)
SDL_bool SDL_HasSSE41(void)
{
return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE41);
}
SDL_bool
SDL_HasSSE42(void)
SDL_bool SDL_HasSSE42(void)
{
return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE42);
}
SDL_bool
SDL_HasAVX(void)
SDL_bool SDL_HasAVX(void)
{
return CPU_FEATURE_AVAILABLE(CPU_HAS_AVX);
}
SDL_bool
SDL_HasAVX2(void)
SDL_bool SDL_HasAVX2(void)
{
return CPU_FEATURE_AVAILABLE(CPU_HAS_AVX2);
}
SDL_bool
SDL_HasAVX512F(void)
SDL_bool SDL_HasAVX512F(void)
{
return CPU_FEATURE_AVAILABLE(CPU_HAS_AVX512F);
}
SDL_bool
SDL_HasARMSIMD(void)
SDL_bool SDL_HasARMSIMD(void)
{
return CPU_FEATURE_AVAILABLE(CPU_HAS_ARM_SIMD);
}
SDL_bool
SDL_HasNEON(void)
SDL_bool SDL_HasNEON(void)
{
return CPU_FEATURE_AVAILABLE(CPU_HAS_NEON);
}
SDL_bool
SDL_HasLSX(void)
SDL_bool SDL_HasLSX(void)
{
return CPU_FEATURE_AVAILABLE(CPU_HAS_LSX);
}
SDL_bool
SDL_HasLASX(void)
SDL_bool SDL_HasLASX(void)
{
return CPU_FEATURE_AVAILABLE(CPU_HAS_LASX);
}
@@ -1089,8 +1075,7 @@ int SDL_GetSystemRAM(void)
return SDL_SystemRAM;
}
size_t
SDL_SIMDGetAlignment(void)
size_t SDL_SIMDGetAlignment(void)
{
if (SDL_SIMDAlignment == 0xFFFFFFFF) {
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() */
char *
SDL_UCS4ToUTF8(Uint32 ch, char *dst)
char *SDL_UCS4ToUTF8(Uint32 ch, char *dst)
{
Uint8 *p = (Uint8 *)dst;
if (ch <= 0x7F) {
@@ -759,8 +758,7 @@ void SDL_SetScancodeName(SDL_Scancode scancode, const char *name)
SDL_scancode_names[scancode] = name;
}
SDL_Window *
SDL_GetKeyboardFocus(void)
SDL_Window *SDL_GetKeyboardFocus(void)
{
SDL_Keyboard *keyboard = &SDL_keyboard;
@@ -1029,8 +1027,7 @@ void SDL_ReleaseAutoReleaseKeys(void)
}
}
SDL_bool
SDL_HardwareKeyboardKeyPressed(void)
SDL_bool SDL_HardwareKeyboardKeyPressed(void)
{
SDL_Keyboard *keyboard = &SDL_keyboard;
SDL_Scancode scancode;
@@ -1110,8 +1107,7 @@ void SDL_QuitKeyboard(void)
{
}
const Uint8 *
SDL_GetKeyboardState(int *numkeys)
const Uint8 *SDL_GetKeyboardState(int *numkeys)
{
SDL_Keyboard *keyboard = &SDL_keyboard;
@@ -1121,8 +1117,7 @@ SDL_GetKeyboardState(int *numkeys)
return keyboard->keystate;
}
SDL_Keymod
SDL_GetModState(void)
SDL_Keymod SDL_GetModState(void)
{
SDL_Keyboard *keyboard = &SDL_keyboard;
@@ -1147,8 +1142,7 @@ void SDL_ToggleModState(const SDL_Keymod modstate, const SDL_bool toggle)
}
}
SDL_Keycode
SDL_GetKeyFromScancode(SDL_Scancode scancode)
SDL_Keycode SDL_GetKeyFromScancode(SDL_Scancode scancode)
{
SDL_Keyboard *keyboard = &SDL_keyboard;
@@ -1160,8 +1154,7 @@ SDL_GetKeyFromScancode(SDL_Scancode scancode)
return keyboard->keymap[scancode];
}
SDL_Keycode
SDL_GetDefaultKeyFromScancode(SDL_Scancode scancode)
SDL_Keycode SDL_GetDefaultKeyFromScancode(SDL_Scancode scancode)
{
if (((int)scancode) < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) {
SDL_InvalidParamError("scancode");
@@ -1171,8 +1164,7 @@ SDL_GetDefaultKeyFromScancode(SDL_Scancode scancode)
return SDL_default_keymap[scancode];
}
SDL_Scancode
SDL_GetScancodeFromKey(SDL_Keycode key)
SDL_Scancode SDL_GetScancodeFromKey(SDL_Keycode key)
{
SDL_Keyboard *keyboard = &SDL_keyboard;
SDL_Scancode scancode;
@@ -1186,8 +1178,7 @@ SDL_GetScancodeFromKey(SDL_Keycode key)
return SDL_SCANCODE_UNKNOWN;
}
const char *
SDL_GetScancodeName(SDL_Scancode scancode)
const char *SDL_GetScancodeName(SDL_Scancode scancode)
{
const char *name;
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;
}
const char *
SDL_GetKeyName(SDL_Keycode key)
const char *SDL_GetKeyName(SDL_Keycode key)
{
static char name[8];
char *end;
@@ -1263,8 +1253,7 @@ SDL_GetKeyName(SDL_Keycode key)
}
}
SDL_Keycode
SDL_GetKeyFromName(const char *name)
SDL_Keycode SDL_GetKeyFromName(const char *name)
{
SDL_Keycode key;
+1 -2
View File
@@ -387,8 +387,7 @@ static const struct {
};
/* *INDENT-ON* */ /* clang-format on */
SDL_Scancode
SDL_GetScancodeFromKeySym(Uint32 keysym, Uint32 keycode)
SDL_Scancode SDL_GetScancodeFromKeySym(Uint32 keysym, Uint32 keycode)
{
int i;
Uint32 linux_keycode = 0;
+9 -19
View File
@@ -217,8 +217,7 @@ void SDL_SetDefaultCursor(SDL_Cursor *cursor)
}
}
SDL_Mouse *
SDL_GetMouse(void)
SDL_Mouse *SDL_GetMouse(void)
{
return &SDL_mouse;
}
@@ -236,8 +235,7 @@ static Uint32 GetButtonState(SDL_Mouse *mouse, SDL_bool include_touch)
return buttonstate;
}
SDL_Window *
SDL_GetMouseFocus(void)
SDL_Window *SDL_GetMouseFocus(void)
{
SDL_Mouse *mouse = SDL_GetMouse();
@@ -252,8 +250,7 @@ SDL_GetMouseFocus(void)
* -flibit
*/
#if 0
void
SDL_ResetMouse(void)
void SDL_ResetMouse(void)
{
SDL_Mouse *mouse = SDL_GetMouse();
Uint32 buttonState = GetButtonState(mouse, SDL_FALSE);
@@ -1069,8 +1066,7 @@ int SDL_SetRelativeMouseMode(SDL_bool enabled)
return 0;
}
SDL_bool
SDL_GetRelativeMouseMode(void)
SDL_bool SDL_GetRelativeMouseMode(void)
{
SDL_Mouse *mouse = SDL_GetMouse();
@@ -1155,9 +1151,7 @@ int SDL_CaptureMouse(SDL_bool enabled)
return SDL_UpdateMouseCapture(SDL_FALSE);
}
SDL_Cursor *
SDL_CreateCursor(const Uint8 *data, const Uint8 *mask,
int w, int h, int hot_x, int hot_y)
SDL_Cursor *SDL_CreateCursor(const Uint8 *data, const Uint8 *mask, int w, int h, int hot_x, int hot_y)
{
SDL_Surface *surface;
SDL_Cursor *cursor;
@@ -1200,8 +1194,7 @@ SDL_CreateCursor(const Uint8 *data, const Uint8 *mask,
return cursor;
}
SDL_Cursor *
SDL_CreateColorCursor(SDL_Surface *surface, int hot_x, int hot_y)
SDL_Cursor *SDL_CreateColorCursor(SDL_Surface *surface, int hot_x, int hot_y)
{
SDL_Mouse *mouse = SDL_GetMouse();
SDL_Surface *temp = NULL;
@@ -1243,8 +1236,7 @@ SDL_CreateColorCursor(SDL_Surface *surface, int hot_x, int hot_y)
return cursor;
}
SDL_Cursor *
SDL_CreateSystemCursor(SDL_SystemCursor id)
SDL_Cursor *SDL_CreateSystemCursor(SDL_SystemCursor id)
{
SDL_Mouse *mouse = SDL_GetMouse();
SDL_Cursor *cursor;
@@ -1311,8 +1303,7 @@ int SDL_SetCursor(SDL_Cursor *cursor)
return 0;
}
SDL_Cursor *
SDL_GetCursor(void)
SDL_Cursor *SDL_GetCursor(void)
{
SDL_Mouse *mouse = SDL_GetMouse();
@@ -1322,8 +1313,7 @@ SDL_GetCursor(void)
return mouse->cur_cursor;
}
SDL_Cursor *
SDL_GetDefaultCursor(void)
SDL_Cursor *SDL_GetDefaultCursor(void)
{
SDL_Mouse *mouse = SDL_GetMouse();
+5 -10
View File
@@ -49,8 +49,7 @@ int SDL_GetNumTouchDevices(void)
return SDL_num_touch;
}
SDL_TouchID
SDL_GetTouchDevice(int index)
SDL_TouchID SDL_GetTouchDevice(int index)
{
if (index < 0 || index >= SDL_num_touch) {
SDL_SetError("Unknown touch device index %d", index);
@@ -59,8 +58,7 @@ SDL_GetTouchDevice(int index)
return SDL_touchDevices[index]->id;
}
const char *
SDL_GetTouchName(int index)
const char *SDL_GetTouchName(int index)
{
if (index < 0 || index >= SDL_num_touch) {
SDL_SetError("Unknown touch device");
@@ -83,8 +81,7 @@ static int SDL_GetTouchIndex(SDL_TouchID id)
return -1;
}
SDL_Touch *
SDL_GetTouch(SDL_TouchID id)
SDL_Touch *SDL_GetTouch(SDL_TouchID id)
{
int index = SDL_GetTouchIndex(id);
if (index < 0 || index >= SDL_num_touch) {
@@ -99,8 +96,7 @@ SDL_GetTouch(SDL_TouchID id)
return SDL_touchDevices[index];
}
SDL_TouchDeviceType
SDL_GetTouchDeviceType(SDL_TouchID id)
SDL_TouchDeviceType SDL_GetTouchDeviceType(SDL_TouchID id)
{
SDL_Touch *touch = SDL_GetTouch(id);
if (touch) {
@@ -138,8 +134,7 @@ int SDL_GetNumTouchFingers(SDL_TouchID touchID)
return 0;
}
SDL_Finger *
SDL_GetTouchFinger(SDL_TouchID touchID, int index)
SDL_Finger *SDL_GetTouchFinger(SDL_TouchID touchID, int index)
{
SDL_Touch *touch = SDL_GetTouch(touchID);
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 */
SDL_RWops *
SDL_RWFromFile(const char *file, const char *mode)
SDL_RWops *SDL_RWFromFile(const char *file, const char *mode)
{
SDL_RWops *rwops = NULL;
if (file == NULL || !*file || mode == NULL || !*mode) {
@@ -593,8 +592,7 @@ SDL_RWFromFile(const char *file, const char *mode)
return rwops;
}
SDL_RWops *
SDL_RWFromMem(void *mem, int size)
SDL_RWops *SDL_RWFromMem(void *mem, int size)
{
SDL_RWops *rwops = NULL;
if (mem == NULL) {
@@ -621,8 +619,7 @@ SDL_RWFromMem(void *mem, int size)
return rwops;
}
SDL_RWops *
SDL_RWFromConstMem(const void *mem, int size)
SDL_RWops *SDL_RWFromConstMem(const void *mem, int size)
{
SDL_RWops *rwops = NULL;
if (mem == NULL) {
@@ -649,8 +646,7 @@ SDL_RWFromConstMem(const void *mem, int size)
return rwops;
}
SDL_RWops *
SDL_CreateRW(void)
SDL_RWops *SDL_CreateRW(void)
{
SDL_RWops *area;
@@ -825,49 +821,42 @@ Uint64 SDL_ReadBE64(SDL_RWops *src)
return SDL_SwapBE64(value);
}
size_t
SDL_WriteU8(SDL_RWops *dst, Uint8 value)
size_t SDL_WriteU8(SDL_RWops *dst, Uint8 value)
{
return (SDL_RWwrite(dst, &value, sizeof(value)) == sizeof(value)) ? 1 : 0;
}
size_t
SDL_WriteLE16(SDL_RWops *dst, Uint16 value)
size_t SDL_WriteLE16(SDL_RWops *dst, Uint16 value)
{
const Uint16 swapped = SDL_SwapLE16(value);
return (SDL_RWwrite(dst, &swapped, sizeof(swapped)) == sizeof(swapped)) ? 1 : 0;
}
size_t
SDL_WriteBE16(SDL_RWops *dst, Uint16 value)
size_t SDL_WriteBE16(SDL_RWops *dst, Uint16 value)
{
const Uint16 swapped = SDL_SwapBE16(value);
return (SDL_RWwrite(dst, &swapped, sizeof(swapped)) == sizeof(swapped)) ? 1 : 0;
}
size_t
SDL_WriteLE32(SDL_RWops *dst, Uint32 value)
size_t SDL_WriteLE32(SDL_RWops *dst, Uint32 value)
{
const Uint32 swapped = SDL_SwapLE32(value);
return (SDL_RWwrite(dst, &swapped, sizeof(swapped)) == sizeof(swapped)) ? 1 : 0;
}
size_t
SDL_WriteBE32(SDL_RWops *dst, Uint32 value)
size_t SDL_WriteBE32(SDL_RWops *dst, Uint32 value)
{
const Uint32 swapped = SDL_SwapBE32(value);
return (SDL_RWwrite(dst, &swapped, sizeof(swapped)) == sizeof(swapped)) ? 1 : 0;
}
size_t
SDL_WriteLE64(SDL_RWops *dst, Uint64 value)
size_t SDL_WriteLE64(SDL_RWops *dst, Uint64 value)
{
const Uint64 swapped = SDL_SwapLE64(value);
return (SDL_RWwrite(dst, &swapped, sizeof(swapped)) == sizeof(swapped)) ? 1 : 0;
}
size_t
SDL_WriteBE64(SDL_RWops *dst, Uint64 value)
size_t SDL_WriteBE64(SDL_RWops *dst, Uint64 value)
{
const Uint64 swapped = SDL_SwapBE64(value);
return (SDL_RWwrite(dst, &swapped, sizeof(swapped)) == sizeof(swapped)) ? 1 : 0;
+9 -14
View File
@@ -22,21 +22,20 @@
#include "SDL_rwopsromfs.h"
/* 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 */
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);
SDL_FORCE_INLINE FILE *TryOpenInRomfs(const char *file, const char *mode);
static FILE *TryOpenFile(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
resources are stored in a special read-only partition prefixed with
'romfs:/'. As such, when opening a file, we should first try the romfs
unless sdmc is specifically mentionned.
*/
FILE *
N3DS_FileOpen(const char *file, const char *mode)
FILE *N3DS_FileOpen(const char *file, const char *mode)
{
/* romfs are read-only */
if (!IsReadMode(mode)) {
@@ -51,20 +50,17 @@ N3DS_FileOpen(const char *file, const char *mode)
return TryOpenFile(file, mode);
}
SDL_FORCE_INLINE SDL_bool
IsReadMode(const char *mode)
static SDL_bool IsReadMode(const char *mode)
{
return SDL_strchr(mode, 'r') != NULL;
}
SDL_FORCE_INLINE SDL_bool
HasPrefix(const char *file, const char *prefix)
static SDL_bool HasPrefix(const char *file, const char *prefix)
{
return SDL_strncmp(prefix, file, SDL_strlen(prefix)) == 0;
}
SDL_FORCE_INLINE FILE *
TryOpenFile(const char *file, const char *mode)
static FILE *TryOpenFile(const char *file, const char *mode)
{
FILE *fp = NULL;
@@ -76,8 +72,7 @@ TryOpenFile(const char *file, const char *mode)
return fp;
}
SDL_FORCE_INLINE FILE *
TryOpenInRomfs(const char *file, const char *mode)
FILE *TryOpenInRomfs(const char *file, const char *mode)
{
FILE *fp = NULL;
char *prefixed_filepath = NULL;
+2 -4
View File
@@ -27,16 +27,14 @@
#include <unistd.h>
char *
SDL_GetBasePath(void)
char *SDL_GetBasePath(void)
{
/* The current working directory is / on Android */
SDL_Unsupported();
return NULL;
}
char *
SDL_GetPrefPath(const char *org, const char *app)
char *SDL_GetPrefPath(const char *org, const char *app)
{
const char *path = SDL_AndroidGetInternalStoragePath();
if (path) {
+2 -4
View File
@@ -29,8 +29,7 @@
#include <sys/stat.h>
#include <sys/types.h>
char *
SDL_GetBasePath(void)
char *SDL_GetBasePath(void)
{
@autoreleasepool {
NSBundle *bundle = [NSBundle mainBundle];
@@ -64,8 +63,7 @@ SDL_GetBasePath(void)
}
}
char *
SDL_GetPrefPath(const char *org, const char *app)
char *SDL_GetPrefPath(const char *org, const char *app)
{
@autoreleasepool {
char *retval = NULL;
@@ -29,15 +29,13 @@
#include <emscripten/emscripten.h>
char *
SDL_GetBasePath(void)
char *SDL_GetBasePath(void)
{
char *retval = "/";
return SDL_strdup(retval);
}
char *
SDL_GetPrefPath(const char *org, const char *app)
char *SDL_GetPrefPath(const char *org, const char *app)
{
const char *append = "/libsdl/";
char *retval;
+2 -4
View File
@@ -32,8 +32,7 @@
#include <storage/Path.h>
char *
SDL_GetBasePath(void)
char *SDL_GetBasePath(void)
{
char name[MAXPATHLEN];
@@ -64,8 +63,7 @@ SDL_GetBasePath(void)
}
char *
SDL_GetPrefPath(const char *org, const char *app)
char *SDL_GetPrefPath(const char *org, const char *app)
{
// !!! FIXME: is there a better way to do this?
const char *home = SDL_getenv("HOME");
+6 -10
View File
@@ -29,18 +29,16 @@
#include <dirent.h>
#include <errno.h>
SDL_FORCE_INLINE char *MakePrefPath(const char *app);
SDL_FORCE_INLINE int CreatePrefPathDir(const char *pref);
static char *MakePrefPath(const char *app);
static int CreatePrefPathDir(const char *pref);
char *
SDL_GetBasePath(void)
char *SDL_GetBasePath(void)
{
char *base_path = SDL_strdup("romfs:/");
return base_path;
}
char *
SDL_GetPrefPath(const char *org, const char *app)
char *SDL_GetPrefPath(const char *org, const char *app)
{
char *pref_path = NULL;
if (app == NULL) {
@@ -68,8 +66,7 @@ char *SDL_GetPath(SDL_Folder folder)
return NULL;
}
SDL_FORCE_INLINE char *
MakePrefPath(const char *app)
static char *MakePrefPath(const char *app)
{
char *pref_path;
if (SDL_asprintf(&pref_path, "sdmc:/3ds/%s/", app) < 0) {
@@ -79,8 +76,7 @@ MakePrefPath(const char *app)
return pref_path;
}
SDL_FORCE_INLINE int
CreatePrefPathDir(const char *pref)
static int CreatePrefPathDir(const char *pref)
{
int result = mkdir(pref, 0666);
+2 -4
View File
@@ -28,8 +28,7 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* System dependent filesystem routines */
char *
SDL_GetBasePath(void)
char *SDL_GetBasePath(void)
{
char *retval;
size_t len;
@@ -75,8 +74,7 @@ static void recursive_mkdir(const char *dir)
mkdir(tmp, S_IRWXU);
}
char *
SDL_GetPrefPath(const char *org, const char *app)
char *SDL_GetPrefPath(const char *org, const char *app)
{
char *retval = NULL;
size_t len;
+2 -4
View File
@@ -28,8 +28,7 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* System dependent filesystem routines */
char *
SDL_GetBasePath(void)
char *SDL_GetBasePath(void)
{
char *retval = NULL;
size_t len;
@@ -43,8 +42,7 @@ SDL_GetBasePath(void)
return retval;
}
char *
SDL_GetPrefPath(const char *org, const char *app)
char *SDL_GetPrefPath(const char *org, const char *app)
{
char *retval = NULL;
size_t len;
+2 -4
View File
@@ -125,8 +125,7 @@ static _kernel_oserror *createDirectoryRecursive(char *path)
return _kernel_swi(OS_File, &regs, &regs);
}
char *
SDL_GetBasePath(void)
char *SDL_GetBasePath(void)
{
_kernel_swi_regs regs;
_kernel_oserror *error;
@@ -153,8 +152,7 @@ SDL_GetBasePath(void)
return retval;
}
char *
SDL_GetPrefPath(const char *org, const char *app)
char *SDL_GetPrefPath(const char *org, const char *app)
{
char *canon, *dir, *retval;
size_t len;
+12 -16
View File
@@ -120,8 +120,7 @@ static char *search_path_for_binary(const char *bin)
}
#endif
char *
SDL_GetBasePath(void)
char *SDL_GetBasePath(void)
{
char *retval = NULL;
@@ -259,8 +258,7 @@ SDL_GetBasePath(void)
return retval;
}
char *
SDL_GetPrefPath(const char *org, const char *app)
char *SDL_GetPrefPath(const char *org, const char *app)
{
/*
* We use XDG's base directory spec, even if you're not on Linux.
@@ -347,10 +345,10 @@ SDL_GetPrefPath(const char *org, const char *app)
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
@@ -361,8 +359,7 @@ SDL_GetPrefPath(const char *org, const char *app)
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
static char *
xdg_user_dir_lookup_with_fallback (const char *type, const char *fallback)
static char *xdg_user_dir_lookup_with_fallback (const char *type, const char *fallback)
{
FILE *file;
char *home_dir, *config_home, *config_file;
@@ -372,7 +369,7 @@ xdg_user_dir_lookup_with_fallback (const char *type, const char *fallback)
int len;
int relative;
size_t l;
home_dir = SDL_getenv ("HOME");
if (home_dir == NULL)
@@ -412,11 +409,11 @@ xdg_user_dir_lookup_with_fallback (const char *type, const char *fallback)
len = SDL_strlen (buffer);
if (len > 0 && buffer[len-1] == '\n')
buffer[len-1] = 0;
p = buffer;
while (*p == ' ' || *p == '\t')
p++;
if (SDL_strncmp (p, "XDG_", 4) != 0)
continue;
p += 4;
@@ -433,14 +430,14 @@ xdg_user_dir_lookup_with_fallback (const char *type, const char *fallback)
if (*p != '=')
continue;
p++;
while (*p == ' ' || *p == '\t')
p++;
if (*p != '"')
continue;
p++;
relative = 0;
if (SDL_strncmp (p, "$HOME/", 6) == 0)
{
@@ -469,7 +466,7 @@ xdg_user_dir_lookup_with_fallback (const char *type, const char *fallback)
*user_dir = 0;
}
d = user_dir + SDL_strlen (user_dir);
while (*p && *p != '"')
{
@@ -491,8 +488,7 @@ error2:
return NULL;
}
static char *
xdg_user_dir_lookup (const char *type)
static char *xdg_user_dir_lookup (const char *type)
{
char *dir, *home_dir, *user_dir;
+2 -4
View File
@@ -34,16 +34,14 @@
#include <limits.h>
#include <fcntl.h>
char *
SDL_GetBasePath(void)
char *SDL_GetBasePath(void)
{
const char *basepath = "app0:/";
char *retval = SDL_strdup(basepath);
return retval;
}
char *
SDL_GetPrefPath(const char *org, const char *app)
char *SDL_GetPrefPath(const char *org, const char *app)
{
const char *envr = "ux0:/data/";
char *retval = NULL;
+3 -6
View File
@@ -334,22 +334,19 @@ done:
#endif /* SDL_FILESYSTEM_WINDOWS */
#ifdef SDL_FILESYSTEM_XBOX
char *
SDL_GetBasePath(void)
char *SDL_GetBasePath(void)
{
SDL_Unsupported();
return NULL;
}
char *
SDL_GetPrefPath(const char *org, const char *app)
char *SDL_GetPrefPath(const char *org, const char *app)
{
SDL_Unsupported();
return NULL;
}
char *
SDL_GetPath(SDL_Folder folder)
char *SDL_GetPath(SDL_Folder folder)
{
SDL_Unsupported();
return NULL;
+5 -10
View File
@@ -85,8 +85,7 @@ int SDL_NumHaptics(void)
/*
* Gets the name of a Haptic device by index.
*/
const char *
SDL_HapticName(int device_index)
const char *SDL_HapticName(int device_index)
{
if ((device_index < 0) || (device_index >= SDL_NumHaptics())) {
SDL_SetError("Haptic: There are %d haptic devices available",
@@ -99,8 +98,7 @@ SDL_HapticName(int device_index)
/*
* Opens a Haptic device.
*/
SDL_Haptic *
SDL_HapticOpen(int device_index)
SDL_Haptic *SDL_HapticOpen(int device_index)
{
SDL_Haptic *haptic;
SDL_Haptic *hapticlist;
@@ -211,8 +209,7 @@ int SDL_MouseIsHaptic(void)
/*
* Returns the haptic device if mouse is haptic or NULL elsewise.
*/
SDL_Haptic *
SDL_HapticOpenFromMouse(void)
SDL_Haptic *SDL_HapticOpenFromMouse(void)
{
int device_index;
@@ -257,8 +254,7 @@ int SDL_JoystickIsHaptic(SDL_Joystick *joystick)
/*
* Opens a haptic device from a joystick.
*/
SDL_Haptic *
SDL_HapticOpenFromJoystick(SDL_Joystick *joystick)
SDL_Haptic *SDL_HapticOpenFromJoystick(SDL_Joystick *joystick)
{
SDL_Haptic *haptic;
SDL_Haptic *hapticlist;
@@ -415,8 +411,7 @@ int SDL_HapticNumEffectsPlaying(SDL_Haptic *haptic)
/*
* Returns supported effects by the device.
*/
unsigned int
SDL_HapticQuery(SDL_Haptic *haptic)
unsigned int SDL_HapticQuery(SDL_Haptic *haptic)
{
if (!ValidHaptic(haptic)) {
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;
}
const char *
SDL_SYS_HapticName(int index)
const char *SDL_SYS_HapticName(int index)
{
SDL_hapticlist_item *item = HapticByOrder(index);
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.
*/
const char *
SDL_SYS_HapticName(int index)
const char *SDL_SYS_HapticName(int index)
{
SDL_hapticlist_item *item;
item = HapticByDevIndex(index);
+1 -2
View File
@@ -39,8 +39,7 @@ int SDL_SYS_NumHaptics(void)
return 0;
}
const char *
SDL_SYS_HapticName(int index)
const char *SDL_SYS_HapticName(int index)
{
SDL_SYS_LogicError();
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.
*/
const char *
SDL_SYS_HapticName(int index)
const char *SDL_SYS_HapticName(int index)
{
SDL_hapticlist_item *item;
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.
*/
const char *
SDL_SYS_HapticName(int index)
const char *SDL_SYS_HapticName(int index)
{
SDL_hapticlist_item *item = HapticByDevIndex(index);
return item->name;
+7 -14
View File
@@ -193,14 +193,12 @@ static int SDL_inotify_init1(void)
}
#endif
static int
StrHasPrefix(const char *string, const char *prefix)
static int StrHasPrefix(const char *string, const char *prefix)
{
return SDL_strncmp(string, prefix, SDL_strlen(prefix)) == 0;
}
static int
StrIsInteger(const char *string)
static int StrIsInteger(const char *string)
{
const char *p;
@@ -218,8 +216,7 @@ StrIsInteger(const char *string)
}
#endif /* HAVE_INOTIFY */
static void
HIDAPI_InitializeDiscovery(void)
static void HIDAPI_InitializeDiscovery(void)
{
SDL_HIDAPI_discovery.m_bInitialized = SDL_TRUE;
SDL_HIDAPI_discovery.m_unDeviceChangeCounter = 1;
@@ -358,8 +355,7 @@ HIDAPI_InitializeDiscovery(void)
}
}
static void
HIDAPI_UpdateDiscovery(void)
static void HIDAPI_UpdateDiscovery(void)
{
if (!SDL_HIDAPI_discovery.m_bInitialized) {
HIDAPI_InitializeDiscovery();
@@ -476,8 +472,7 @@ HIDAPI_UpdateDiscovery(void)
}
}
static void
HIDAPI_ShutdownDiscovery(void)
static void HIDAPI_ShutdownDiscovery(void)
{
if (!SDL_HIDAPI_discovery.m_bInitialized) {
return;
@@ -808,8 +803,7 @@ static struct
#ifndef __FreeBSD__
/* this is awkwardly inlined, so we need to re-implement it here
* so we can override the libusb_control_transfer call */
static int
SDL_libusb_get_string_descriptor(libusb_device_handle *dev,
static int SDL_libusb_get_string_descriptor(libusb_device_handle *dev,
uint8_t descriptor_index, uint16_t lang_id,
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)
static SDL_hid_device *
CreateHIDDeviceWrapper(void *device, const struct hidapi_backend *backend)
static SDL_hid_device *CreateHIDDeviceWrapper(void *device, const struct hidapi_backend *backend)
{
SDL_hid_device *wrapper = (SDL_hid_device *)SDL_malloc(sizeof(*wrapper));
wrapper->magic = &device_magic;
+1 -2
View File
@@ -222,8 +222,7 @@ struct hid_device_ {
BOOL use_hid_write_output_report;
};
static BOOL
IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor)
static BOOL IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor)
{
OSVERSIONINFOEXW osvi;
DWORDLONG const dwlConditionMask = VerSetConditionMask(

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