From 0acd55898d0aaae8dbc14c8a1bc1e3bdffc8701b Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Sat, 27 Jul 2024 13:32:59 -0300 Subject: Added gcc option '-Wconversion' No warnings for standard numerical types. Still pending alternative numerical types. --- lauxlib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lauxlib.c') diff --git a/lauxlib.c b/lauxlib.c index 5aeec55f..b70b7ae6 100644 --- a/lauxlib.c +++ b/lauxlib.c @@ -539,7 +539,7 @@ static void newbox (lua_State *L) { static size_t newbuffsize (luaL_Buffer *B, size_t sz) { size_t newsize = (B->size / 2) * 3; /* buffer size * 1.5 */ if (l_unlikely(sz > MAX_SIZE - B->n - 1)) - return luaL_error(B->L, "resulting string too large"); + return cast_sizet(luaL_error(B->L, "resulting string too large")); if (newsize < B->n + sz + 1 || newsize > MAX_SIZE) { /* newsize was not big enough or too big */ newsize = B->n + sz + 1; @@ -725,7 +725,7 @@ LUALIB_API void luaL_unref (lua_State *L, int t, int ref) { */ typedef struct LoadF { - int n; /* number of pre-read characters */ + unsigned n; /* number of pre-read characters */ FILE *f; /* file being read */ char buff[BUFSIZ]; /* area for reading file */ } LoadF; @@ -825,7 +825,7 @@ LUALIB_API int luaL_loadfilex (lua_State *L, const char *filename, } } if (c != EOF) - lf.buff[lf.n++] = c; /* 'c' is the first character of the stream */ + lf.buff[lf.n++] = cast_char(c); /* 'c' is the first character */ status = lua_load(L, getF, &lf, lua_tostring(L, -1), mode); readstatus = ferror(lf.f); errno = 0; /* no useful error number until here */ @@ -1020,7 +1020,7 @@ LUALIB_API void luaL_addgsub (luaL_Buffer *b, const char *s, const char *wild; size_t l = strlen(p); while ((wild = strstr(s, p)) != NULL) { - luaL_addlstring(b, s, wild - s); /* push prefix */ + luaL_addlstring(b, s, ct_diff2sz(wild - s)); /* push prefix */ luaL_addstring(b, r); /* push replacement in place of pattern */ s = wild + l; /* continue after 'p' */ } -- cgit v1.2.3-55-g6feb