- some reformatting on exit code, mainly to make searching for the content easier.

# Conflicts:
#	libraries/asmjit/asmjit/core/compiler.h
#	libraries/glslang/spirv/SpvBuilder.h
#	src/posix/sdl/hardware.cpp
#	src/rendering/v_video.cpp
#	src/win32/hardware.cpp
#	src/win32/i_main.cpp
This commit is contained in:
Christoph Oelckers 2019-10-01 19:06:28 +02:00 committed by drfrag
parent fcfff6f6f6
commit 55831a264a
23 changed files with 56 additions and 48 deletions

View file

@ -106,12 +106,12 @@ bool CheckCheatmode (bool printmsg)
CCMD (quit) CCMD (quit)
{ {
if (!insave) exit (0); if (!insave) exit(0);
} }
CCMD (exit) CCMD (exit)
{ {
if (!insave) exit (0); if (!insave) exit(0);
} }
/* /*

View file

@ -1625,7 +1625,7 @@ void D_ArbitrateNetStart (void)
StartScreen->NetInit ("Exchanging game information", 1); StartScreen->NetInit ("Exchanging game information", 1);
if (!StartScreen->NetLoop (DoArbitrate, &data)) if (!StartScreen->NetLoop (DoArbitrate, &data))
{ {
exit (0); exit(0);
} }
if (consoleplayer == Net_Arbitrator) if (consoleplayer == Net_Arbitrator)

View file

@ -212,7 +212,7 @@ static int cregcmp (const void *a, const void *b) NO_SANITIZE
void PClass::StaticInit () void PClass::StaticInit ()
{ {
atterm (StaticShutdown); atterm(StaticShutdown);
Namespaces.GlobalNamespace = Namespaces.NewNamespace(0); Namespaces.GlobalNamespace = Namespaces.NewNamespace(0);

View file

@ -439,7 +439,7 @@ void StartNetwork (bool autoPort)
} }
#endif #endif
atterm (CloseNetwork); atterm(CloseNetwork);
netgame = true; netgame = true;
multiplayer = true; multiplayer = true;
@ -693,14 +693,14 @@ void HostGame (int i)
doomcom.numnodes = 1; doomcom.numnodes = 1;
atterm (SendAbort); atterm(SendAbort);
StartScreen->NetInit ("Waiting for players", numplayers); StartScreen->NetInit ("Waiting for players", numplayers);
// Wait for numplayers-1 different connections // Wait for numplayers-1 different connections
if (!StartScreen->NetLoop (Host_CheckForConnects, (void *)(intptr_t)numplayers)) if (!StartScreen->NetLoop (Host_CheckForConnects, (void *)(intptr_t)numplayers))
{ {
exit (0); exit(0);
} }
// Now inform everyone of all machines involved in the game // Now inform everyone of all machines involved in the game
@ -710,7 +710,7 @@ void HostGame (int i)
if (!StartScreen->NetLoop (Host_SendAllHere, (void *)gotack)) if (!StartScreen->NetLoop (Host_SendAllHere, (void *)gotack))
{ {
exit (0); exit(0);
} }
popterm (); popterm ();
@ -862,20 +862,20 @@ void JoinGame (int i)
sendplayer[1] = 0; sendplayer[1] = 0;
doomcom.numnodes = 2; doomcom.numnodes = 2;
atterm (SendAbort); atterm(SendAbort);
// Let host know we are here // Let host know we are here
StartScreen->NetInit ("Contacting host", 0); StartScreen->NetInit ("Contacting host", 0);
if (!StartScreen->NetLoop (Guest_ContactHost, NULL)) if (!StartScreen->NetLoop (Guest_ContactHost, NULL))
{ {
exit (0); exit(0);
} }
// Wait for everyone else to connect // Wait for everyone else to connect
if (!StartScreen->NetLoop (Guest_WaitForOthers, 0)) if (!StartScreen->NetLoop (Guest_WaitForOthers, 0))
{ {
exit (0); exit(0);
} }
popterm (); popterm ();

View file

@ -338,7 +338,7 @@ void M_LoadDefaults ()
{ {
GameConfig = new FGameConfigFile; GameConfig = new FGameConfigFile;
GameConfig->DoGlobalSetup (); GameConfig->DoGlobalSetup ();
atterm (M_SaveDefaultsFinal); atterm(M_SaveDefaultsFinal);
} }

View file

@ -3874,7 +3874,7 @@ void P_SetupLevel(const char *lumpname, int position, bool newGame)
// //
void P_Init () void P_Init ()
{ {
atterm (P_Shutdown); atterm(P_Shutdown);
P_InitEffects (); // [RH] P_InitEffects (); // [RH]
P_InitTerrainTypes (); P_InitTerrainTypes ();

View file

@ -499,7 +499,7 @@ int main(int argc, char** argv)
CreateMenu(); CreateMenu();
atterm(ReleaseApplicationController); atexit(ReleaseApplicationController);
appCtrl = [ApplicationController new]; appCtrl = [ApplicationController new];
[NSApp setDelegate:appCtrl]; [NSApp setDelegate:appCtrl];

View file

@ -129,7 +129,7 @@ void I_InitGraphics ()
if (Video == NULL) if (Video == NULL)
I_FatalError ("Failed to initialize display"); I_FatalError ("Failed to initialize display");
atterm (I_ShutdownGraphics); atterm(I_ShutdownGraphics);
Video->SetWindowedScale (vid_winscale); Video->SetWindowedScale (vid_winscale);
} }

View file

@ -303,7 +303,7 @@ void MessagePump (const SDL_Event &sev)
switch (sev.type) switch (sev.type)
{ {
case SDL_QUIT: case SDL_QUIT:
exit (0); exit(0);
case SDL_WINDOWEVENT: case SDL_WINDOWEVENT:
switch (sev.window.event) switch (sev.window.event)

View file

@ -242,7 +242,7 @@ int main (int argc, char **argv)
} }
} }
exit (-1); return -1;
} }
catch (...) catch (...)
{ {

View file

@ -112,7 +112,7 @@ void I_Init (void)
CheckCPUID (&CPU); CheckCPUID (&CPU);
DumpCPUInfo (&CPU); DumpCPUInfo (&CPU);
atterm (I_ShutdownSound); atterm(I_ShutdownSound);
I_InitSound (); I_InitSound ();
} }
@ -185,7 +185,7 @@ void I_FatalError (const char *error, va_list ap)
} }
// throw CFatalError (errortext); // throw CFatalError (errortext);
fprintf (stderr, "%s\n", errortext); fprintf (stderr, "%s\n", errortext);
exit (-1); exit(-1);
} }
std::terminate(); std::terminate();
} }

View file

@ -403,7 +403,7 @@ subsector_t *R_PointInSubsector (fixed_t x, fixed_t y)
void R_Init () void R_Init ()
{ {
atterm (R_Shutdown); atterm(R_Shutdown);
StartScreen->Progress(); StartScreen->Progress();
// Colormap init moved back to InitPalette() // Colormap init moved back to InitPalette()

View file

@ -993,7 +993,7 @@ void S_ParseSndInfo (bool redefine)
int lump; int lump;
if (!redefine) SavedPlayerSounds.Clear(); // clear skin sounds only for initial parsing. if (!redefine) SavedPlayerSounds.Clear(); // clear skin sounds only for initial parsing.
atterm (S_ClearSoundData); atterm(S_ClearSoundData);
S_ClearSoundData(); // remove old sound data first! S_ClearSoundData(); // remove old sound data first!
CurrentPitchMask = 0; CurrentPitchMask = 0;

View file

@ -645,7 +645,7 @@ void S_ParseReverbDef ()
{ {
int lump, lastlump = 0; int lump, lastlump = 0;
atterm (S_UnloadReverbDef); atterm(S_UnloadReverbDef);
S_UnloadReverbDef (); S_UnloadReverbDef ();
while ((lump = Wads.FindLump ("REVERBS", &lastlump)) != -1) while ((lump = Wads.FindLump ("REVERBS", &lastlump)) != -1)

View file

@ -306,7 +306,7 @@ void S_Init ()
{ {
int curvelump; int curvelump;
atterm (S_Shutdown); atterm(S_Shutdown);
// Heretic and Hexen have sound curve lookup tables. Doom does not. // Heretic and Hexen have sound curve lookup tables. Doom does not.
curvelump = Wads.CheckNumForName ("SNDCURVE"); curvelump = Wads.CheckNumForName ("SNDCURVE");

View file

@ -1501,7 +1501,7 @@ void V_Init (bool restart)
const char *i; const char *i;
int width, height, bits; int width, height, bits;
atterm (V_Shutdown); atterm(V_Shutdown);
// [RH] Initialize palette management // [RH] Initialize palette management
InitPalette (); InitPalette ();

View file

@ -191,7 +191,7 @@ void I_InitGraphics ()
if (Video == NULL) if (Video == NULL)
I_FatalError ("Failed to initialize display"); I_FatalError ("Failed to initialize display");
atterm (I_ShutdownGraphics); atterm(I_ShutdownGraphics);
Video->SetWindowedScale (vid_winscale); Video->SetWindowedScale (vid_winscale);
} }

View file

@ -451,7 +451,7 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_DESTROY: case WM_DESTROY:
SetPriorityClass (GetCurrentProcess(), NORMAL_PRIORITY_CLASS); SetPriorityClass (GetCurrentProcess(), NORMAL_PRIORITY_CLASS);
//PostQuitMessage (0); //PostQuitMessage (0);
exit (0); exit(0);
break; break;
case WM_HOTKEY: case WM_HOTKEY:
@ -659,7 +659,7 @@ bool I_InitInput (void *hwnd)
HRESULT hr; HRESULT hr;
Printf ("I_InitInput\n"); Printf ("I_InitInput\n");
atterm (I_ShutdownInput); atterm(I_ShutdownInput);
noidle = !!Args->CheckParm ("-noidle"); noidle = !!Args->CheckParm ("-noidle");
g_pdi = NULL; g_pdi = NULL;
@ -787,7 +787,7 @@ void I_GetEvent ()
while (PeekMessage (&mess, NULL, 0, 0, PM_REMOVE)) while (PeekMessage (&mess, NULL, 0, 0, PM_REMOVE))
{ {
if (mess.message == WM_QUIT) if (mess.message == WM_QUIT)
exit (mess.wParam); exit(mess.wParam);
if (GUICapture) if (GUICapture)
{ {

View file

@ -954,7 +954,10 @@ void DoMain (HINSTANCE hInstance)
NULL); NULL);
if (!Window) if (!Window)
I_FatalError ("Could not open window"); {
MessageBoxA(nullptr, "Unable to create main window", "Fatal", MB_ICONEXCLAMATION|MB_OK);
exit(-1);
}
if (kernel != NULL) if (kernel != NULL)
{ {
@ -1039,7 +1042,7 @@ void DoMain (HINSTANCE hInstance)
Printf("%s\n", msg); Printf("%s\n", msg);
} }
} }
exit (-1); exit(-1);
} }
} }
@ -1152,7 +1155,7 @@ void CALLBACK ExitFatally (ULONG_PTR dummy)
I_ShutdownGraphics (); I_ShutdownGraphics ();
RestoreConView (); RestoreConView ();
DisplayCrashLog (); DisplayCrashLog ();
exit (-1); exit(-1);
} }
//========================================================================== //==========================================================================
@ -1252,7 +1255,7 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE nothing, LPWSTR cmdline, int
// don't support Windows 95, we have no obligation to provide assistance in // don't support Windows 95, we have no obligation to provide assistance in
// getting it installed. // getting it installed.
MessageBoxA(NULL, "Could not load riched20.dll", GAMENAME " Error", MB_OK | MB_ICONSTOP); MessageBoxA(NULL, "Could not load riched20.dll", GAMENAME " Error", MB_OK | MB_ICONSTOP);
exit(0); return 0;
} }
#if !defined(__GNUC__) && defined(_DEBUG) #if !defined(__GNUC__) && defined(_DEBUG)
@ -1267,7 +1270,7 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE nothing, LPWSTR cmdline, int
{ {
} }
DisplayCrashLog (); DisplayCrashLog ();
exit (0); return 0;
} }
if (__argc == 2 && __wargv != nullptr && wcscmp (__wargv[1], L"TestStackCrash") == 0) if (__argc == 2 && __wargv != nullptr && wcscmp (__wargv[1], L"TestStackCrash") == 0)
{ {
@ -1280,7 +1283,7 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE nothing, LPWSTR cmdline, int
{ {
} }
DisplayCrashLog (); DisplayCrashLog ();
exit (0); return 0;
} }
#endif #endif

View file

@ -353,7 +353,7 @@ void I_Init()
CalculateCPUSpeed(); CalculateCPUSpeed();
DumpCPUInfo(&CPU); DumpCPUInfo(&CPU);
atterm (I_ShutdownSound); atterm(I_ShutdownSound);
I_InitSound (); I_InitSound ();
} }

View file

@ -1346,13 +1346,11 @@ void FStrifeStartupScreen::DrawStuff(int old_laser, int new_laser)
// //
//========================================================================== //==========================================================================
void ST_Endoom() int RunEndoom()
{ {
if (showendoom == 0) exit(0); if (showendoom == 0 || gameinfo.Endoom.Len() == 0)
if (gameinfo.Endoom.Len() == 0)
{ {
exit(0); return 0;
} }
int endoom_lump = Wads.CheckNumForFullName (gameinfo.Endoom, true); int endoom_lump = Wads.CheckNumForFullName (gameinfo.Endoom, true);
@ -1366,25 +1364,25 @@ void ST_Endoom()
if (endoom_lump < 0 || Wads.LumpLength (endoom_lump) != 4000) if (endoom_lump < 0 || Wads.LumpLength (endoom_lump) != 4000)
{ {
exit(0); return 0;
} }
if (Wads.GetLumpFile(endoom_lump) == Wads.GetIwadNum() && showendoom == 2) if (Wads.GetLumpFile(endoom_lump) == Wads.GetIwadNum() && showendoom == 2)
{ {
// showendoom==2 means to show only lumps from PWADs. // showendoom==2 means to show only lumps from PWADs.
exit(0); return 0;
} }
font = ST_Util_LoadFont (TEXT_FONT_NAME); font = ST_Util_LoadFont (TEXT_FONT_NAME);
if (font == NULL) if (font == NULL)
{ {
exit(0); return 0;
} }
if (!ST_Util_CreateStartupWindow()) if (!ST_Util_CreateStartupWindow())
{ {
ST_Util_FreeFont (font); ST_Util_FreeFont (font);
exit(0); return 0;
} }
I_ShutdownGraphics (); I_ShutdownGraphics ();
@ -1435,7 +1433,7 @@ void ST_Endoom()
} }
ST_Util_FreeBitmap (StartupBitmap); ST_Util_FreeBitmap (StartupBitmap);
ST_Util_FreeFont (font); ST_Util_FreeFont (font);
exit (int(bRet == 0 ? mess.wParam : 0)); return int(bRet == 0 ? mess.wParam : 0);
} }
else if (blinking && mess.message == WM_TIMER && mess.hwnd == Window && mess.wParam == 0x5A15A) else if (blinking && mess.message == WM_TIMER && mess.hwnd == Window && mess.wParam == 0x5A15A)
{ {
@ -1447,6 +1445,13 @@ void ST_Endoom()
} }
} }
void ST_Endoom()
{
int code = RunEndoom();
exit(code);
}
//========================================================================== //==========================================================================
// //
// ST_Util_CreateStartupWindow // ST_Util_CreateStartupWindow

View file

@ -131,14 +131,14 @@ void Skeleton::emit_data (const char * fname)
if (!input) if (!input)
{ {
error ("cannot open file: %s", input_name.c_str ()); error ("cannot open file: %s", input_name.c_str ());
exit (1); exit(1);
} }
const std::string keys_name = std::string (fname) + "." + name + ".keys"; const std::string keys_name = std::string (fname) + "." + name + ".keys";
FILE * keys = fopen (keys_name.c_str (), "wb"); FILE * keys = fopen (keys_name.c_str (), "wb");
if (!keys) if (!keys)
{ {
error ("cannot open file: %s", keys_name.c_str ()); error ("cannot open file: %s", keys_name.c_str ());
exit (1); exit(1);
} }
generate_paths (input, keys); generate_paths (input, keys);

View file

@ -116,7 +116,7 @@ Skeleton::Skeleton
if (maxlen == Node::DIST_MAX) if (maxlen == Node::DIST_MAX)
{ {
error ("DFA path %sis too long", incond (cond).c_str ()); error ("DFA path %sis too long", incond (cond).c_str ());
exit (1); exit(1);
} }
// calculate maximal rule rank (disregarding default and none rules) // calculate maximal rule rank (disregarding default and none rules)