浏览代码

warnings from Visual Studio /W3

Roberto Ierusalimschy 7 年之前
父节点
当前提交
ac78b914b6
共有 3 个文件被更改,包括 6 次插入6 次删除
  1. 2 2
      lcode.c
  2. 2 2
      lgc.c
  3. 2 2
      ltm.c

+ 2 - 2
lcode.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lcode.c,v 2.140 2017/11/30 13:17:06 roberto Exp roberto $
+** $Id: lcode.c,v 2.140 2017/11/30 13:29:18 roberto Exp roberto $
 ** Code generator for Lua
 ** See Copyright Notice in lua.h
 */
@@ -1128,7 +1128,7 @@ void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k) {
     t->k = VINDEXSTR;
   }
   else if (isCint(k)) {
-    t->u.ind.idx = k->u.ival;  /* integer constant */
+    t->u.ind.idx = cast_int(k->u.ival);  /* integer constant in proper range */
     t->k = VINDEXI;
   }
   else {

+ 2 - 2
lgc.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lgc.c,v 2.238 2017/11/07 13:25:26 roberto Exp roberto $
+** $Id: lgc.c,v 2.239 2017/11/23 19:29:04 roberto Exp roberto $
 ** Garbage Collector
 ** See Copyright Notice in lua.h
 */
@@ -1270,7 +1270,7 @@ static void genstep (lua_State *L, global_State *g) {
     lu_mem mem;
     youngcollection(L, g);
     mem = gettotalbytes(g);
-    luaE_setdebt(g, -((mem / 100) * g->genminormul));
+    luaE_setdebt(g, -(cast(l_mem, (mem / 100)) * g->genminormul));
     g->GCestimate = majorbase;  /* preserve base value */
   }
 }

+ 2 - 2
ltm.c

@@ -1,5 +1,5 @@
 /*
-** $Id: ltm.c,v 2.49 2017/11/23 19:18:10 roberto Exp roberto $
+** $Id: ltm.c,v 2.50 2017/11/27 17:44:31 roberto Exp roberto $
 ** Tag methods
 ** See Copyright Notice in lua.h
 */
@@ -237,7 +237,7 @@ void luaT_getvarargs (lua_State *L, TValue *t, StkId where, int wanted) {
     Table *h = hvalue(t);
     if (wanted < 0) {  /* get all? */
       const TValue *ns = luaH_getstr(h, G(L)->nfield);
-      int n = (ttisinteger(ns)) ? ivalue(ns) : 0;
+      int n = (ttisinteger(ns)) ? cast_int(ivalue(ns)) : 0;
       wanted = n;
       checkstackp(L, n, where);
       L->top = where + n;