From aab4fde468f646b2269cd8533779673ea9935e4a Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 18 Sep 2000 16:42:05 -0300 Subject: [PATCH] changes by lhf --- lundump.c | 19 ++++++++----------- lundump.h | 2 +- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/lundump.c b/lundump.c index d8f74758..642971d9 100644 --- a/lundump.c +++ b/lundump.c @@ -1,5 +1,5 @@ /* -** $Id: lundump.c,v 1.28 2000/09/11 17:38:42 roberto Exp roberto $ +** $Id: lundump.c,v 1.29 2000/06/28 14:12:55 lhf Exp lhf $ ** load bytecodes from files ** See Copyright Notice in lua.h */ @@ -43,7 +43,7 @@ static void ezread (lua_State* L, ZIO* Z, void* b, int n) static void LoadReverse (lua_State* L, void* b, size_t size, ZIO* Z) { - unsigned char *p=(unsigned char *) b+size; + char *p=(char *) b+size; int n=size; while (n--) *p--=ezgetc(L,Z); } @@ -221,17 +221,14 @@ static Proto* LoadChunk (lua_State* L, ZIO* Z) */ Proto* luaU_undump (lua_State* L, ZIO* Z) { + Proto* tf=NULL; int c=zgetc(Z); if (c==ID_CHUNK) - return LoadChunk(L,Z); - else if (c!=EOZ) - luaO_verror(L,"`%.255s' is not a precompiled Lua chunk",ZNAME(Z)); - return NULL; -} - -Proto* luaU_undump1 (lua_State* L, ZIO* Z) -{ - return luaU_undump(L,Z); + tf=LoadChunk(L,Z); + c=zgetc(Z); + if (c!=EOZ) + luaO_verror(L,"`%.255s' apparently contains more than one chunk",ZNAME(Z)); + return tf; } /* diff --git a/lundump.h b/lundump.h index debe0b7a..22e4c8c7 100644 --- a/lundump.h +++ b/lundump.h @@ -12,7 +12,7 @@ /* load one chunk */ Proto* luaU_undump (lua_State* L, ZIO* Z); -Proto* luaU_undump1 (lua_State* L, ZIO* Z); +#define luaU_undump1 luaU_undump /* find byte order */ int luaU_endianess (void);