summaryrefslogtreecommitdiff
path: root/lib/lua/src/lundump.c
diff options
context:
space:
mode:
authorpixel <pixel>2008-09-23 16:28:53 +0000
committerpixel <pixel>2008-09-23 16:28:53 +0000
commit23bfd2d061c11a136aee6c639dec88077fcf7864 (patch)
treed561444a40fa241d8beabc804d98a6a75543390c /lib/lua/src/lundump.c
parent88a8ad8c7d83cf009b9ca6756e5b4fb5c333435e (diff)
Upgrading to lua 5.1.4
Diffstat (limited to 'lib/lua/src/lundump.c')
-rw-r--r--lib/lua/src/lundump.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/lua/src/lundump.c b/lib/lua/src/lundump.c
index 1dd1b01..ef46c7f 100644
--- a/lib/lua/src/lundump.c
+++ b/lib/lua/src/lundump.c
@@ -1,5 +1,5 @@
/*
-** $Id: lundump.c,v 1.6 2008-02-17 00:35:20 pixel Exp $
+** $Id: lundump.c,v 1.7 2008-09-23 16:28:53 pixel Exp $
** load precompiled Lua chunks
** See Copyright Notice in lua.h
*/
@@ -48,7 +48,6 @@ static void error(LoadState* S, const char* why)
static void LoadBlock(LoadState* S, void* b, size_t size)
{
size_t r=luaZ_read(S->Z,b,size);
- UNUSED(r);
IF (r!=0, "unexpected end");
}
@@ -115,7 +114,7 @@ static void LoadConstants(LoadState* S, Proto* f)
setnilvalue(o);
break;
case LUA_TBOOLEAN:
- setbvalue(o,LoadChar(S));
+ setbvalue(o,LoadChar(S)!=0);
break;
case LUA_TNUMBER:
setnvalue(o,LoadNumber(S));
@@ -161,7 +160,9 @@ static void LoadDebug(LoadState* S, Proto* f)
static Proto* LoadFunction(LoadState* S, TString* p)
{
- Proto* f=luaF_newproto(S->L);
+ Proto* f;
+ if (++S->L->nCcalls > LUAI_MAXCCALLS) error(S,"code too deep");
+ f=luaF_newproto(S->L);
setptvalue2s(S->L,S->L->top,f); incr_top(S->L);
f->source=LoadString(S); if (f->source==NULL) f->source=p;
f->linedefined=LoadInt(S);
@@ -175,6 +176,7 @@ static Proto* LoadFunction(LoadState* S, TString* p)
LoadDebug(S,f);
IF (!luaG_checkcode(f), "bad code");
S->L->top--;
+ S->L->nCcalls--;
return f;
}