summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lundump.c19
-rw-r--r--lundump.h2
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 @@
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
44static void LoadReverse (lua_State* L, void* b, size_t size, ZIO* Z) 44static 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*/
222Proto* luaU_undump (lua_State* L, ZIO* Z) 222Proto* 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
232Proto* luaU_undump1 (lua_State* L, ZIO* Z)
233{
234 return luaU_undump(L,Z);
235} 232}
236 233
237/* 234/*
diff --git a/lundump.h b/lundump.h
index debe0b7a..22e4c8c7 100644
--- a/lundump.h
+++ b/lundump.h
@@ -12,7 +12,7 @@
12 12
13/* load one chunk */ 13/* load one chunk */
14Proto* luaU_undump (lua_State* L, ZIO* Z); 14Proto* luaU_undump (lua_State* L, ZIO* Z);
15Proto* luaU_undump1 (lua_State* L, ZIO* Z); 15#define luaU_undump1 luaU_undump
16 16
17/* find byte order */ 17/* find byte order */
18int luaU_endianess (void); 18int luaU_endianess (void);