diff options
-rw-r--r-- | lundump.c | 19 | ||||
-rw-r--r-- | lundump.h | 2 |
2 files changed, 9 insertions, 12 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lundump.c,v 1.28 2000/09/11 17:38:42 roberto Exp roberto $ | 2 | ** $Id: lundump.c,v 1.29 2000/06/28 14:12:55 lhf Exp lhf $ |
3 | ** load bytecodes from files | 3 | ** load bytecodes from files |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -43,7 +43,7 @@ static void ezread (lua_State* L, ZIO* Z, void* b, int n) | |||
43 | 43 | ||
44 | static void LoadReverse (lua_State* L, void* b, size_t size, ZIO* Z) | 44 | static void LoadReverse (lua_State* L, void* b, size_t size, ZIO* Z) |
45 | { | 45 | { |
46 | unsigned char *p=(unsigned char *) b+size; | 46 | char *p=(char *) b+size; |
47 | int n=size; | 47 | int n=size; |
48 | while (n--) *p--=ezgetc(L,Z); | 48 | while (n--) *p--=ezgetc(L,Z); |
49 | } | 49 | } |
@@ -221,17 +221,14 @@ static Proto* LoadChunk (lua_State* L, ZIO* Z) | |||
221 | */ | 221 | */ |
222 | Proto* luaU_undump (lua_State* L, ZIO* Z) | 222 | Proto* luaU_undump (lua_State* L, ZIO* Z) |
223 | { | 223 | { |
224 | Proto* tf=NULL; | ||
224 | int c=zgetc(Z); | 225 | int c=zgetc(Z); |
225 | if (c==ID_CHUNK) | 226 | if (c==ID_CHUNK) |
226 | return LoadChunk(L,Z); | 227 | tf=LoadChunk(L,Z); |
227 | else if (c!=EOZ) | 228 | c=zgetc(Z); |
228 | luaO_verror(L,"`%.255s' is not a precompiled Lua chunk",ZNAME(Z)); | 229 | if (c!=EOZ) |
229 | return NULL; | 230 | luaO_verror(L,"`%.255s' apparently contains more than one chunk",ZNAME(Z)); |
230 | } | 231 | return tf; |
231 | |||
232 | Proto* luaU_undump1 (lua_State* L, ZIO* Z) | ||
233 | { | ||
234 | return luaU_undump(L,Z); | ||
235 | } | 232 | } |
236 | 233 | ||
237 | /* | 234 | /* |
@@ -12,7 +12,7 @@ | |||
12 | 12 | ||
13 | /* load one chunk */ | 13 | /* load one chunk */ |
14 | Proto* luaU_undump (lua_State* L, ZIO* Z); | 14 | Proto* luaU_undump (lua_State* L, ZIO* Z); |
15 | Proto* luaU_undump1 (lua_State* L, ZIO* Z); | 15 | #define luaU_undump1 luaU_undump |
16 | 16 | ||
17 | /* find byte order */ | 17 | /* find byte order */ |
18 | int luaU_endianess (void); | 18 | int luaU_endianess (void); |