From 607be77ec8d2b6062077772a55831a5aca16fb2d Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 1 Apr 2014 11:39:55 -0300 Subject: some details to avoid warnings --- lcode.c | 4 ++-- ldump.c | 4 ++-- lmathlib.c | 4 ++-- ltable.c | 10 +++++----- lundump.c | 4 ++-- lutf8lib.c | 4 ++-- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lcode.c b/lcode.c index e2ffda4e..a36e2376 100644 --- a/lcode.c +++ b/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)) diff --git a/ldump.c b/ldump.c index 0c42d772..3d39e6bd 100644 --- a/ldump.c +++ b/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); diff --git a/lmathlib.c b/lmathlib.c index bede732e..cf8f2a6f 100644 --- a/lmathlib.c +++ b/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; } diff --git a/ltable.c b/ltable.c index 36f6be0f..74feb4bd 100644 --- a/ltable.c +++ b/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; } } diff --git a/lundump.c b/lundump.c index ddf55239..1a5c3ab3 100644 --- a/lundump.c +++ b/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); diff --git a/lutf8lib.c b/lutf8lib.c index def7e869..73e86a4a 100644 --- a/lutf8lib.c +++ b/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) { -- cgit v1.2.3-55-g6feb