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:
Sam Lantinga
2024-08-22 10:30:45 -07:00
parent 658fc3db0f
commit 6501e90018
743 changed files with 11882 additions and 11882 deletions

View File

@@ -30,7 +30,7 @@ int SDL_RunApp(int argc, char* argv[], SDL_main_func mainFunction, void * reserv
if(!argv)
{
/* make sure argv isn't NULL, in case some user code doesn't like that */
// make sure argv isn't NULL, in case some user code doesn't like that
static char dummyargv0[] = { 'S', 'D', 'L', '_', 'a', 'p', 'p', '\0' };
static char* argvdummy[2] = { dummyargv0, NULL };
argc = 1;

View File

@@ -27,10 +27,10 @@ extern "C" {
}
#include <XGameRuntime.h>
#include <xsapi-c/services_c.h>
#include <shellapi.h> /* CommandLineToArgvW() */
#include <shellapi.h> // CommandLineToArgvW()
#include <appnotify.h>
/* Pop up an out of memory message, returns to Windows */
// Pop up an out of memory message, returns to Windows
static BOOL OutOfMemory(void)
{
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal Error", "Out of memory - aborting", NULL);
@@ -58,7 +58,7 @@ int SDL_RunApp(int, char**, SDL_main_func mainFunction, void *reserved)
* SDL_free() to use the same allocator after SDL_main() returns.
*/
/* Parse it into argv and argc */
// Parse it into argv and argc
argv = (char **)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (argc + 1) * sizeof(*argv));
if (argv == NULL) {
return OutOfMemory();
@@ -92,7 +92,7 @@ int SDL_RunApp(int, char**, SDL_main_func mainFunction, void *reserved)
XTaskQueueSetCurrentProcessTaskQueue(taskQueue);
/* Try to get the title ID and initialize Xbox Live */
// Try to get the title ID and initialize Xbox Live
hr = XGameGetXboxTitleId(&titleid);
if (SUCCEEDED(hr)) {
SDL_zero(xblArgs);
@@ -110,13 +110,13 @@ int SDL_RunApp(int, char**, SDL_main_func mainFunction, void *reserved)
return -1;
}
/* Run the application main() code */
// Run the application main() code
result = mainFunction(argc, argv);
GDK_UnregisterChangeNotifications();
/* !!! FIXME: This follows the docs exactly, but for some reason still leaks handles on exit? */
/* Terminate the task queue and dispatch any pending tasks */
// !!! FIXME: This follows the docs exactly, but for some reason still leaks handles on exit?
// Terminate the task queue and dispatch any pending tasks
XTaskQueueTerminate(taskQueue, false, nullptr, nullptr);
while (XTaskQueueDispatch(taskQueue, XTaskQueuePort::Completion, 0))
;
@@ -137,7 +137,7 @@ int SDL_RunApp(int, char**, SDL_main_func mainFunction, void *reserved)
result = -1;
}
/* Free argv, to avoid memory leak */
// Free argv, to avoid memory leak
for (i = 0; i < argc; ++i) {
HeapFree(GetProcessHeap(), 0, argv[i]);
}

View File

@@ -28,21 +28,21 @@
int SDL_RunApp(int argc, char* argv[], SDL_main_func mainFunction, void * reserved)
{
int result;
/* init */
// init
osSetSpeedupEnable(true);
romfsInit();
SDL_SetMainReady();
result = mainFunction(argc, argv);
/* quit */
// quit
romfsExit();
return result;
}
#ifdef __cplusplus
} /* extern "C" */
} // extern "C"
#endif
#endif

View File

