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

@@ -40,4 +40,4 @@ int SDL_SYS_OpenURL(const char *url)
}
}
#endif /* SDL_PLATFORM_IOS || SDL_PLATFORM_TVOS */
#endif // SDL_PLATFORM_IOS || SDL_PLATFORM_TVOS

View File

@@ -36,4 +36,4 @@ int SDL_SYS_OpenURL(const char *url)
}
}
#endif /* SDL_PLATFORM_MACOS */
#endif // SDL_PLATFORM_MACOS

View File

@@ -36,34 +36,34 @@ extern char **environ;
int SDL_SYS_OpenURL(const char *url)
{
const pid_t pid1 = fork();
if (pid1 == 0) { /* child process */
if (pid1 == 0) { // child process
#ifdef USE_POSIX_SPAWN
pid_t pid2;
const char *args[] = { "xdg-open", url, NULL };
/* Clear LD_PRELOAD so Chrome opens correctly when this application is launched by Steam */
// Clear LD_PRELOAD so Chrome opens correctly when this application is launched by Steam
unsetenv("LD_PRELOAD");
if (posix_spawnp(&pid2, args[0], NULL, NULL, (char **)args, environ) == 0) {
/* Child process doesn't wait for possibly-blocking grandchild. */
// Child process doesn't wait for possibly-blocking grandchild.
_exit(EXIT_SUCCESS);
} else {
_exit(EXIT_FAILURE);
}
#else
pid_t pid2;
/* Clear LD_PRELOAD so Chrome opens correctly when this application is launched by Steam */
// Clear LD_PRELOAD so Chrome opens correctly when this application is launched by Steam
unsetenv("LD_PRELOAD");
/* Notice this is vfork and not fork! */
// Notice this is vfork and not fork!
pid2 = vfork();
if (pid2 == 0) { /* Grandchild process will try to launch the url */
if (pid2 == 0) { // Grandchild process will try to launch the url
execlp("xdg-open", "xdg-open", url, NULL);
_exit(EXIT_FAILURE);
} else if (pid2 < 0) { /* There was an error forking */
} else if (pid2 < 0) { // There was an error forking
_exit(EXIT_FAILURE);
} else {
/* Child process doesn't wait for possibly-blocking grandchild. */
// Child process doesn't wait for possibly-blocking grandchild.
_exit(EXIT_SUCCESS);
}
#endif /* USE_POSIX_SPAWN */
#endif // USE_POSIX_SPAWN
} else if (pid1 < 0) {
return SDL_SetError("fork() failed: %s", strerror(errno));
} else {
@@ -71,7 +71,7 @@ int SDL_SYS_OpenURL(const char *url)
if (waitpid(pid1, &status, 0) == pid1) {
if (WIFEXITED(status)) {
if (WEXITSTATUS(status) == 0) {
return 0; /* success! */
return 0; // success!
} else {
return SDL_SetError("xdg-open reported error or failed to launch: %d", WEXITSTATUS(status));
}

View File

@@ -28,17 +28,17 @@
#if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)
int SDL_SYS_OpenURL(const char *url)
{
/* Not supported */
// Not supported
return SDL_Unsupported();
}
#else
/* https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153%28v=vs.85%29.aspx */
// https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153%28v=vs.85%29.aspx
int SDL_SYS_OpenURL(const char *url)
{
WCHAR *wurl;
HINSTANCE rc;
/* MSDN says for safety's sake, make sure COM is initialized. */
// MSDN says for safety's sake, make sure COM is initialized.
const HRESULT hr = WIN_CoInitialize();
if (FAILED(hr)) {
return WIN_SetErrorFromHRESULT("CoInitialize failed", hr);
@@ -50,7 +50,7 @@ int SDL_SYS_OpenURL(const char *url)
return -1;
}
/* Success returns value greater than 32. Less is an error. */
// Success returns value greater than 32. Less is an error.
rc = ShellExecuteW(NULL, L"open", wurl, NULL, NULL, SW_SHOWNORMAL);
SDL_free(wurl);
WIN_CoUninitialize();