diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-04-01 11:39:55 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-04-01 11:39:55 -0300 |
commit | 607be77ec8d2b6062077772a55831a5aca16fb2d (patch) | |
tree | 160fdbdaab4cf577e94e2f1f78a4d717a26bfcd1 | |
parent | 0d745ed04c93e907e9f2bd8c21ce1ca27bba9b6a (diff) | |
download | lua-607be77ec8d2b6062077772a55831a5aca16fb2d.tar.gz lua-607be77ec8d2b6062077772a55831a5aca16fb2d.tar.bz2 lua-607be77ec8d2b6062077772a55831a5aca16fb2d.zip |
some details to avoid warnings
-rw-r--r-- | lcode.c | 4 | ||||
-rw-r--r-- | ldump.c | 4 | ||||
-rw-r--r-- | lmathlib.c | 4 | ||||
-rw-r--r-- | ltable.c | 10 | ||||
-rw-r--r-- | lundump.c | 4 | ||||
-rw-r--r-- | lutf8lib.c | 4 |
6 files changed, 15 insertions, 15 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lcode.c,v 2.84 2014/03/09 19:21:34 roberto Exp roberto $ | 2 | ** $Id: lcode.c,v 2.85 2014/03/21 13:52:33 roberto Exp roberto $ |
3 | ** Code generator for Lua | 3 | ** Code generator for Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -317,7 +317,7 @@ static int addk (FuncState *fs, TValue *key, TValue *v) { | |||
317 | TValue *idx = luaH_set(L, fs->ls->h, key); /* index scanner table */ | 317 | TValue *idx = luaH_set(L, fs->ls->h, key); /* index scanner table */ |
318 | int k, oldsize; | 318 | int k, oldsize; |
319 | if (ttisinteger(idx)) { /* is there an index there? */ | 319 | if (ttisinteger(idx)) { /* is there an index there? */ |
320 | k = ivalue(idx); | 320 | k = cast_int(ivalue(idx)); |
321 | /* correct value? (warning: must distinguish floats from integers!) */ | 321 | /* correct value? (warning: must distinguish floats from integers!) */ |
322 | if (k < fs->nk && ttype(&f->k[k]) == ttype(v) && | 322 | if (k < fs->nk && ttype(&f->k[k]) == ttype(v) && |
323 | luaV_rawequalobj(&f->k[k], v)) | 323 | luaV_rawequalobj(&f->k[k], v)) |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldump.c,v 2.27 2014/03/11 18:56:27 roberto Exp roberto $ | 2 | ** $Id: ldump.c,v 2.28 2014/03/27 15:58:05 roberto Exp roberto $ |
3 | ** save precompiled Lua chunks | 3 | ** save precompiled Lua chunks |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -73,7 +73,7 @@ static void DumpString (const TString *s, DumpState *D) { | |||
73 | else { | 73 | else { |
74 | size_t size = s->tsv.len + 1; /* include trailing '\0' */ | 74 | size_t size = s->tsv.len + 1; /* include trailing '\0' */ |
75 | if (size < 0xFF) | 75 | if (size < 0xFF) |
76 | DumpByte(size, D); | 76 | DumpByte(cast_int(size), D); |
77 | else { | 77 | else { |
78 | DumpByte(0xFF, D); | 78 | DumpByte(0xFF, D); |
79 | DumpVar(size, D); | 79 | DumpVar(size, D); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lmathlib.c,v 1.92 2013/07/22 16:05:53 roberto Exp roberto $ | 2 | ** $Id: lmathlib.c,v 1.93 2014/03/31 19:00:52 roberto Exp roberto $ |
3 | ** Standard mathematical library | 3 | ** Standard mathematical library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -250,7 +250,7 @@ static int math_random (lua_State *L) { | |||
250 | 250 | ||
251 | 251 | ||
252 | static int math_randomseed (lua_State *L) { | 252 | static int math_randomseed (lua_State *L) { |
253 | srand(luaL_checkunsigned(L, 1)); | 253 | srand((unsigned int)luaL_checkunsigned(L, 1)); |
254 | (void)rand(); /* discard first value to avoid undesirable correlations */ | 254 | (void)rand(); /* discard first value to avoid undesirable correlations */ |
255 | return 0; | 255 | return 0; |
256 | } | 256 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltable.c,v 2.83 2013/09/11 12:26:14 roberto Exp roberto $ | 2 | ** $Id: ltable.c,v 2.84 2014/01/27 13:34:32 roberto Exp roberto $ |
3 | ** Lua tables (hash) | 3 | ** Lua tables (hash) |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -443,10 +443,10 @@ TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key) { | |||
443 | /* yes; move colliding node into free position */ | 443 | /* yes; move colliding node into free position */ |
444 | while (othern + gnext(othern) != mp) /* find previous */ | 444 | while (othern + gnext(othern) != mp) /* find previous */ |
445 | othern += gnext(othern); | 445 | othern += gnext(othern); |
446 | gnext(othern) = f - othern; /* re-chain with 'f' in place of 'mp' */ | 446 | gnext(othern) = cast_int(f - othern); /* rechain to point to 'f' */ |
447 | *f = *mp; /* copy colliding node into free pos. (mp->next also goes) */ | 447 | *f = *mp; /* copy colliding node into free pos. (mp->next also goes) */ |
448 | if (gnext(mp) != 0) { | 448 | if (gnext(mp) != 0) { |
449 | gnext(f) += mp - f; /* correct 'next' */ | 449 | gnext(f) += cast_int(mp - f); /* correct 'next' */ |
450 | gnext(mp) = 0; /* now 'mp' is free */ | 450 | gnext(mp) = 0; /* now 'mp' is free */ |
451 | } | 451 | } |
452 | setnilvalue(gval(mp)); | 452 | setnilvalue(gval(mp)); |
@@ -454,9 +454,9 @@ TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key) { | |||
454 | else { /* colliding node is in its own main position */ | 454 | else { /* colliding node is in its own main position */ |
455 | /* new node will go into free position */ | 455 | /* new node will go into free position */ |
456 | if (gnext(mp) != 0) | 456 | if (gnext(mp) != 0) |
457 | gnext(f) = (mp + gnext(mp)) - f; /* chain new position */ | 457 | gnext(f) = cast_int((mp + gnext(mp)) - f); /* chain new position */ |
458 | else lua_assert(gnext(f) == 0); | 458 | else lua_assert(gnext(f) == 0); |
459 | gnext(mp) = f - mp; | 459 | gnext(mp) = cast_int(f - mp); |
460 | mp = f; | 460 | mp = f; |
461 | } | 461 | } |
462 | } | 462 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lundump.c,v 2.34 2014/03/11 18:56:27 roberto Exp roberto $ | 2 | ** $Id: lundump.c,v 2.35 2014/03/27 15:58:05 roberto Exp roberto $ |
3 | ** load precompiled Lua chunks | 3 | ** load precompiled Lua chunks |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -203,7 +203,7 @@ static void LoadFunction (LoadState *S, Proto *f) { | |||
203 | 203 | ||
204 | static void checkliteral (LoadState *S, const char *s, const char *msg) { | 204 | static void checkliteral (LoadState *S, const char *s, const char *msg) { |
205 | char buff[sizeof(LUA_SIGNATURE) + sizeof(LUAC_DATA)]; /* larger than both */ | 205 | char buff[sizeof(LUA_SIGNATURE) + sizeof(LUAC_DATA)]; /* larger than both */ |
206 | int len = strlen(s); | 206 | size_t len = strlen(s); |
207 | LoadVector(S, buff, len); | 207 | LoadVector(S, buff, len); |
208 | if (memcmp(s, buff, len) != 0) | 208 | if (memcmp(s, buff, len) != 0) |
209 | error(S, msg); | 209 | error(S, msg); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lutf8lib.c,v 1.3 2014/03/20 14:11:00 roberto Exp roberto $ | 2 | ** $Id: lutf8lib.c,v 1.4 2014/03/20 19:36:02 roberto Exp roberto $ |
3 | ** Standard library for UTF-8 manipulation | 3 | ** Standard library for UTF-8 manipulation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -187,7 +187,7 @@ static int byteoffset (lua_State *L) { | |||
187 | static int iter_aux (lua_State *L) { | 187 | static int iter_aux (lua_State *L) { |
188 | size_t len; | 188 | size_t len; |
189 | const char *s = luaL_checklstring(L, 1, &len); | 189 | const char *s = luaL_checklstring(L, 1, &len); |
190 | int n = lua_tointeger(L, 2) - 1; | 190 | lua_Integer n = lua_tointeger(L, 2) - 1; |
191 | if (n < 0) /* first iteration? */ | 191 | if (n < 0) /* first iteration? */ |
192 | n = 0; /* start from here */ | 192 | n = 0; /* start from here */ |
193 | else if (n < (lua_Integer)len) { | 193 | else if (n < (lua_Integer)len) { |