changes by lhf

This commit is contained in:
Roberto Ierusalimschy 2000-09-18 16:42:05 -03:00
parent 6ec4a0ef76
commit aab4fde468
2 changed files with 9 additions and 12 deletions

View File

@ -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 ** load bytecodes from files
** See Copyright Notice in lua.h ** 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) 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; int n=size;
while (n--) *p--=ezgetc(L,Z); 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* luaU_undump (lua_State* L, ZIO* Z)
{ {
Proto* tf=NULL;
int c=zgetc(Z); int c=zgetc(Z);
if (c==ID_CHUNK) if (c==ID_CHUNK)
return LoadChunk(L,Z); tf=LoadChunk(L,Z);
else if (c!=EOZ) c=zgetc(Z);
luaO_verror(L,"`%.255s' is not a precompiled Lua chunk",ZNAME(Z)); if (c!=EOZ)
return NULL; luaO_verror(L,"`%.255s' apparently contains more than one chunk",ZNAME(Z));
} return tf;
Proto* luaU_undump1 (lua_State* L, ZIO* Z)
{
return luaU_undump(L,Z);
} }
/* /*

View File

@ -12,7 +12,7 @@
/* load one chunk */ /* load one chunk */
Proto* luaU_undump (lua_State* L, ZIO* Z); Proto* luaU_undump (lua_State* L, ZIO* Z);
Proto* luaU_undump1 (lua_State* L, ZIO* Z); #define luaU_undump1 luaU_undump
/* find byte order */ /* find byte order */
int luaU_endianess (void); int luaU_endianess (void);