aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/modular-backend.cpp6
-rw-r--r--backends/modular-backend.h3
-rw-r--r--backends/platform/sdl/sdl.cpp1
-rw-r--r--engines/agi/loader_v2.cpp4
-rw-r--r--engines/sci/console.cpp2
-rw-r--r--engines/sword25/util/lua/ldo.cpp4
-rw-r--r--engines/sword25/util/lua/loslib.cpp8
7 files changed, 18 insertions, 10 deletions
diff --git a/backends/modular-backend.cpp b/backends/modular-backend.cpp
index fe3991af65..c5f147ffe1 100644
--- a/backends/modular-backend.cpp
+++ b/backends/modular-backend.cpp
@@ -20,6 +20,8 @@
*
*/
+#define FORBIDDEN_SYMBOL_EXCEPTION_exit
+
#include "backends/modular-backend.h"
#include "backends/fs/fs-factory.h"
@@ -277,3 +279,7 @@ FilesystemFactory *ModularBackend::getFilesystemFactory() {
assert(_fsFactory);
return _fsFactory;
}
+
+void ModularBackend::quit() {
+ exit(0);
+}
diff --git a/backends/modular-backend.h b/backends/modular-backend.h
index 43148b6e4a..e46fbfdd21 100644
--- a/backends/modular-backend.h
+++ b/backends/modular-backend.h
@@ -148,8 +148,7 @@ public:
virtual Common::SaveFileManager *getSavefileManager();
virtual FilesystemFactory *getFilesystemFactory();
- virtual void quit() { exit(0); }
- virtual void setWindowCaption(const char *caption) {}
+ virtual void quit();
virtual void displayMessageOnOSD(const char *msg);
//@}
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index 5cb409794b..a3fb719ca4 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -21,6 +21,7 @@
*/
#define FORBIDDEN_SYMBOL_EXCEPTION_time_h
+#define FORBIDDEN_SYMBOL_EXCEPTION_exit
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
diff --git a/engines/agi/loader_v2.cpp b/engines/agi/loader_v2.cpp
index f5f8830b43..a2ac6f0111 100644
--- a/engines/agi/loader_v2.cpp
+++ b/engines/agi/loader_v2.cpp
@@ -149,11 +149,11 @@ uint8 *AgiLoader_v2::loadVolRes(struct AgiDir *agid) {
fp.read(&x, 5);
if ((sig = READ_BE_UINT16((uint8 *) x)) == 0x1234) {
agid->len = READ_LE_UINT16((uint8 *) x + 3);
- data = (uint8 *) calloc(1, agid->len + 32);
+ data = (uint8 *)calloc(1, agid->len + 32);
if (data != NULL) {
fp.read(data, agid->len);
} else {
- exit(1);
+ error("AgiLoader_v2::loadVolRes out of memory");
}
} else {
warning("AgiLoader_v2::loadVolRes: bad signature %04x", sig);
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index 5f5af195b5..e6b5c3c1d4 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -3372,7 +3372,7 @@ bool Console::cmdQuit(int argc, const char **argv) {
} else if (!scumm_stricmp(argv[1], "now")) {
// Quit ungracefully
- exit(0);
+ g_system->quit();
}
return Cmd_Exit(0, 0);
diff --git a/engines/sword25/util/lua/ldo.cpp b/engines/sword25/util/lua/ldo.cpp
index b03992385a..b699c5d8a7 100644
--- a/engines/sword25/util/lua/ldo.cpp
+++ b/engines/sword25/util/lua/ldo.cpp
@@ -13,6 +13,8 @@
#define FORBIDDEN_SYMBOL_EXCEPTION_setjmp
#define FORBIDDEN_SYMBOL_EXCEPTION_longjmp
+#include "common/textconsole.h"
+
#include <setjmp.h>
#include <stdlib.h>
#include <string.h>
@@ -116,7 +118,7 @@ void luaD_throw (lua_State *L, int errcode) {
lua_unlock(L);
G(L)->panic(L);
}
- exit(EXIT_FAILURE);
+ error("luaD_throw failure");
}
}
diff --git a/engines/sword25/util/lua/loslib.cpp b/engines/sword25/util/lua/loslib.cpp
index c46aea59bd..b61f8c65e1 100644
--- a/engines/sword25/util/lua/loslib.cpp
+++ b/engines/sword25/util/lua/loslib.cpp
@@ -18,6 +18,7 @@
#include "lualib.h"
#include "common/system.h"
+#include "common/textconsole.h"
static int os_execute (lua_State *L) {
@@ -214,10 +215,9 @@ static int os_exit (lua_State *L) {
// Using OSystem::quit() isn't really a great idea, either.
// We really would prefer to let the main run loop exit, so that
// our main() can perform cleanup.
- g_system->quit();
- // leave the exit call in there for now, in case some of our
- // OSystem::quit applications are incorrect... *sigh*
- exit(luaL_optint(L, 1, EXIT_SUCCESS));
+ if (0 == luaL_optint(L, 1, EXIT_SUCCESS))
+ g_system->quit();
+ error("LUA os_exit invokes with non-zero exit value");
}
static const luaL_Reg syslib[] = {