Updated source to match SDL function prototype style

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

View File

@@ -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) {

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;

View File

@@ -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;

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");

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);

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;

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;

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;

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;

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;

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;