From 4a3352a5fcb01666e91bc21cea2900637caf674c Mon Sep 17 00:00:00 2001 From: pixel Date: Sun, 7 Dec 2003 05:50:41 +0000 Subject: Bugfixes.... --- lib/BLua.cc | 19 ++++++++++++------- lib/Handle.cc | 11 ++++++++++- lib/Input.cc | 6 ++++-- 3 files changed, 26 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/BLua.cc b/lib/BLua.cc index 9e5373e..c3f7351 100644 --- a/lib/BLua.cc +++ b/lib/BLua.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: BLua.cc,v 1.8 2003-12-07 04:44:38 pixel Exp $ */ +/* $Id: BLua.cc,v 1.9 2003-12-07 05:50:41 pixel Exp $ */ #include @@ -33,7 +33,8 @@ class LuaStatics : public Base { public: static const char * getF(lua_State *, void *, size_t *); static int putF(lua_State *, const void *, size_t, void *); - static int luapanic(lua_State *) throw(GeneralException); + static int luapanic(lua_State *); + static int trueluapanic(lua_State *) throw(GeneralException); static int destructor(lua_State *); static int andB(lua_State *); @@ -45,7 +46,11 @@ class LuaStatics : public Base { std::map Lua::lualist; -int LuaStatics::luapanic(lua_State * L) throw (GeneralException) { +int LuaStatics::luapanic(lua_State * L) { + return trueluapanic(L); +} + +int LuaStatics::trueluapanic(lua_State * L) throw (GeneralException) { Lua::find(L)->showerror(); throw LuaException("Error running Lua code, bailing out."); } @@ -437,10 +442,10 @@ void Lua::showerror() { t.set("(Number) %f", lua_tonumber(L, i)); break; case LUA_TBOOLEAN: - t.set("(Bool) %s", lua_toboolean(L, i) ? "true" : "false"); + t = String("(Bool) ") + (lua_toboolean(L, i) ? "true" : "false"); break; case LUA_TSTRING: - t.set("(String) %s", lua_tostring(L, i)); + t = String("(String) ") + lua_tostring(L, i); break; case LUA_TTABLE: t = "(Table)"; @@ -499,13 +504,13 @@ void LuaObject::pushit(Lua * L, const String & s, lua_CFunction f) { } void LuaObject::pushmeta(Lua * L, const String & s, lua_CFunction f) { - if (!L->getmetatable(1)) { + if (!L->getmetatable()) { L->newtable(); } L->push(s); L->push(f); L->settable(); - L->setmetatable(1); + L->setmetatable(); } int LuaStatics::destructor(lua_State * _L) { diff --git a/lib/Handle.cc b/lib/Handle.cc index 68724aa..d18a2e4 100644 --- a/lib/Handle.cc +++ b/lib/Handle.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: Handle.cc,v 1.63 2003-12-04 04:09:02 pixel Exp $ */ +/* $Id: Handle.cc,v 1.64 2003-12-07 05:50:41 pixel Exp $ */ #include #include @@ -90,6 +90,10 @@ int Handle::GetHandle() { return h; } +void * Handle::GetHFile() { + return hFile; +} + int Handle::GetHandle() const { return h; } @@ -558,6 +562,11 @@ void * Handle::mmap(off_t offset, size_t length) throw (GeneralException) { if (h == -1) { throw GeneralException("Can't mmap() a virtual handle"); } +#ifdef _WIN32 + if (!hFile) { + throw GeneralException("Can't mmap() a non-hFile handle under windows"); + } +#endif if (mapped) { throw GeneralException("Handle already mmap()ped"); } diff --git a/lib/Input.cc b/lib/Input.cc index b4dfb85..3f2fe21 100644 --- a/lib/Input.cc +++ b/lib/Input.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: Input.cc,v 1.37 2003-12-04 04:09:02 pixel Exp $ */ +/* $Id: Input.cc,v 1.38 2003-12-07 05:50:41 pixel Exp $ */ #include #include @@ -121,6 +121,7 @@ Input::Input(const String & no) throw (GeneralException) : date_modif = 0; SetZ(); fromarchive = true; + itell = 0; } } @@ -183,7 +184,8 @@ int Input::wrapopen(const String & fname, openresults_t * results) { printm(M_BARE, _("Trying to open the file in archive, since it seems to be here\n")); #endif #ifdef _WIN32 - hFile = t->GetHandle(); +// hFile = t->GetHandle()->GetHFile(); + hFile = 0; #endif return t->open(fname, results); } -- cgit v1.2.3