@@ -20,25 +20,25 @@
int SDL_RunApp(int argc_, char* argv_[], SDL_main_func mainFunction, void * reserved)
{
(void)argc_; (void)argv_; (void)reserved;
/* Get the clean-up stack */
// Get the clean-up stack
CTrapCleanup *cleanup = CTrapCleanup::New();
/* Arrange for multi-threaded operation */
// Arrange for multi-threaded operation
SpawnPosixServerThread();
/* Get args and environment */
// Get args and environment
int argc = 0;
char **argv = 0;
char **envp = 0;
__crt0(argc, argv, envp);
/* Start the application! */
// Start the application!
/* Create stdlib */
// Create stdlib
_REENT;
/* Set process and thread priority and name */
// Set process and thread priority and name
RThread currentThread;
RProcess thisProcess;
@@ -48,7 +48,7 @@ int SDL_RunApp(int argc_, char* argv_[], SDL_main_func mainFunction, void * rese
currentThread.SetProcessPriority(EPriorityLow);
currentThread.SetPriority(EPriorityMuchLess);
/* Increase heap size */
// Increase heap size
RHeap *newHeap = NULL;
RHeap *oldHeap = NULL;
TInt heapSize = 7500000;
@@ -61,7 +61,7 @@ int SDL_RunApp(int argc_, char* argv_[], SDL_main_func mainFunction, void * rese
goto cleanup;
} else {
oldHeap = User::SwitchHeap(newHeap);
/* Call stdlib main */
// Call stdlib main
SDL_SetMainReady();
ret = mainFunction(argc, argv);
}

View File

@@ -23,7 +23,7 @@
#ifdef SDL_PLATFORM_PS2
/* SDL_RunApp() code for PS2 based on SDL_ps2_main.c, fjtrujy@gmail.com */
// SDL_RunApp() code for PS2 based on SDL_ps2_main.c, fjtrujy@gmail.com
#include <sys/types.h>
#include <sys/stat.h>
@@ -81,4 +81,4 @@ int SDL_RunApp(int argc, char* argv[], SDL_main_func mainFunction, void * reserv
return res;
}
#endif /* SDL_PLATFORM_PS2 */
#endif // SDL_PLATFORM_PS2

View File

@@ -23,7 +23,7 @@
#ifdef SDL_PLATFORM_PSP
/* SDL_RunApp() for PSP based on SDL_psp_main.c, placed in the public domain by Sam Lantinga 3/13/14 */
// SDL_RunApp() for PSP based on SDL_psp_main.c, placed in the public domain by Sam Lantinga 3/13/14
#include <pspkernel.h>
#include <pspthreadman.h>
@@ -79,4 +79,4 @@ int SDL_RunApp(int argc, char* argv[], SDL_main_func mainFunction, void * reserv
return mainFunction(argc, argv);
}
#endif /* SDL_PLATFORM_PSP */
#endif // SDL_PLATFORM_PSP

View File

@@ -27,9 +27,9 @@
/* Win32-specific SDL_RunApp(), which does most of the SDL_main work,
based on SDL_windows_main.c, placed in the public domain by Sam Lantinga 4/13/98 */
#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 OutOfMemory(void)
{
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal Error", "Out of memory - aborting", NULL);
@@ -57,7 +57,7 @@ int MINGW32_FORCEALIGN SDL_RunApp(int _argc, char* _argv[], SDL_main_func mainFu
* SDL_free() to use the same allocator after SDL_main() returns.
*/
/* Parse it into argv and argc */
// Parse it into argv and argc
argv = (char **)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (argc + 1) * sizeof(*argv));
if (!argv) {
return OutOfMemory();
@@ -84,10 +84,10 @@ int MINGW32_FORCEALIGN SDL_RunApp(int _argc, char* _argv[], SDL_main_func mainFu
SDL_SetMainReady();
/* Run the application main() code */
// Run the application main() code
result = mainFunction(argc, argv);
/* Free argv, to avoid memory leak */
// Free argv, to avoid memory leak
for (i = 0; i < argc; ++i) {
HeapFree(GetProcessHeap(), 0, argv[i]);
}
@@ -96,4 +96,4 @@ int MINGW32_FORCEALIGN SDL_RunApp(int _argc, char* _argv[], SDL_main_func mainFu
return result;
}
#endif /* SDL_PLATFORM_WIN32 */
#endif // SDL_PLATFORM_WIN32