Browse Source

some details to avoid warnings

pull/9/head
Roberto Ierusalimschy 11 years ago
parent
commit
607be77ec8
  1. 4
      lcode.c
  2. 4
      ldump.c
  3. 4
      lmathlib.c
  4. 10
      ltable.c
  5. 4
      lundump.c
  6. 4
      lutf8lib.c

4
lcode.c

@ -1,5 +1,5 @@
/*
** $Id: lcode.c,v 2.84 2014/03/09 19:21:34 roberto Exp roberto $
** $Id: lcode.c,v 2.85 2014/03/21 13:52:33 roberto Exp roberto $
** Code generator for Lua
** See Copyright Notice in lua.h
*/
@ -317,7 +317,7 @@ static int addk (FuncState *fs, TValue *key, TValue *v) {
TValue *idx = luaH_set(L, fs->ls->h, key); /* index scanner table */
int k, oldsize;
if (ttisinteger(idx)) { /* is there an index there? */
k = ivalue(idx);
k = cast_int(ivalue(idx));
/* correct value? (warning: must distinguish floats from integers!) */
if (k < fs->nk && ttype(&f->k[k]) == ttype(v) &&
luaV_rawequalobj(&f->k[k], v))

4
ldump.c

@ -1,5 +1,5 @@
/*
** $Id: ldump.c,v 2.27 2014/03/11 18:56:27 roberto Exp roberto $
** $Id: ldump.c,v 2.28 2014/03/27 15:58:05 roberto Exp roberto $
** save precompiled Lua chunks
** See Copyright Notice in lua.h
*/
@ -73,7 +73,7 @@ static void DumpString (const TString *s, DumpState *D) {
else {
size_t size = s->tsv.len + 1; /* include trailing '\0' */
if (size < 0xFF)
DumpByte(size, D);
DumpByte(cast_int(size), D);
else {
DumpByte(0xFF, D);
DumpVar(size, D);

4
lmathlib.c

@ -1,5 +1,5 @@
/*
** $Id: lmathlib.c,v 1.92 2013/07/22 16:05:53 roberto Exp roberto $
** $Id: lmathlib.c,v 1.93 2014/03/31 19:00:52 roberto Exp roberto $
** Standard mathematical library
** See Copyright Notice in lua.h
*/
@ -250,7 +250,7 @@ static int math_random (lua_State *L) {
static int math_randomseed (lua_State *L) {
srand(luaL_checkunsigned(L, 1));
srand((unsigned int)luaL_checkunsigned(L, 1));
(void)rand(); /* discard first value to avoid undesirable correlations */
return 0;
}

10
ltable.c

@ -1,5 +1,5 @@
/*
** $Id: ltable.c,v 2.83 2013/09/11 12:26:14 roberto Exp roberto $
** $Id: ltable.c,v 2.84 2014/01/27 13:34:32 roberto Exp roberto $
** Lua tables (hash)
** See Copyright Notice in lua.h
*/
@ -443,10 +443,10 @@ TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key) {
/* yes; move colliding node into free position */
while (othern + gnext(othern) != mp) /* find previous */
othern += gnext(othern);
gnext(othern) = f - othern; /* re-chain with 'f' in place of 'mp' */
gnext(othern) = cast_int(f - othern); /* rechain to point to 'f' */
*f = *mp; /* copy colliding node into free pos. (mp->next also goes) */
if (gnext(mp) != 0) {
gnext(f) += mp - f; /* correct 'next' */
gnext(f) += cast_int(mp - f); /* correct 'next' */
gnext(mp) = 0; /* now 'mp' is free */
}
setnilvalue(gval(mp));
@ -454,9 +454,9 @@ TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key) {
else { /* colliding node is in its own main position */
/* new node will go into free position */
if (gnext(mp) != 0)
gnext(f) = (mp + gnext(mp)) - f; /* chain new position */
gnext(f) = cast_int((mp + gnext(mp)) - f); /* chain new position */
else lua_assert(gnext(f) == 0);
gnext(mp) = f - mp;
gnext(mp) = cast_int(f - mp);
mp = f;
}
}

4
lundump.c

@ -1,5 +1,5 @@
/*
** $Id: lundump.c,v 2.34 2014/03/11 18:56:27 roberto Exp roberto $
** $Id: lundump.c,v 2.35 2014/03/27 15:58:05 roberto Exp roberto $
** load precompiled Lua chunks
** See Copyright Notice in lua.h
*/
@ -203,7 +203,7 @@ static void LoadFunction (LoadState *S, Proto *f) {
static void checkliteral (LoadState *S, const char *s, const char *msg) {
char buff[sizeof(LUA_SIGNATURE) + sizeof(LUAC_DATA)]; /* larger than both */
int len = strlen(s);
size_t len = strlen(s);
LoadVector(S, buff, len);
if (memcmp(s, buff, len) != 0)
error(S, msg);

4
lutf8lib.c

@ -1,5 +1,5 @@
/*
** $Id: lutf8lib.c,v 1.3 2014/03/20 14:11:00 roberto Exp roberto $
** $Id: lutf8lib.c,v 1.4 2014/03/20 19:36:02 roberto Exp roberto $
** Standard library for UTF-8 manipulation
** See Copyright Notice in lua.h
*/
@ -187,7 +187,7 @@ static int byteoffset (lua_State *L) {
static int iter_aux (lua_State *L) {
size_t len;
const char *s = luaL_checklstring(L, 1, &len);
int n = lua_tointeger(L, 2) - 1;
lua_Integer n = lua_tointeger(L, 2) - 1;
if (n < 0) /* first iteration? */
n = 0; /* start from here */
else if (n < (lua_Integer)len) {

Loading…
Cancel
Save