Use C++ style comments consistently in SDL source code
Implemented using this script:
find . -type f -exec sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' {} \;
git checkout \
core/linux/SDL_evdev_kbd_default_keymap.h \
events/imKStoUCS.* \
hidapi \
joystick/controller_type.c \
joystick/controller_type.h \
joystick/hidapi/steam/controller_constants.h \
joystick/hidapi/steam/controller_structs.h \
joystick/SDL_gamepad_db.h \
libm \
render/*/*Shader*.h \
render/vitagxm/SDL_render_vita_gxm_shaders.h \
render/metal/SDL_shaders_metal_*.h \
stdlib/SDL_malloc.c \
stdlib/SDL_qsort.c \
stdlib/SDL_strtokr.c \
test/ \
video/directx/SDL_d3d12_xbox_cmacros.h \
video/directx/d3d12.h \
video/directx/d3d12sdklayers.h \
video/khronos \
video/x11/edid-parse.c \
video/x11/xsettings-client.* \
video/yuv2rgb
sed -i'' -e 's,/\* *\([^*]*\)\*/ *$,// \1,' -e 's, \+$,,' hidapi/SDL_hidapi.c
This commit is contained in:
@@ -55,7 +55,7 @@ int SDL_CopyFile(const char *oldpath, const char *newpath)
|
||||
|
||||
int SDL_CreateDirectory(const char *path)
|
||||
{
|
||||
/* TODO: Recursively create subdirectories */
|
||||
// TODO: Recursively create subdirectories
|
||||
if (!path) {
|
||||
return SDL_InvalidParamError("path");
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#ifdef SDL_FILESYSTEM_ANDROID
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* System dependent filesystem routines */
|
||||
// System dependent filesystem routines
|
||||
|
||||
#include "../SDL_sysfilesystem.h"
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
char *SDL_SYS_GetBasePath(void)
|
||||
{
|
||||
/* The current working directory is / on Android */
|
||||
// The current working directory is / on Android
|
||||
SDL_Unsupported();
|
||||
return NULL;
|
||||
}
|
||||
@@ -59,4 +59,4 @@ char *SDL_SYS_GetUserFolder(SDL_Folder folder)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif /* SDL_FILESYSTEM_ANDROID */
|
||||
#endif // SDL_FILESYSTEM_ANDROID
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#ifdef SDL_FILESYSTEM_COCOA
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* System dependent filesystem routines */
|
||||
// System dependent filesystem routines
|
||||
|
||||
#include "../SDL_sysfilesystem.h"
|
||||
|
||||
@@ -47,7 +47,7 @@ char *SDL_SYS_GetBasePath(void)
|
||||
} else if (SDL_strcasecmp(baseType, "parent") == 0) {
|
||||
base = [[[bundle bundlePath] stringByDeletingLastPathComponent] fileSystemRepresentation];
|
||||
} else {
|
||||
/* this returns the exedir for non-bundled and the resourceDir for bundled apps */
|
||||
// this returns the exedir for non-bundled and the resourceDir for bundled apps
|
||||
base = [[bundle resourcePath] fileSystemRepresentation];
|
||||
}
|
||||
|
||||
@@ -97,9 +97,9 @@ char *SDL_SYS_GetPrefPath(const char *org, const char *app)
|
||||
}
|
||||
|
||||
array = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
|
||||
#endif /* !SDL_PLATFORM_TVOS */
|
||||
#endif // !SDL_PLATFORM_TVOS
|
||||
|
||||
if ([array count] > 0) { /* we only want the first item in the list. */
|
||||
if ([array count] > 0) { // we only want the first item in the list.
|
||||
NSString *str = [array objectAtIndex:0];
|
||||
const char *base = [str fileSystemRepresentation];
|
||||
if (base) {
|
||||
@@ -233,8 +233,8 @@ append_slash:
|
||||
}
|
||||
|
||||
return retval;
|
||||
#endif /* SDL_PLATFORM_TVOS */
|
||||
#endif // SDL_PLATFORM_TVOS
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* SDL_FILESYSTEM_COCOA */
|
||||
#endif // SDL_FILESYSTEM_COCOA
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#if defined(SDL_FILESYSTEM_DUMMY) || defined(SDL_FILESYSTEM_DISABLED)
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* System dependent filesystem routines */
|
||||
// System dependent filesystem routines
|
||||
|
||||
#include "../SDL_sysfilesystem.h"
|
||||
|
||||
@@ -45,4 +45,4 @@ char *SDL_SYS_GetUserFolder(SDL_Folder folder)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif /* SDL_FILESYSTEM_DUMMY || SDL_FILESYSTEM_DISABLED */
|
||||
#endif // SDL_FILESYSTEM_DUMMY || SDL_FILESYSTEM_DISABLED
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#if defined(SDL_FSOPS_DUMMY)
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* System dependent filesystem routines */
|
||||
// System dependent filesystem routines
|
||||
|
||||
#include "../SDL_sysfilesystem.h"
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#ifdef SDL_FILESYSTEM_EMSCRIPTEN
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* System dependent filesystem routines */
|
||||
// System dependent filesystem routines
|
||||
|
||||
#include "../SDL_sysfilesystem.h"
|
||||
|
||||
@@ -113,4 +113,4 @@ char *SDL_SYS_GetUserFolder(SDL_Folder folder)
|
||||
return retval;
|
||||
}
|
||||
|
||||
#endif /* SDL_FILESYSTEM_EMSCRIPTEN */
|
||||
#endif // SDL_FILESYSTEM_EMSCRIPTEN
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "SDL_internal.h"
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* System dependent filesystem routines */
|
||||
// System dependent filesystem routines
|
||||
|
||||
extern "C" {
|
||||
#include "../SDL_sysfilesystem.h"
|
||||
@@ -54,13 +54,13 @@ SDL_SYS_GetBasePath(void)
|
||||
path = (CHAR *)ptr;
|
||||
|
||||
len = GetModuleFileNameA(NULL, path, buflen);
|
||||
/* if it truncated, then len >= buflen - 1 */
|
||||
/* if there was enough room (or failure), len < buflen - 1 */
|
||||
// if it truncated, then len >= buflen - 1
|
||||
// if there was enough room (or failure), len < buflen - 1
|
||||
if (len < buflen - 1) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* buffer too small? Try again. */
|
||||
// buffer too small? Try again.
|
||||
buflen *= 2;
|
||||
}
|
||||
|
||||
@@ -76,8 +76,8 @@ SDL_SYS_GetBasePath(void)
|
||||
}
|
||||
}
|
||||
|
||||
SDL_assert(i > 0); /* Should have been an absolute path. */
|
||||
path[i + 1] = '\0'; /* chop off filename. */
|
||||
SDL_assert(i > 0); // Should have been an absolute path.
|
||||
path[i + 1] = '\0'; // chop off filename.
|
||||
|
||||
return path;
|
||||
}
|
||||
@@ -89,20 +89,20 @@ char *SDL_SYS_GetPrefPath(const char *org, const char *app)
|
||||
char *folderPath;
|
||||
HRESULT result;
|
||||
const char *csid = SDL_GetHint("SDL_GDK_SERVICE_CONFIGURATION_ID");
|
||||
|
||||
|
||||
if (!app) {
|
||||
SDL_InvalidParamError("app");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* This should be set before calling SDL_GetPrefPath! */
|
||||
// This should be set before calling SDL_GetPrefPath!
|
||||
if (!csid) {
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_SYSTEM, "Set SDL_GDK_SERVICE_CONFIGURATION_ID before calling SDL_GetPrefPath!");
|
||||
return SDL_strdup("T:\\");
|
||||
}
|
||||
|
||||
if (SDL_GetGDKDefaultUser(&user) < 0) {
|
||||
/* Error already set, just return */
|
||||
// Error already set, just return
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -135,11 +135,11 @@ char *SDL_SYS_GetPrefPath(const char *org, const char *app)
|
||||
return folderPath;
|
||||
}
|
||||
|
||||
/* TODO */
|
||||
// TODO
|
||||
char *SDL_SYS_GetUserFolder(SDL_Folder folder)
|
||||
{
|
||||
SDL_Unsupported();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
// vi: set ts=4 sw=4 expandtab:
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#ifdef SDL_FILESYSTEM_HAIKU
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* System dependent filesystem routines */
|
||||
// System dependent filesystem routines
|
||||
|
||||
extern "C" {
|
||||
#include "../SDL_sysfilesystem.h"
|
||||
@@ -46,9 +46,9 @@ char *SDL_SYS_GetBasePath(void)
|
||||
|
||||
BEntry entry(name, true);
|
||||
BPath path;
|
||||
status_t rc = entry.GetPath(&path); /* (path) now has binary's path. */
|
||||
status_t rc = entry.GetPath(&path); // (path) now has binary's path.
|
||||
SDL_assert(rc == B_OK);
|
||||
rc = path.GetParent(&path); /* chop filename, keep directory. */
|
||||
rc = path.GetParent(&path); // chop filename, keep directory.
|
||||
SDL_assert(rc == B_OK);
|
||||
const char *str = path.Path();
|
||||
SDL_assert(str != NULL);
|
||||
@@ -123,7 +123,7 @@ char *SDL_SYS_GetUserFolder(SDL_Folder folder)
|
||||
|
||||
return retval;
|
||||
|
||||
/* TODO: Is Haiku's desktop folder always ~/Desktop/ ? */
|
||||
// TODO: Is Haiku's desktop folder always ~/Desktop/ ?
|
||||
case SDL_FOLDER_DESKTOP:
|
||||
retval = (char *) SDL_malloc(SDL_strlen(home) + 10);
|
||||
if (!retval) {
|
||||
@@ -153,4 +153,4 @@ char *SDL_SYS_GetUserFolder(SDL_Folder folder)
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* SDL_FILESYSTEM_HAIKU */
|
||||
#endif // SDL_FILESYSTEM_HAIKU
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#ifdef SDL_FILESYSTEM_N3DS
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* System dependent filesystem routines */
|
||||
// System dependent filesystem routines
|
||||
|
||||
#include "../SDL_sysfilesystem.h"
|
||||
|
||||
@@ -61,7 +61,7 @@ char *SDL_SYS_GetPrefPath(const char *org, const char *app)
|
||||
return pref_path;
|
||||
}
|
||||
|
||||
/* TODO */
|
||||
// TODO
|
||||
char *SDL_SYS_GetUserFolder(SDL_Folder folder)
|
||||
{
|
||||
SDL_Unsupported();
|
||||
@@ -87,4 +87,4 @@ static int CreatePrefPathDir(const char *pref)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* SDL_FILESYSTEM_N3DS */
|
||||
#endif // SDL_FILESYSTEM_N3DS
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#if defined(SDL_FSOPS_POSIX)
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* System dependent filesystem routines */
|
||||
// System dependent filesystem routines
|
||||
|
||||
#include "../SDL_sysfilesystem.h"
|
||||
|
||||
@@ -180,7 +180,7 @@ int SDL_SYS_GetPathInfo(const char *path, SDL_PathInfo *info)
|
||||
}
|
||||
|
||||
#if defined(HAVE_ST_MTIM)
|
||||
/* POSIX.1-2008 standard */
|
||||
// POSIX.1-2008 standard
|
||||
info->create_time = (SDL_Time)SDL_SECONDS_TO_NS(statbuf.st_ctim.tv_sec) + statbuf.st_ctim.tv_nsec;
|
||||
info->modify_time = (SDL_Time)SDL_SECONDS_TO_NS(statbuf.st_mtim.tv_sec) + statbuf.st_mtim.tv_nsec;
|
||||
info->access_time = (SDL_Time)SDL_SECONDS_TO_NS(statbuf.st_atim.tv_sec) + statbuf.st_atim.tv_nsec;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#ifdef SDL_FILESYSTEM_PS2
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* System dependent filesystem routines */
|
||||
// System dependent filesystem routines
|
||||
|
||||
#include "../SDL_sysfilesystem.h"
|
||||
|
||||
@@ -46,7 +46,7 @@ char *SDL_SYS_GetBasePath(void)
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* Do a recursive mkdir of parents folders */
|
||||
// Do a recursive mkdir of parents folders
|
||||
static void recursive_mkdir(const char *dir)
|
||||
{
|
||||
char tmp[FILENAME_MAX];
|
||||
@@ -109,11 +109,11 @@ char *SDL_SYS_GetPrefPath(const char *org, const char *app)
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* TODO */
|
||||
// TODO
|
||||
char *SDL_SYS_GetUserFolder(SDL_Folder folder)
|
||||
{
|
||||
SDL_Unsupported();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif /* SDL_FILESYSTEM_PS2 */
|
||||
#endif // SDL_FILESYSTEM_PS2
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#ifdef SDL_FILESYSTEM_PSP
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* System dependent filesystem routines */
|
||||
// System dependent filesystem routines
|
||||
|
||||
#include "../SDL_sysfilesystem.h"
|
||||
|
||||
@@ -79,11 +79,11 @@ char *SDL_SYS_GetPrefPath(const char *org, const char *app)
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* TODO */
|
||||
// TODO
|
||||
char *SDL_SYS_GetUserFolder(SDL_Folder folder)
|
||||
{
|
||||
SDL_Unsupported();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif /* SDL_FILESYSTEM_PSP */
|
||||
#endif // SDL_FILESYSTEM_PSP
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#ifdef SDL_FILESYSTEM_RISCOS
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* System dependent filesystem routines */
|
||||
// System dependent filesystem routines
|
||||
|
||||
#include "../SDL_sysfilesystem.h"
|
||||
|
||||
@@ -31,10 +31,10 @@
|
||||
#include <swis.h>
|
||||
#include <unixlib/local.h>
|
||||
|
||||
/* Wrapper around __unixify_std that uses SDL's memory allocators */
|
||||
// Wrapper around __unixify_std that uses SDL's memory allocators
|
||||
static char *SDL_unixify_std(const char *ro_path, char *buffer, size_t buf_len, int filetype)
|
||||
{
|
||||
const char *const in_buf = buffer; /* = NULL if we allocate the buffer. */
|
||||
const char *const in_buf = buffer; // = NULL if we allocate the buffer.
|
||||
|
||||
if (!buffer) {
|
||||
/* This matches the logic in __unixify, with an additional byte for the
|
||||
@@ -141,7 +141,7 @@ char *SDL_SYS_GetBasePath(void)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* chop off filename. */
|
||||
// chop off filename.
|
||||
ptr = SDL_strrchr(canon, '.');
|
||||
if (ptr) {
|
||||
*ptr = '\0';
|
||||
@@ -198,11 +198,11 @@ char *SDL_SYS_GetPrefPath(const char *org, const char *app)
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* TODO */
|
||||
// TODO
|
||||
char *SDL_SYS_GetUserFolder(SDL_Folder folder)
|
||||
{
|
||||
SDL_Unsupported();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif /* SDL_FILESYSTEM_RISCOS */
|
||||
#endif // SDL_FILESYSTEM_RISCOS
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#ifdef SDL_FILESYSTEM_UNIX
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* System dependent filesystem routines */
|
||||
// System dependent filesystem routines
|
||||
|
||||
#include "../SDL_sysfilesystem.h"
|
||||
|
||||
@@ -58,13 +58,13 @@ static char *readSymLink(const char *path)
|
||||
|
||||
rc = readlink(path, retval, len);
|
||||
if (rc == -1) {
|
||||
break; /* not a symlink, i/o error, etc. */
|
||||
break; // not a symlink, i/o error, etc.
|
||||
} else if (rc < len) {
|
||||
retval[rc] = '\0'; /* readlink doesn't null-terminate. */
|
||||
return retval; /* we're good to go. */
|
||||
retval[rc] = '\0'; // readlink doesn't null-terminate.
|
||||
return retval; // we're good to go.
|
||||
}
|
||||
|
||||
len *= 2; /* grow buffer, try again. */
|
||||
len *= 2; // grow buffer, try again.
|
||||
}
|
||||
|
||||
SDL_free(retval);
|
||||
@@ -97,28 +97,28 @@ static char *search_path_for_binary(const char *bin)
|
||||
exe = (char *)SDL_malloc(alloc_size);
|
||||
|
||||
do {
|
||||
ptr = SDL_strchr(start, ':'); /* find next $PATH separator. */
|
||||
ptr = SDL_strchr(start, ':'); // find next $PATH separator.
|
||||
if (ptr != start) {
|
||||
if (ptr) {
|
||||
*ptr = '\0';
|
||||
}
|
||||
|
||||
/* build full binary path... */
|
||||
// build full binary path...
|
||||
SDL_snprintf(exe, alloc_size, "%s%s%s", start, (ptr && (ptr[-1] == '/')) ? "" : "/", bin);
|
||||
|
||||
if (access(exe, X_OK) == 0) { /* Exists as executable? We're done. */
|
||||
if (access(exe, X_OK) == 0) { // Exists as executable? We're done.
|
||||
SDL_free(envr);
|
||||
return exe;
|
||||
}
|
||||
}
|
||||
start = ptr + 1; /* start points to beginning of next element. */
|
||||
start = ptr + 1; // start points to beginning of next element.
|
||||
} while (ptr);
|
||||
|
||||
SDL_free(envr);
|
||||
SDL_free(exe);
|
||||
|
||||
SDL_SetError("Process not found in $PATH");
|
||||
return NULL; /* doesn't exist in path. */
|
||||
return NULL; // doesn't exist in path.
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -138,7 +138,7 @@ char *SDL_SYS_GetBasePath(void)
|
||||
}
|
||||
#endif
|
||||
#ifdef SDL_PLATFORM_OPENBSD
|
||||
/* Please note that this will fail if the process was launched with a relative path and $PWD + the cwd have changed, or argv is altered. So don't do that. Or add a new sysctl to OpenBSD. */
|
||||
// Please note that this will fail if the process was launched with a relative path and $PWD + the cwd have changed, or argv is altered. So don't do that. Or add a new sysctl to OpenBSD.
|
||||
char **cmdline;
|
||||
size_t len;
|
||||
const int mib[] = { CTL_KERN, KERN_PROC_ARGS, getpid(), KERN_PROC_ARGV };
|
||||
@@ -159,7 +159,7 @@ char *SDL_SYS_GetBasePath(void)
|
||||
|
||||
exe = cmdline[0];
|
||||
pwddst = NULL;
|
||||
if (SDL_strchr(exe, '/') == NULL) { /* not a relative or absolute path, check $PATH for it */
|
||||
if (SDL_strchr(exe, '/') == NULL) { // not a relative or absolute path, check $PATH for it
|
||||
exe = search_path_for_binary(cmdline[0]);
|
||||
} else {
|
||||
if (exe && *exe == '.') {
|
||||
@@ -195,7 +195,7 @@ char *SDL_SYS_GetBasePath(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* is a Linux-style /proc filesystem available? */
|
||||
// is a Linux-style /proc filesystem available?
|
||||
if (!retval && (access("/proc", F_OK) == 0)) {
|
||||
/* !!! FIXME: after 2.0.6 ships, let's delete this code and just
|
||||
use the /proc/%llu version. There's no reason to have
|
||||
@@ -207,9 +207,9 @@ char *SDL_SYS_GetBasePath(void)
|
||||
#elif defined(SDL_PLATFORM_SOLARIS)
|
||||
retval = readSymLink("/proc/self/path/a.out");
|
||||
#else
|
||||
retval = readSymLink("/proc/self/exe"); /* linux. */
|
||||
retval = readSymLink("/proc/self/exe"); // linux.
|
||||
if (!retval) {
|
||||
/* older kernels don't have /proc/self ... try PID version... */
|
||||
// older kernels don't have /proc/self ... try PID version...
|
||||
char path[64];
|
||||
const int rc = SDL_snprintf(path, sizeof(path),
|
||||
"/proc/%llu/exe",
|
||||
@@ -221,10 +221,10 @@ char *SDL_SYS_GetBasePath(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SDL_PLATFORM_SOLARIS /* try this as a fallback if /proc didn't pan out */
|
||||
#ifdef SDL_PLATFORM_SOLARIS // try this as a fallback if /proc didn't pan out
|
||||
if (!retval) {
|
||||
const char *path = getexecname();
|
||||
if ((path) && (path[0] == '/')) { /* must be absolute path... */
|
||||
if ((path) && (path[0] == '/')) { // must be absolute path...
|
||||
retval = SDL_strdup(path);
|
||||
if (!retval) {
|
||||
return NULL;
|
||||
@@ -235,21 +235,21 @@ char *SDL_SYS_GetBasePath(void)
|
||||
/* If we had access to argv[0] here, we could check it for a path,
|
||||
or troll through $PATH looking for it, too. */
|
||||
|
||||
if (retval) { /* chop off filename. */
|
||||
if (retval) { // chop off filename.
|
||||
char *ptr = SDL_strrchr(retval, '/');
|
||||
if (ptr) {
|
||||
*(ptr + 1) = '\0';
|
||||
} else { /* shouldn't happen, but just in case... */
|
||||
} else { // shouldn't happen, but just in case...
|
||||
SDL_free(retval);
|
||||
retval = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (retval) {
|
||||
/* try to shrink buffer... */
|
||||
// try to shrink buffer...
|
||||
char *ptr = (char *)SDL_realloc(retval, SDL_strlen(retval) + 1);
|
||||
if (ptr) {
|
||||
retval = ptr; /* oh well if it failed. */
|
||||
retval = ptr; // oh well if it failed.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -280,10 +280,10 @@ char *SDL_SYS_GetPrefPath(const char *org, const char *app)
|
||||
}
|
||||
|
||||
if (!envr) {
|
||||
/* You end up with "$HOME/.local/share/Game Name 2" */
|
||||
// You end up with "$HOME/.local/share/Game Name 2"
|
||||
envr = SDL_getenv("HOME");
|
||||
if (!envr) {
|
||||
/* we could take heroic measures with /etc/passwd, but oh well. */
|
||||
// we could take heroic measures with /etc/passwd, but oh well.
|
||||
SDL_SetError("neither XDG_DATA_HOME nor HOME environment is set");
|
||||
return NULL;
|
||||
}
|
||||
@@ -403,7 +403,7 @@ static char *xdg_user_dir_lookup_with_fallback (const char *type, const char *fa
|
||||
user_dir = NULL;
|
||||
while (fgets (buffer, sizeof (buffer), file))
|
||||
{
|
||||
/* Remove newline at end */
|
||||
// Remove newline at end
|
||||
len = SDL_strlen (buffer);
|
||||
if (len > 0 && buffer[len-1] == '\n')
|
||||
buffer[len-1] = 0;
|
||||
@@ -500,7 +500,7 @@ static char *xdg_user_dir_lookup (const char *type)
|
||||
if (!home_dir)
|
||||
return NULL;
|
||||
|
||||
/* Special case desktop for historical compatibility */
|
||||
// Special case desktop for historical compatibility
|
||||
if (SDL_strcmp(type, "DESKTOP") == 0) {
|
||||
size_t length = SDL_strlen(home_dir) + SDL_strlen("/Desktop") + 1;
|
||||
user_dir = (char*) SDL_malloc(length);
|
||||
@@ -615,4 +615,4 @@ append_slash:
|
||||
return retval;
|
||||
}
|
||||
|
||||
#endif /* SDL_FILESYSTEM_UNIX */
|
||||
#endif // SDL_FILESYSTEM_UNIX
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#ifdef SDL_FILESYSTEM_VITA
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* System dependent filesystem routines */
|
||||
// System dependent filesystem routines
|
||||
|
||||
#include "../SDL_sysfilesystem.h"
|
||||
|
||||
@@ -82,11 +82,11 @@ char *SDL_SYS_GetPrefPath(const char *org, const char *app)
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* TODO */
|
||||
// TODO
|
||||
char *SDL_SYS_GetUserFolder(SDL_Folder folder)
|
||||
{
|
||||
SDL_Unsupported();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif /* SDL_FILESYSTEM_VITA */
|
||||
#endif // SDL_FILESYSTEM_VITA
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#ifdef SDL_FILESYSTEM_WINDOWS
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* System dependent filesystem routines */
|
||||
// System dependent filesystem routines
|
||||
|
||||
#include "../SDL_sysfilesystem.h"
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <shlobj.h>
|
||||
#include <initguid.h>
|
||||
|
||||
/* These aren't all defined in older SDKs, so define them here */
|
||||
// These aren't all defined in older SDKs, so define them here
|
||||
DEFINE_GUID(SDL_FOLDERID_Profile, 0x5E6C858F, 0x0E22, 0x4760, 0x9A, 0xFE, 0xEA, 0x33, 0x17, 0xB6, 0x71, 0x73);
|
||||
DEFINE_GUID(SDL_FOLDERID_Desktop, 0xB4BFCC3A, 0xDB2C, 0x424C, 0xB0, 0x29, 0x7F, 0xE9, 0x9A, 0x87, 0xC6, 0x41);
|
||||
DEFINE_GUID(SDL_FOLDERID_Documents, 0xFDD39AD0, 0x238F, 0x46AF, 0xAD, 0xB4, 0x6C, 0x85, 0x48, 0x03, 0x69, 0xC7);
|
||||
@@ -61,13 +61,13 @@ char *SDL_SYS_GetBasePath(void)
|
||||
path = (WCHAR *)ptr;
|
||||
|
||||
len = GetModuleFileNameW(NULL, path, buflen);
|
||||
/* if it truncated, then len >= buflen - 1 */
|
||||
/* if there was enough room (or failure), len < buflen - 1 */
|
||||
// if it truncated, then len >= buflen - 1
|
||||
// if there was enough room (or failure), len < buflen - 1
|
||||
if (len < buflen - 1) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* buffer too small? Try again. */
|
||||
// buffer too small? Try again.
|
||||
buflen *= 2;
|
||||
}
|
||||
|
||||
@@ -83,8 +83,8 @@ char *SDL_SYS_GetBasePath(void)
|
||||
}
|
||||
}
|
||||
|
||||
SDL_assert(i > 0); /* Should have been an absolute path. */
|
||||
path[i + 1] = '\0'; /* chop off filename. */
|
||||
SDL_assert(i > 0); // Should have been an absolute path.
|
||||
path[i + 1] = '\0'; // chop off filename.
|
||||
|
||||
retval = WIN_StringToUTF8W(path);
|
||||
SDL_free(path);
|
||||
@@ -188,7 +188,7 @@ char *SDL_SYS_GetUserFolder(SDL_Folder folder)
|
||||
}
|
||||
|
||||
if (pSHGetKnownFolderPath) {
|
||||
GUID type; /* KNOWNFOLDERID */
|
||||
GUID type; // KNOWNFOLDERID
|
||||
HRESULT result;
|
||||
wchar_t *path;
|
||||
|
||||
@@ -304,11 +304,11 @@ char *SDL_SYS_GetUserFolder(SDL_Folder folder)
|
||||
goto done;
|
||||
};
|
||||
|
||||
/* Create the OS-specific folder if it doesn't already exist */
|
||||
// Create the OS-specific folder if it doesn't already exist
|
||||
type |= CSIDL_FLAG_CREATE;
|
||||
|
||||
#if 0
|
||||
/* Apparently the oldest, but not supported in modern Windows */
|
||||
// Apparently the oldest, but not supported in modern Windows
|
||||
HRESULT result = SHGetSpecialFolderPath(NULL, path, type, TRUE);
|
||||
#endif
|
||||
|
||||
@@ -316,7 +316,7 @@ char *SDL_SYS_GetUserFolder(SDL_Folder folder)
|
||||
available), available in Wine (tested 6.0.3) */
|
||||
result = SHGetFolderPathW(NULL, type, NULL, SHGFP_TYPE_CURRENT, path);
|
||||
|
||||
/* use `== TRUE` for SHGetSpecialFolderPath */
|
||||
// use `== TRUE` for SHGetSpecialFolderPath
|
||||
if (SUCCEEDED(result)) {
|
||||
retval = WIN_StringToUTF8W(path);
|
||||
} else {
|
||||
@@ -329,7 +329,7 @@ char *SDL_SYS_GetUserFolder(SDL_Folder folder)
|
||||
|
||||
if (!newretval) {
|
||||
SDL_free(retval);
|
||||
retval = NULL; /* will be returned */
|
||||
retval = NULL; // will be returned
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -343,4 +343,4 @@ done:
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
#endif /* SDL_FILESYSTEM_WINDOWS */
|
||||
#endif // SDL_FILESYSTEM_WINDOWS
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#if defined(SDL_FSOPS_WINDOWS)
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* System dependent filesystem routines */
|
||||
// System dependent filesystem routines
|
||||
|
||||
#include "../../core/windows/SDL_windows.h"
|
||||
#include "../SDL_sysfilesystem.h"
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#ifdef SDL_PLATFORM_WINRT
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* System dependent filesystem routines */
|
||||
// System dependent filesystem routines
|
||||
|
||||
extern "C" {
|
||||
#include "../../core/windows/SDL_windows.h"
|
||||
@@ -46,8 +46,8 @@ static const wchar_t *SDL_GetWinRTFSPathUNICODE(SDL_WinRT_Path pathType)
|
||||
{
|
||||
static wstring path;
|
||||
if (path.empty()) {
|
||||
#if defined(NTDDI_WIN10_19H1) && (NTDDI_VERSION >= NTDDI_WIN10_19H1) && (WINAPI_FAMILY == WINAPI_FAMILY_PC_APP) /* Only PC supports mods */
|
||||
/* Windows 1903 supports mods, via the EffectiveLocation API */
|
||||
#if defined(NTDDI_WIN10_19H1) && (NTDDI_VERSION >= NTDDI_WIN10_19H1) && (WINAPI_FAMILY == WINAPI_FAMILY_PC_APP) // Only PC supports mods
|
||||
// Windows 1903 supports mods, via the EffectiveLocation API
|
||||
if (Windows::Foundation::Metadata::ApiInformation::IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8, 0)) {
|
||||
path = Windows::ApplicationModel::Package::Current->EffectiveLocation->Path->Data();
|
||||
} else {
|
||||
@@ -259,4 +259,4 @@ char *SDL_SYS_GetUserFolder(SDL_Folder folder)
|
||||
return WIN_StringToUTF8W(wpath.c_str());
|
||||
}
|
||||
|
||||
#endif /* SDL_PLATFORM_WINRT */
|
||||
#endif // SDL_PLATFORM_WINRT
|
||||
|
||||
Reference in New Issue
Block a user