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 /liolib.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 'liolib.c')
-rw-r--r-- | liolib.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -443,7 +443,7 @@ static int nextc (RN *rn) { | |||
443 | return 0; /* fail */ | 443 | return 0; /* fail */ |
444 | } | 444 | } |
445 | else { | 445 | else { |
446 | rn->buff[rn->n++] = rn->c; /* save current char */ | 446 | rn->buff[rn->n++] = cast_char(rn->c); /* save current char */ |
447 | rn->c = l_getc(rn->f); /* read next one */ | 447 | rn->c = l_getc(rn->f); /* read next one */ |
448 | return 1; | 448 | return 1; |
449 | } | 449 | } |
@@ -524,15 +524,15 @@ static int read_line (lua_State *L, FILE *f, int chop) { | |||
524 | luaL_buffinit(L, &b); | 524 | luaL_buffinit(L, &b); |
525 | do { /* may need to read several chunks to get whole line */ | 525 | do { /* may need to read several chunks to get whole line */ |
526 | char *buff = luaL_prepbuffer(&b); /* preallocate buffer space */ | 526 | char *buff = luaL_prepbuffer(&b); /* preallocate buffer space */ |
527 | int i = 0; | 527 | unsigned i = 0; |
528 | l_lockfile(f); /* no memory errors can happen inside the lock */ | 528 | l_lockfile(f); /* no memory errors can happen inside the lock */ |
529 | while (i < LUAL_BUFFERSIZE && (c = l_getc(f)) != EOF && c != '\n') | 529 | while (i < LUAL_BUFFERSIZE && (c = l_getc(f)) != EOF && c != '\n') |
530 | buff[i++] = c; /* read up to end of line or buffer limit */ | 530 | buff[i++] = cast_char(c); /* read up to end of line or buffer limit */ |
531 | l_unlockfile(f); | 531 | l_unlockfile(f); |
532 | luaL_addsize(&b, i); | 532 | luaL_addsize(&b, i); |
533 | } while (c != EOF && c != '\n'); /* repeat until end of line */ | 533 | } while (c != EOF && c != '\n'); /* repeat until end of line */ |
534 | if (!chop && c == '\n') /* want a newline and have one? */ | 534 | if (!chop && c == '\n') /* want a newline and have one? */ |
535 | luaL_addchar(&b, c); /* add ending newline to result */ | 535 | luaL_addchar(&b, '\n'); /* add ending newline to result */ |
536 | luaL_pushresult(&b); /* close buffer */ | 536 | luaL_pushresult(&b); /* close buffer */ |
537 | /* return ok if read something (either a newline or something else) */ | 537 | /* return ok if read something (either a newline or something else) */ |
538 | return (c == '\n' || lua_rawlen(L, -1) > 0); | 538 | return (c == '\n' || lua_rawlen(L, -1) > 0); |