diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-10-19 11:05:11 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-10-19 11:05:11 -0200 |
commit | ed7039024d32778a62fd52a98fe98f3e38133853 (patch) | |
tree | 3c374aa6d13a0be4698f57088287b4ffd0d2b145 | |
parent | 5511bf6b9d6018665f5c184c5a464bb8b0aceca5 (diff) | |
download | lua-ed7039024d32778a62fd52a98fe98f3e38133853.tar.gz lua-ed7039024d32778a62fd52a98fe98f3e38133853.tar.bz2 lua-ed7039024d32778a62fd52a98fe98f3e38133853.zip |
avoid some warnings
-rw-r--r-- | lauxlib.c | 6 | ||||
-rw-r--r-- | ldblib.c | 4 | ||||
-rw-r--r-- | liolib.c | 4 | ||||
-rw-r--r-- | lstrlib.c | 6 |
4 files changed, 11 insertions, 9 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lauxlib.c,v 1.152 2005/09/06 17:20:11 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.153 2005/10/03 14:36:45 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 | */ |
@@ -305,7 +305,7 @@ LUALIB_API int luaL_getn (lua_State *L, int t) { | |||
305 | if ((n = checkint(L, 2)) >= 0) return n; | 305 | if ((n = checkint(L, 2)) >= 0) return n; |
306 | lua_getfield(L, t, "n"); /* else try t.n */ | 306 | lua_getfield(L, t, "n"); /* else try t.n */ |
307 | if ((n = checkint(L, 1)) >= 0) return n; | 307 | if ((n = checkint(L, 1)) >= 0) return n; |
308 | return lua_objlen(L, t); | 308 | return (int)lua_objlen(L, t); |
309 | } | 309 | } |
310 | 310 | ||
311 | #endif | 311 | #endif |
@@ -470,7 +470,7 @@ LUALIB_API int luaL_ref (lua_State *L, int t) { | |||
470 | lua_rawseti(L, t, FREELIST_REF); /* (t[FREELIST_REF] = t[ref]) */ | 470 | lua_rawseti(L, t, FREELIST_REF); /* (t[FREELIST_REF] = t[ref]) */ |
471 | } | 471 | } |
472 | else { /* no free elements */ | 472 | else { /* no free elements */ |
473 | ref = lua_objlen(L, t); | 473 | ref = (int)lua_objlen(L, t); |
474 | ref++; /* create new reference */ | 474 | ref++; /* create new reference */ |
475 | } | 475 | } |
476 | lua_rawseti(L, t, ref); | 476 | lua_rawseti(L, t, ref); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldblib.c,v 1.100 2005/08/15 14:12:32 roberto Exp roberto $ | 2 | ** $Id: ldblib.c,v 1.101 2005/08/26 17:36:32 roberto Exp roberto $ |
3 | ** Interface from Lua to its debug API | 3 | ** Interface from Lua to its debug API |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -319,7 +319,7 @@ static int db_errorfb (lua_State *L) { | |||
319 | lua_State *L1 = getthread(L, &arg); | 319 | lua_State *L1 = getthread(L, &arg); |
320 | lua_Debug ar; | 320 | lua_Debug ar; |
321 | if (lua_isnumber(L, arg+2)) { | 321 | if (lua_isnumber(L, arg+2)) { |
322 | level = lua_tointeger(L, arg+2); | 322 | level = (int)lua_tointeger(L, arg+2); |
323 | lua_pop(L, 1); | 323 | lua_pop(L, 1); |
324 | } | 324 | } |
325 | else | 325 | else |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: liolib.c,v 2.67 2005/08/26 17:36:32 roberto Exp roberto $ | 2 | ** $Id: liolib.c,v 2.68 2005/10/14 16:24:11 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 | */ |
@@ -424,7 +424,7 @@ static int f_seek (lua_State *L) { | |||
424 | static const char *const modenames[] = {"set", "cur", "end", NULL}; | 424 | static const char *const modenames[] = {"set", "cur", "end", NULL}; |
425 | FILE *f = tofile(L); | 425 | FILE *f = tofile(L); |
426 | int op = luaL_checkoption(L, 2, "cur", modenames); | 426 | int op = luaL_checkoption(L, 2, "cur", modenames); |
427 | lua_Integer offset = luaL_optinteger(L, 3, 0); | 427 | long offset = luaL_optlong(L, 3, 0); |
428 | op = fseek(f, offset, mode[op]); | 428 | op = fseek(f, offset, mode[op]); |
429 | if (op) | 429 | if (op) |
430 | return pushresult(L, 0, NULL); /* error */ | 430 | return pushresult(L, 0, NULL); /* error */ |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstrlib.c,v 1.123 2005/08/26 17:36:32 roberto Exp roberto $ | 2 | ** $Id: lstrlib.c,v 1.124 2005/09/19 13:49:12 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 | */ |
@@ -111,7 +111,9 @@ static int str_byte (lua_State *L) { | |||
111 | if (posi <= 0) posi = 1; | 111 | if (posi <= 0) posi = 1; |
112 | if ((size_t)pose > l) pose = l; | 112 | if ((size_t)pose > l) pose = l; |
113 | if (posi > pose) return 0; /* empty interval; return no values */ | 113 | if (posi > pose) return 0; /* empty interval; return no values */ |
114 | n = pose - posi + 1; | 114 | n = (int)(pose - posi + 1); |
115 | if (posi + n <= pose) /* overflow? */ | ||
116 | luaL_error(L, "string slice too long"); | ||
115 | luaL_checkstack(L, n, "string slice too long"); | 117 | luaL_checkstack(L, n, "string slice too long"); |
116 | for (i=0; i<n; i++) | 118 | for (i=0; i<n; i++) |
117 | lua_pushinteger(L, uchar(s[posi+i-1])); | 119 | lua_pushinteger(L, uchar(s[posi+i-1])); |