浏览代码

warnings in VS (implicit casts from ptrdiff_t to int)

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

+ 2 - 2
lapi.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: lapi.c,v 2.280 2018/01/10 12:02:35 roberto Exp roberto $
+** $Id: lapi.c,v 2.281 2018/01/28 15:13:26 roberto Exp roberto $
 ** Lua API
 ** Lua API
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -993,7 +993,7 @@ LUA_API int lua_pcallk (lua_State *L, int nargs, int nresults, int errfunc,
     ci->u.c.k = k;  /* save continuation */
     ci->u.c.k = k;  /* save continuation */
     ci->u.c.ctx = ctx;  /* save context */
     ci->u.c.ctx = ctx;  /* save context */
     /* save information for error recovery */
     /* save information for error recovery */
-    ci->u2.funcidx = savestack(L, c.func);
+    ci->u2.funcidx = cast_int(savestack(L, c.func));
     ci->u.c.old_errfunc = L->errfunc;
     ci->u.c.old_errfunc = L->errfunc;
     L->errfunc = func;
     L->errfunc = func;
     setoah(ci->callstatus, L->allowhook);  /* save value of 'allowhook' */
     setoah(ci->callstatus, L->allowhook);  /* save value of 'allowhook' */

+ 2 - 2
ldo.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: ldo.c,v 2.187 2018/01/28 12:08:04 roberto Exp roberto $
+** $Id: ldo.c,v 2.188 2018/01/28 13:39:52 roberto Exp roberto $
 ** Stack and Call structure of Lua
 ** Stack and Call structure of Lua
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -673,7 +673,7 @@ LUA_API int lua_resume (lua_State *L, lua_State *from, int nargs,
     else lua_assert(status == L->status);  /* normal end or yield */
     else lua_assert(status == L->status);  /* normal end or yield */
   }
   }
   *nresults = (status == LUA_YIELD) ? L->ci->u2.nyield
   *nresults = (status == LUA_YIELD) ? L->ci->u2.nyield
-                                    : L->top - (L->ci->func + 1);
+                                    : cast_int(L->top - (L->ci->func + 1));
   L->nny = oldnny;  /* restore 'nny' */
   L->nny = oldnny;  /* restore 'nny' */
   L->nCcalls--;
   L->nCcalls--;
   // lua_assert(L->nCcalls == ((from) ? from->nCcalls : 0));
   // lua_assert(L->nCcalls == ((from) ? from->nCcalls : 0));

+ 2 - 2
lvm.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: lvm.c,v 2.334 2018/01/14 17:27:50 roberto Exp roberto $
+** $Id: lvm.c,v 2.335 2018/01/27 16:56:33 roberto Exp roberto $
 ** Lua virtual machine
 ** Lua virtual machine
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -1488,7 +1488,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) {
         if (b != 0)
         if (b != 0)
           L->top = ra + b;
           L->top = ra + b;
         else  /* previous instruction set top */
         else  /* previous instruction set top */
-          b = L->top - ra;
+          b = cast_int(L->top - ra);
         lua_assert(GETARG_C(i) - 1 == LUA_MULTRET);
         lua_assert(GETARG_C(i) - 1 == LUA_MULTRET);
         if (!ttisfunction(vra)) {  /* not a function? */
         if (!ttisfunction(vra)) {  /* not a function? */
           ProtectNT(luaD_tryfuncTM(L, ra));  /* try '__call' metamethod */
           ProtectNT(luaD_tryfuncTM(L, ra));  /* try '__call' metamethod */