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:
parent
658fc3db0f
commit
6501e90018
743 changed files with 11882 additions and 11882 deletions
|
@ -35,7 +35,7 @@
|
|||
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
#include <emscripten.h>
|
||||
/* older Emscriptens don't have this, but we need to for wasm64 compatibility. */
|
||||
// older Emscriptens don't have this, but we need to for wasm64 compatibility.
|
||||
#ifndef MAIN_THREAD_EM_ASM_PTR
|
||||
#ifdef __wasm64__
|
||||
#error You need to upgrade your Emscripten compiler to support wasm64
|
||||
|
@ -45,7 +45,7 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
/* The size of the stack buffer to use for rendering assert messages. */
|
||||
// The size of the stack buffer to use for rendering assert messages.
|
||||
#define SDL_MAX_ASSERT_MESSAGE_STACK 256
|
||||
|
||||
static SDL_AssertState SDLCALL SDL_PromptAssertion(const SDL_AssertData *data, void *userdata);
|
||||
|
@ -80,7 +80,7 @@ static void SDL_AddAssertionToReport(SDL_AssertData *data)
|
|||
/* (data) is always a static struct defined with the assert macros, so
|
||||
we don't have to worry about copying or allocating them. */
|
||||
data->trigger_count++;
|
||||
if (data->trigger_count == 1) { /* not yet added? */
|
||||
if (data->trigger_count == 1) { // not yet added?
|
||||
data->next = triggered_assertions;
|
||||
triggered_assertions = data;
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ static void SDL_GenerateAssertionReport(void)
|
|||
{
|
||||
const SDL_AssertData *item = triggered_assertions;
|
||||
|
||||
/* only do this if the app hasn't assigned an assertion handler. */
|
||||
// only do this if the app hasn't assigned an assertion handler.
|
||||
if ((item) && (assertion_handler != SDL_PromptAssertion)) {
|
||||
debug_print("\n\nSDL assertion report.\n");
|
||||
debug_print("All SDL assertions between last init/quit:\n\n");
|
||||
|
@ -168,12 +168,12 @@ static SDL_AssertState SDLCALL SDL_PromptAssertion(const SDL_AssertData *data, v
|
|||
size_t buf_len = sizeof(stack_buf);
|
||||
int len;
|
||||
|
||||
(void)userdata; /* unused in default handler. */
|
||||
(void)userdata; // unused in default handler.
|
||||
|
||||
/* Assume the output will fit... */
|
||||
// Assume the output will fit...
|
||||
len = SDL_RenderAssertMessage(message, buf_len, data);
|
||||
|
||||
/* .. and if it didn't, try to allocate as much room as we actually need. */
|
||||
// .. and if it didn't, try to allocate as much room as we actually need.
|
||||
if (len >= (int)buf_len) {
|
||||
if (SDL_size_add_overflow(len, 1, &buf_len) == 0) {
|
||||
message = (char *)SDL_malloc(buf_len);
|
||||
|
@ -185,7 +185,7 @@ static SDL_AssertState SDLCALL SDL_PromptAssertion(const SDL_AssertData *data, v
|
|||
}
|
||||
}
|
||||
|
||||
/* Something went very wrong */
|
||||
// Something went very wrong
|
||||
if (len < 0) {
|
||||
if (message != stack_buf) {
|
||||
SDL_free(message);
|
||||
|
@ -195,7 +195,7 @@ static SDL_AssertState SDLCALL SDL_PromptAssertion(const SDL_AssertData *data, v
|
|||
|
||||
debug_print("\n\n%s\n\n", message);
|
||||
|
||||
/* let env. variable override, so unit tests won't block in a GUI. */
|
||||
// let env. variable override, so unit tests won't block in a GUI.
|
||||
const char *hint = SDL_GetHint(SDL_HINT_ASSERT);
|
||||
if (hint) {
|
||||
if (message != stack_buf) {
|
||||
|
@ -213,23 +213,23 @@ static SDL_AssertState SDLCALL SDL_PromptAssertion(const SDL_AssertData *data, v
|
|||
} else if (SDL_strcmp(hint, "always_ignore") == 0) {
|
||||
return SDL_ASSERTION_ALWAYS_IGNORE;
|
||||
} else {
|
||||
return SDL_ASSERTION_ABORT; /* oh well. */
|
||||
return SDL_ASSERTION_ABORT; // oh well.
|
||||
}
|
||||
}
|
||||
|
||||
/* Leave fullscreen mode, if possible (scary!) */
|
||||
// Leave fullscreen mode, if possible (scary!)
|
||||
window = SDL_GetToplevelForKeyboardFocus();
|
||||
if (window) {
|
||||
if (window->fullscreen_exclusive) {
|
||||
SDL_MinimizeWindow(window);
|
||||
} else {
|
||||
/* !!! FIXME: ungrab the input if we're not fullscreen? */
|
||||
/* No need to mess with the window */
|
||||
// !!! FIXME: ungrab the input if we're not fullscreen?
|
||||
// No need to mess with the window
|
||||
window = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Show a messagebox if we can, otherwise fall back to stdio */
|
||||
// Show a messagebox if we can, otherwise fall back to stdio
|
||||
SDL_zero(messagebox);
|
||||
messagebox.flags = SDL_MESSAGEBOX_WARNING;
|
||||
messagebox.window = window;
|
||||
|
@ -246,10 +246,10 @@ static SDL_AssertState SDLCALL SDL_PromptAssertion(const SDL_AssertData *data, v
|
|||
}
|
||||
} else {
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
/* This is nasty, but we can't block on a custom UI. */
|
||||
// This is nasty, but we can't block on a custom UI.
|
||||
for (;;) {
|
||||
SDL_bool okay = SDL_TRUE;
|
||||
/* *INDENT-OFF* */ /* clang-format off */
|
||||
/* *INDENT-OFF* */ // clang-format off
|
||||
char *buf = (char *) MAIN_THREAD_EM_ASM_PTR({
|
||||
var str =
|
||||
UTF8ToString($0) + '\n\n' +
|
||||
|
@ -260,11 +260,11 @@ static SDL_AssertState SDLCALL SDL_PromptAssertion(const SDL_AssertData *data, v
|
|||
}
|
||||
return allocate(intArrayFromString(reply), 'i8', ALLOC_NORMAL);
|
||||
}, message);
|
||||
/* *INDENT-ON* */ /* clang-format on */
|
||||
/* *INDENT-ON* */ // clang-format on
|
||||
|
||||
if (SDL_strcmp(buf, "a") == 0) {
|
||||
state = SDL_ASSERTION_ABORT;
|
||||
#if 0 /* (currently) no break functionality on Emscripten */
|
||||
#if 0 // (currently) no break functionality on Emscripten
|
||||
} else if (SDL_strcmp(buf, "b") == 0) {
|
||||
state = SDL_ASSERTION_BREAK;
|
||||
#endif
|
||||
|
@ -277,14 +277,14 @@ static SDL_AssertState SDLCALL SDL_PromptAssertion(const SDL_AssertData *data, v
|
|||
} else {
|
||||
okay = SDL_FALSE;
|
||||
}
|
||||
free(buf); /* This should NOT be SDL_free() */
|
||||
free(buf); // This should NOT be SDL_free()
|
||||
|
||||
if (okay) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
#elif defined(HAVE_STDIO_H)
|
||||
/* this is a little hacky. */
|
||||
// this is a little hacky.
|
||||
for (;;) {
|
||||
char buf[32];
|
||||
(void)fprintf(stderr, "Abort/Break/Retry/Ignore/AlwaysIgnore? [abriA] : ");
|
||||
|
@ -310,10 +310,10 @@ static SDL_AssertState SDLCALL SDL_PromptAssertion(const SDL_AssertData *data, v
|
|||
break;
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_STDIO_H */
|
||||
#endif // HAVE_STDIO_H
|
||||
}
|
||||
|
||||
/* Re-enter fullscreen mode */
|
||||
// Re-enter fullscreen mode
|
||||
if (window) {
|
||||
SDL_RestoreWindow(window);
|
||||
}
|
||||
|
@ -333,19 +333,19 @@ SDL_AssertState SDL_ReportAssertion(SDL_AssertData *data, const char *func, cons
|
|||
#ifndef SDL_THREADS_DISABLED
|
||||
static SDL_SpinLock spinlock = 0;
|
||||
SDL_LockSpinlock(&spinlock);
|
||||
if (!assertion_mutex) { /* never called SDL_Init()? */
|
||||
if (!assertion_mutex) { // never called SDL_Init()?
|
||||
assertion_mutex = SDL_CreateMutex();
|
||||
if (!assertion_mutex) {
|
||||
SDL_UnlockSpinlock(&spinlock);
|
||||
return SDL_ASSERTION_IGNORE; /* oh well, I guess. */
|
||||
return SDL_ASSERTION_IGNORE; // oh well, I guess.
|
||||
}
|
||||
}
|
||||
SDL_UnlockSpinlock(&spinlock);
|
||||
|
||||
SDL_LockMutex(assertion_mutex);
|
||||
#endif /* !SDL_THREADS_DISABLED */
|
||||
#endif // !SDL_THREADS_DISABLED
|
||||
|
||||
/* doing this because Visual C is upset over assigning in the macro. */
|
||||
// doing this because Visual C is upset over assigning in the macro.
|
||||
if (data->trigger_count == 0) {
|
||||
data->function = func;
|
||||
data->filename = file;
|
||||
|
@ -355,13 +355,13 @@ SDL_AssertState SDL_ReportAssertion(SDL_AssertData *data, const char *func, cons
|
|||
SDL_AddAssertionToReport(data);
|
||||
|
||||
assertion_running++;
|
||||
if (assertion_running > 1) { /* assert during assert! Abort. */
|
||||
if (assertion_running > 1) { // assert during assert! Abort.
|
||||
if (assertion_running == 2) {
|
||||
SDL_AbortAssertion();
|
||||
} else if (assertion_running == 3) { /* Abort asserted! */
|
||||
} else if (assertion_running == 3) { // Abort asserted!
|
||||
SDL_ExitProcess(42);
|
||||
} else {
|
||||
while (1) { /* do nothing but spin; what else can you do?! */
|
||||
while (1) { // do nothing but spin; what else can you do?!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -379,11 +379,11 @@ SDL_AssertState SDL_ReportAssertion(SDL_AssertData *data, const char *func, cons
|
|||
case SDL_ASSERTION_IGNORE:
|
||||
case SDL_ASSERTION_RETRY:
|
||||
case SDL_ASSERTION_BREAK:
|
||||
break; /* macro handles these. */
|
||||
break; // macro handles these.
|
||||
|
||||
case SDL_ASSERTION_ABORT:
|
||||
SDL_AbortAssertion();
|
||||
/*break; ...shouldn't return, but oh well. */
|
||||
// break; ...shouldn't return, but oh well.
|
||||
}
|
||||
|
||||
assertion_running--;
|
||||
|
@ -405,7 +405,7 @@ void SDL_AssertionsQuit(void)
|
|||
assertion_mutex = NULL;
|
||||
}
|
||||
#endif
|
||||
#endif /* SDL_ASSERT_LEVEL > 0 */
|
||||
#endif // SDL_ASSERT_LEVEL > 0
|
||||
}
|
||||
|
||||
void SDL_SetAssertionHandler(SDL_AssertionHandler handler, void *userdata)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue