Fix narrowing casts of pointer differences for x64.

This commit is contained in:
Mike Pall 2009-12-29 20:19:54 +01:00
parent d64b031269
commit 52eb88773e
3 changed files with 4 additions and 4 deletions

View File

@ -337,7 +337,7 @@ LJLIB_CF(dofile)
if (luaL_loadfile(L, fname ? strdata(fname) : NULL) != 0) if (luaL_loadfile(L, fname ? strdata(fname) : NULL) != 0)
lua_error(L); lua_error(L);
lua_call(L, 0, LUA_MULTRET); lua_call(L, 0, LUA_MULTRET);
return (L->top - L->base) - 1; return cast_int(L->top - L->base) - 1;
} }
/* -- Base library: GC control -------------------------------------------- */ /* -- Base library: GC control -------------------------------------------- */

View File

@ -194,7 +194,7 @@ static int io_file_readchars(lua_State *L, FILE *fp, size_t n)
static int io_file_read(lua_State *L, FILE *fp, int start) static int io_file_read(lua_State *L, FILE *fp, int start)
{ {
int ok, n, nargs = (L->top - L->base) - start; int ok, n, nargs = cast_int(L->top - L->base) - start;
clearerr(fp); clearerr(fp);
if (nargs == 0) { if (nargs == 0) {
ok = io_file_readline(L, fp); ok = io_file_readline(L, fp);
@ -242,7 +242,7 @@ static int io_file_write(lua_State *L, FILE *fp, int start)
} else if (tvisnum(tv)) { } else if (tvisnum(tv)) {
status = status && (fprintf(fp, LUA_NUMBER_FMT, numV(tv)) > 0); status = status && (fprintf(fp, LUA_NUMBER_FMT, numV(tv)) > 0);
} else { } else {
lj_lib_checkstr(L, tv-L->base+1); lj_err_argt(L, cast_int(tv - L->base) + 1, LUA_TSTRING);
} }
} }
return io_pushresult(L, status, NULL); return io_pushresult(L, status, NULL);

View File

@ -677,7 +677,7 @@ LJ_NORET LJ_NOINLINE static void err_argmsg(lua_State *L, int narg,
const char *fname = "?"; const char *fname = "?";
const char *ftype = getfuncname(L, L->base - 1, &fname); const char *ftype = getfuncname(L, L->base - 1, &fname);
if (narg < 0 && narg > LUA_REGISTRYINDEX) if (narg < 0 && narg > LUA_REGISTRYINDEX)
narg = (L->top - L->base) + narg + 1; narg = cast_int(L->top - L->base) + narg + 1;
if (ftype && ftype[3] == 'h' && --narg == 0) /* Check for "method". */ if (ftype && ftype[3] == 'h' && --narg == 0) /* Check for "method". */
msg = lj_str_pushf(L, err2msg(LJ_ERR_BADSELF), fname, msg); msg = lj_str_pushf(L, err2msg(LJ_ERR_BADSELF), fname, msg);
else else