Use EXIT_SUCCESS/FAILURE on windows too, for the exceedingly rare times that it actually matters.

This commit is contained in:
Shpoike 2023-09-02 07:23:56 +01:00
parent 73d8832318
commit 7b5d2745ed
1 changed files with 16 additions and 16 deletions

View File

@ -124,7 +124,7 @@ double Sys_DoubleTime (void)
void Sys_Quit (void) void Sys_Quit (void)
{ {
Host_Shutdown (); Host_Shutdown ();
exit(0); exit(EXIT_SUCCESS);
} }
void Sys_mkdir (const char *path) void Sys_mkdir (const char *path)
@ -900,7 +900,7 @@ DWORD CrashExceptionHandler (qboolean iswatchdog, DWORD exceptionCode, LPEXCEPTI
case IDYES: case IDYES:
break; //take a dump. break; //take a dump.
case IDNO: case IDNO:
exit(0); exit(EXIT_FAILURE);
default: //cancel = run the exception handler, which means we reset the watchdog. default: //cancel = run the exception handler, which means we reset the watchdog.
return EXCEPTION_EXECUTE_HANDLER; return EXCEPTION_EXECUTE_HANDLER;
} }
@ -950,7 +950,7 @@ LONG CALLBACK nonmsvc_CrashExceptionHandler(PEXCEPTION_POINTERS ExceptionInfo)
foo = CrashExceptionHandler(false, ExceptionInfo->ExceptionRecord->ExceptionCode, ExceptionInfo); foo = CrashExceptionHandler(false, ExceptionInfo->ExceptionRecord->ExceptionCode, ExceptionInfo);
//we have no handler. thus we handle it by exiting. //we have no handler. thus we handle it by exiting.
if (foo == EXCEPTION_EXECUTE_HANDLER) if (foo == EXCEPTION_EXECUTE_HANDLER)
exit(1); exit(EXIT_FAILURE);
return foo; return foo;
} }
@ -1687,7 +1687,7 @@ void VARGS Sys_Error (const char *error, ...)
OutputDebugStringA("Leaks detected\n"); OutputDebugStringA("Leaks detected\n");
#endif #endif
exit (1); exit (EXIT_FAILURE);
} }
void VARGS Sys_Printf (char *fmt, ...) void VARGS Sys_Printf (char *fmt, ...)
@ -1920,7 +1920,7 @@ void Sys_Quit (void)
OutputDebugStringA("Leaks detected\n"); OutputDebugStringA("Leaks detected\n");
#endif #endif
exit(1); exit(EXIT_SUCCESS);
} }
@ -4011,7 +4011,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
/* previous instances do not exist in Win32 */ /* previous instances do not exist in Win32 */
if (hPrevInstance) if (hPrevInstance)
return 0; return EXIT_FAILURE;
/* determine if we're on nt early, so we don't do the wrong thing when checking commandlines */ /* determine if we're on nt early, so we don't do the wrong thing when checking commandlines */
{ {
@ -4129,7 +4129,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
return thefunc(); return thefunc();
} }
MessageBox(NULL, "Unable to start up plugin wrapper", FULLENGINENAME, 0); MessageBox(NULL, "Unable to start up plugin wrapper", FULLENGINENAME, 0);
return 0; return EXIT_FAILURE;
} }
#endif #endif
@ -4154,7 +4154,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
if (c) if (c)
{ {
Sys_DoFileAssociations(1, (c+1 < com_argc)?com_argv[c+1]:NULL); Sys_DoFileAssociations(1, (c+1 < com_argc)?com_argv[c+1]:NULL);
return true; return EXIT_SUCCESS;
} }
/* /*
else if (!isPlugin) else if (!isPlugin)
@ -4185,7 +4185,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
if (COM_CheckParm("--version") || COM_CheckParm("-v")) if (COM_CheckParm("--version") || COM_CheckParm("-v"))
{ {
printf("version: %s\n", version_string()); printf("version: %s\n", version_string());
return true; return EXIT_SUCCESS;
} }
if (COM_CheckParm("-outputdebugstring")) if (COM_CheckParm("-outputdebugstring"))
debugout = true; debugout = true;
@ -4208,7 +4208,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
if (c) if (c)
{ {
Sys_MakeInstaller(parms.argv[c+1]); Sys_MakeInstaller(parms.argv[c+1]);
return true; return EXIT_SUCCESS;
} }
parms.manifest = Sys_FindManifest(); parms.manifest = Sys_FindManifest();
#endif #endif
@ -4240,14 +4240,14 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
if (SendMessage(old, WM_COPYDATA, (WPARAM)GetDesktopWindow(), (LPARAM)&cds)) if (SendMessage(old, WM_COPYDATA, (WPARAM)GetDesktopWindow(), (LPARAM)&cds))
{ {
Sleep(10*1000); //sleep for 10 secs so the real engine has a chance to open it, if the program that gave it is watching to see if we quit. Sleep(10*1000); //sleep for 10 secs so the real engine has a chance to open it, if the program that gave it is watching to see if we quit.
return 0; //message sent. return EXIT_SUCCESS; //message sent.
} }
} }
} }
else else
{ {
MessageBox(NULL, va("Invalid commandline:\n%s", lpCmdLine), FULLENGINENAME, 0); MessageBox(NULL, va("Invalid commandline:\n%s", lpCmdLine), FULLENGINENAME, 0);
return 0; return EXIT_FAILURE;
} }
GetModuleFileName(NULL, cwd, sizeof(cwd)-1); GetModuleFileName(NULL, cwd, sizeof(cwd)-1);
@ -4329,7 +4329,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
NET_Sleep(delay, false); NET_Sleep(delay, false);
delay = SV_Frame(); delay = SV_Frame();
} }
return TRUE; return EXIT_FAILURE;
} }
#endif #endif
@ -4353,7 +4353,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
{ {
SetHookState(false); SetHookState(false);
Host_Shutdown (); Host_Shutdown ();
return TRUE; return EXIT_FAILURE;
} }
} }
@ -4418,13 +4418,13 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
#ifdef MSVC_SEH #ifdef MSVC_SEH
__except (CrashExceptionHandler(false, GetExceptionCode(), GetExceptionInformation())) __except (CrashExceptionHandler(false, GetExceptionCode(), GetExceptionInformation()))
{ {
return 1; return EXIT_FAILURE;
} }
#endif #endif
#endif #endif
/* return success of application */ /* return success of application */
return TRUE; return EXIT_FAILURE;
} }
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma optimize( "", on) //revert back to default optimisations again. #pragma optimize( "", on) //revert back to default optimisations again.