Using LUAI_UAC* types more consistently on vararg calls

This commit is contained in:
Roberto Ierusalimschy
2016-12-20 16:37:00 -02:00
parent 24f6e236a3
commit 9903dd52a3
5 changed files with 35 additions and 24 deletions

View File

@@ -1,5 +1,5 @@
/*
** $Id: liolib.c,v 2.149 2016/05/02 14:03:19 roberto Exp roberto $
** $Id: liolib.c,v 2.150 2016/09/01 16:14:56 roberto Exp roberto $
** Standard I/O (and system) library
** See Copyright Notice in lua.h
*/
@@ -619,8 +619,10 @@ static int g_write (lua_State *L, FILE *f, int arg) {
if (lua_type(L, arg) == LUA_TNUMBER) {
/* optimization: could be done exactly as for strings */
int len = lua_isinteger(L, arg)
? fprintf(f, LUA_INTEGER_FMT, lua_tointeger(L, arg))
: fprintf(f, LUA_NUMBER_FMT, lua_tonumber(L, arg));
? fprintf(f, LUA_INTEGER_FMT,
(LUAI_UACINT)lua_tointeger(L, arg))
: fprintf(f, LUA_NUMBER_FMT,
(LUAI_UACNUMBER)lua_tonumber(L, arg));
status = status && (len > 0);
}
else {