diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-07-27 13:32:59 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-07-27 13:32:59 -0300 |
commit | 0acd55898d0aaae8dbc14c8a1bc1e3bdffc8701b (patch) | |
tree | 0ac634fed90877130b1f102bf4075af999de2158 /lauxlib.c | |
parent | 15231d4fb2f6984b25e0353ff46eda1a180b686d (diff) | |
download | lua-0acd55898d0aaae8dbc14c8a1bc1e3bdffc8701b.tar.gz lua-0acd55898d0aaae8dbc14c8a1bc1e3bdffc8701b.tar.bz2 lua-0acd55898d0aaae8dbc14c8a1bc1e3bdffc8701b.zip |
Added gcc option '-Wconversion'
No warnings for standard numerical types. Still pending alternative
numerical types.
Diffstat (limited to 'lauxlib.c')
-rw-r--r-- | lauxlib.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -539,7 +539,7 @@ static void newbox (lua_State *L) { | |||
539 | static size_t newbuffsize (luaL_Buffer *B, size_t sz) { | 539 | static size_t newbuffsize (luaL_Buffer *B, size_t sz) { |
540 | size_t newsize = (B->size / 2) * 3; /* buffer size * 1.5 */ | 540 | size_t newsize = (B->size / 2) * 3; /* buffer size * 1.5 */ |
541 | if (l_unlikely(sz > MAX_SIZE - B->n - 1)) | 541 | if (l_unlikely(sz > MAX_SIZE - B->n - 1)) |
542 | return luaL_error(B->L, "resulting string too large"); | 542 | return cast_sizet(luaL_error(B->L, "resulting string too large")); |
543 | if (newsize < B->n + sz + 1 || newsize > MAX_SIZE) { | 543 | if (newsize < B->n + sz + 1 || newsize > MAX_SIZE) { |
544 | /* newsize was not big enough or too big */ | 544 | /* newsize was not big enough or too big */ |
545 | newsize = B->n + sz + 1; | 545 | newsize = B->n + sz + 1; |
@@ -725,7 +725,7 @@ LUALIB_API void luaL_unref (lua_State *L, int t, int ref) { | |||
725 | */ | 725 | */ |
726 | 726 | ||
727 | typedef struct LoadF { | 727 | typedef struct LoadF { |
728 | int n; /* number of pre-read characters */ | 728 | unsigned n; /* number of pre-read characters */ |
729 | FILE *f; /* file being read */ | 729 | FILE *f; /* file being read */ |
730 | char buff[BUFSIZ]; /* area for reading file */ | 730 | char buff[BUFSIZ]; /* area for reading file */ |
731 | } LoadF; | 731 | } LoadF; |
@@ -825,7 +825,7 @@ LUALIB_API int luaL_loadfilex (lua_State *L, const char *filename, | |||
825 | } | 825 | } |
826 | } | 826 | } |
827 | if (c != EOF) | 827 | if (c != EOF) |
828 | lf.buff[lf.n++] = c; /* 'c' is the first character of the stream */ | 828 | lf.buff[lf.n++] = cast_char(c); /* 'c' is the first character */ |
829 | status = lua_load(L, getF, &lf, lua_tostring(L, -1), mode); | 829 | status = lua_load(L, getF, &lf, lua_tostring(L, -1), mode); |
830 | readstatus = ferror(lf.f); | 830 | readstatus = ferror(lf.f); |
831 | errno = 0; /* no useful error number until here */ | 831 | errno = 0; /* no useful error number until here */ |
@@ -1020,7 +1020,7 @@ LUALIB_API void luaL_addgsub (luaL_Buffer *b, const char *s, | |||
1020 | const char *wild; | 1020 | const char *wild; |
1021 | size_t l = strlen(p); | 1021 | size_t l = strlen(p); |
1022 | while ((wild = strstr(s, p)) != NULL) { | 1022 | while ((wild = strstr(s, p)) != NULL) { |
1023 | luaL_addlstring(b, s, wild - s); /* push prefix */ | 1023 | luaL_addlstring(b, s, ct_diff2sz(wild - s)); /* push prefix */ |
1024 | luaL_addstring(b, r); /* push replacement in place of pattern */ | 1024 | luaL_addstring(b, r); /* push replacement in place of pattern */ |
1025 | s = wild + l; /* continue after 'p' */ | 1025 | s = wild + l; /* continue after 'p' */ |
1026 | } | 1026 | } |