aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lapi.c8
-rw-r--r--lauxlib.c4
-rw-r--r--ldo.c4
-rw-r--r--lgc.c4
-rw-r--r--liolib.c4
-rw-r--r--lstrlib.c6
-rw-r--r--ltablib.c5
-rw-r--r--lua.c4
-rw-r--r--lvm.c4
9 files changed, 21 insertions, 22 deletions
diff --git a/lapi.c b/lapi.c
index 40b15a3c..7a51b657 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 2.136 2010/09/07 19:21:39 roberto Exp roberto $ 2** $Id: lapi.c,v 2.137 2010/09/07 19:35:04 roberto Exp roberto $
3** Lua API 3** Lua API
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -85,7 +85,7 @@ LUA_API int lua_checkstack (lua_State *L, int size) {
85 if (L->stack_last - L->top > size) /* stack large enough? */ 85 if (L->stack_last - L->top > size) /* stack large enough? */
86 res = 1; /* yes; check is OK */ 86 res = 1; /* yes; check is OK */
87 else { /* no; need to grow stack */ 87 else { /* no; need to grow stack */
88 int inuse = L->top - L->stack + EXTRA_STACK; 88 int inuse = cast_int(L->top - L->stack) + EXTRA_STACK;
89 if (inuse > LUAI_MAXSTACK - size) /* can grow without overflow? */ 89 if (inuse > LUAI_MAXSTACK - size) /* can grow without overflow? */
90 res = 0; /* no */ 90 res = 0; /* no */
91 else /* try to grow stack */ 91 else /* try to grow stack */
@@ -1155,13 +1155,11 @@ LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) {
1155 1155
1156static UpVal **getupvalref (lua_State *L, int fidx, int n, Closure **pf) { 1156static UpVal **getupvalref (lua_State *L, int fidx, int n, Closure **pf) {
1157 Closure *f; 1157 Closure *f;
1158 Proto *p;
1159 StkId fi = index2addr(L, fidx); 1158 StkId fi = index2addr(L, fidx);
1160 api_check(L, ttisclosure(fi), "Lua function expected"); 1159 api_check(L, ttisclosure(fi), "Lua function expected");
1161 f = clvalue(fi); 1160 f = clvalue(fi);
1162 api_check(L, !f->c.isC, "Lua function expected"); 1161 api_check(L, !f->c.isC, "Lua function expected");
1163 p = f->l.p; 1162 api_check(L, (1 <= n && n <= f->l.p->sizeupvalues), "invalid upvalue index");
1164 api_check(L, (1 <= n && n <= p->sizeupvalues), "invalid upvalue index");
1165 if (pf) *pf = f; 1163 if (pf) *pf = f;
1166 return &f->l.upvals[n - 1]; /* get its upvalue pointer */ 1164 return &f->l.upvals[n - 1]; /* get its upvalue pointer */
1167} 1165}
diff --git a/lauxlib.c b/lauxlib.c
index 0de4fa0a..e1da6569 100644
--- a/lauxlib.c
+++ b/lauxlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lauxlib.c,v 1.220 2010/08/03 20:21:16 roberto Exp roberto $ 2** $Id: lauxlib.c,v 1.221 2010/10/01 18:53:00 roberto Exp roberto $
3** Auxiliary functions for building Lua libraries 3** Auxiliary functions for building Lua libraries
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -641,7 +641,7 @@ LUALIB_API int luaL_len (lua_State *L, int idx) {
641 int l; 641 int l;
642 int isnum; 642 int isnum;
643 lua_len(L, idx); 643 lua_len(L, idx);
644 l = lua_tointegerx(L, -1, &isnum); 644 l = (int)lua_tointegerx(L, -1, &isnum);
645 if (!isnum) 645 if (!isnum)
646 luaL_error(L, "object length is not a number"); 646 luaL_error(L, "object length is not a number");
647 lua_pop(L, 1); /* remove object */ 647 lua_pop(L, 1); /* remove object */
diff --git a/ldo.c b/ldo.c
index 1b675264..dc489446 100644
--- a/ldo.c
+++ b/ldo.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldo.c,v 2.88 2010/06/04 13:06:15 roberto Exp roberto $ 2** $Id: ldo.c,v 2.89 2010/09/30 17:21:31 roberto Exp roberto $
3** Stack and Call structure of Lua 3** Stack and Call structure of Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -177,7 +177,7 @@ void luaD_growstack (lua_State *L, int n) {
177 if (size > LUAI_MAXSTACK) /* error after extra size? */ 177 if (size > LUAI_MAXSTACK) /* error after extra size? */
178 luaD_throw(L, LUA_ERRERR); 178 luaD_throw(L, LUA_ERRERR);
179 else { 179 else {
180 int needed = L->top - L->stack + n + EXTRA_STACK; 180 int needed = cast_int(L->top - L->stack) + n + EXTRA_STACK;
181 int newsize = 2 * size; 181 int newsize = 2 * size;
182 if (newsize > LUAI_MAXSTACK) newsize = LUAI_MAXSTACK; 182 if (newsize > LUAI_MAXSTACK) newsize = LUAI_MAXSTACK;
183 if (newsize < needed) newsize = needed; 183 if (newsize < needed) newsize = needed;
diff --git a/lgc.c b/lgc.c
index beccc1a6..f7072ab7 100644
--- a/lgc.c
+++ b/lgc.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lgc.c,v 2.101 2010/06/30 14:11:17 roberto Exp roberto $ 2** $Id: lgc.c,v 2.102 2010/09/03 14:14:01 roberto Exp roberto $
3** Garbage Collector 3** Garbage Collector
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -449,7 +449,7 @@ static int traverseproto (global_State *g, Proto *f) {
449} 449}
450 450
451 451
452static l_mem traverseclosure (global_State *g, Closure *cl) { 452static int traverseclosure (global_State *g, Closure *cl) {
453 if (cl->c.isC) { 453 if (cl->c.isC) {
454 int i; 454 int i;
455 for (i=0; i<cl->c.nupvalues; i++) /* mark its upvalues */ 455 for (i=0; i<cl->c.nupvalues; i++) /* mark its upvalues */
diff --git a/liolib.c b/liolib.c
index 78ddb806..9c148285 100644
--- a/liolib.c
+++ b/liolib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: liolib.c,v 2.90 2010/07/25 15:18:19 roberto Exp roberto $ 2** $Id: liolib.c,v 2.91 2010/07/28 15:51:59 roberto Exp roberto $
3** Standard I/O (and system) library 3** Standard I/O (and system) library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -453,7 +453,7 @@ static int f_read (lua_State *L) {
453static int io_readline (lua_State *L) { 453static int io_readline (lua_State *L) {
454 FILE *f = *(FILE **)lua_touserdata(L, lua_upvalueindex(1)); 454 FILE *f = *(FILE **)lua_touserdata(L, lua_upvalueindex(1));
455 int i; 455 int i;
456 int n = lua_tointeger(L, lua_upvalueindex(2)); 456 int n = (int)lua_tointeger(L, lua_upvalueindex(2));
457 if (f == NULL) /* file is already closed? */ 457 if (f == NULL) /* file is already closed? */
458 luaL_error(L, "file is already closed"); 458 luaL_error(L, "file is already closed");
459 lua_settop(L , 1); 459 lua_settop(L , 1);
diff --git a/lstrlib.c b/lstrlib.c
index 79b3ab37..00a510ee 100644
--- a/lstrlib.c
+++ b/lstrlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstrlib.c,v 1.153 2010/05/24 19:34:57 roberto Exp roberto $ 2** $Id: lstrlib.c,v 1.154 2010/07/02 11:38:13 roberto Exp roberto $
3** Standard library for string operations and pattern-matching 3** Standard library for string operations and pattern-matching
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -758,9 +758,9 @@ static void addquoted (lua_State *L, luaL_Buffer *b, int arg) {
758 else if (*s == '\0' || iscntrl(uchar(*s))) { 758 else if (*s == '\0' || iscntrl(uchar(*s))) {
759 char buff[10]; 759 char buff[10];
760 if (!isdigit(uchar(*(s+1)))) 760 if (!isdigit(uchar(*(s+1))))
761 sprintf(buff, "\\%d", uchar(*s)); 761 sprintf(buff, "\\%d", (int)uchar(*s));
762 else 762 else
763 sprintf(buff, "\\%03d", uchar(*s)); 763 sprintf(buff, "\\%03d", (int)uchar(*s));
764 luaL_addstring(b, buff); 764 luaL_addstring(b, buff);
765 } 765 }
766 else 766 else
diff --git a/ltablib.c b/ltablib.c
index 93cc3442..9aa7d5c9 100644
--- a/ltablib.c
+++ b/ltablib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltablib.c,v 1.55 2010/03/13 03:57:46 roberto Exp roberto $ 2** $Id: ltablib.c,v 1.56 2010/07/02 11:38:13 roberto Exp roberto $
3** Library for Table Manipulation 3** Library for Table Manipulation
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -16,7 +16,8 @@
16#include "lualib.h" 16#include "lualib.h"
17 17
18 18
19#define aux_getn(L,n) (luaL_checktype(L, n, LUA_TTABLE), lua_rawlen(L, n)) 19#define aux_getn(L,n) \
20 (luaL_checktype(L, n, LUA_TTABLE), (int)lua_rawlen(L, n))
20 21
21 22
22static int foreachi (lua_State *L) { 23static int foreachi (lua_State *L) {
diff --git a/lua.c b/lua.c
index 1d6f9c58..7d1d300d 100644
--- a/lua.c
+++ b/lua.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lua.c,v 1.192 2010/07/25 15:03:37 roberto Exp roberto $ 2** $Id: lua.c,v 1.193 2010/10/18 16:06:33 roberto Exp roberto $
3** Lua stand-alone interpreter 3** Lua stand-alone interpreter
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -428,7 +428,7 @@ static int handle_luainit (lua_State *L) {
428 428
429 429
430static int pmain (lua_State *L) { 430static int pmain (lua_State *L) {
431 int argc = lua_tointeger(L, 1); 431 int argc = (int)lua_tointeger(L, 1);
432 char **argv = (char **)lua_touserdata(L, 2); 432 char **argv = (char **)lua_touserdata(L, 2);
433 int script; 433 int script;
434 int has_i = 0, has_v = 0, has_e = 0; 434 int has_i = 0, has_v = 0, has_e = 0;
diff --git a/lvm.c b/lvm.c
index 754d608b..5c15c353 100644
--- a/lvm.c
+++ b/lvm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lvm.c,v 2.122 2010/06/07 16:55:34 roberto Exp roberto $ 2** $Id: lvm.c,v 2.123 2010/06/30 14:11:17 roberto Exp roberto $
3** Lua virtual machine 3** Lua virtual machine
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -421,7 +421,7 @@ void luaV_finishOp (lua_State *L) {
421 case OP_CONCAT: { 421 case OP_CONCAT: {
422 StkId top = L->top - 1; /* top when 'call_binTM' was called */ 422 StkId top = L->top - 1; /* top when 'call_binTM' was called */
423 int b = GETARG_B(inst); /* first element to concatenate */ 423 int b = GETARG_B(inst); /* first element to concatenate */
424 int total = top - 1 - (base + b); /* elements yet to concatenate */ 424 int total = cast_int(top - 1 - (base + b)); /* yet to concatenate */
425 setobj2s(L, top - 2, top); /* put TM result in proper position */ 425 setobj2s(L, top - 2, top); /* put TM result in proper position */
426 if (total > 1) { /* are there elements to concat? */ 426 if (total > 1) { /* are there elements to concat? */
427 L->top = top - 1; /* top is one after last element (at top-2) */ 427 L->top = top - 1; /* top is one after last element (at top-2) */