Added gcc option '-Wconversion'

No warnings for standard numerical types. Still pending alternative
numerical types.
This commit is contained in:
Roberto Ierusalimschy
2024-07-27 13:32:59 -03:00
parent 15231d4fb2
commit 0acd55898d
44 changed files with 398 additions and 359 deletions

View File

@@ -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' */
}