diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-10-29 13:11:41 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-10-29 13:11:41 -0200 |
commit | 789e423b328b3483a11b0d85f92d4c5016388fa0 (patch) | |
tree | 8fdc4696516bea09b0f297ef23fbc67fb2ac40d4 /lstrlib.c | |
parent | 96ec8671b1174ba2110c5a36d993a96921511b20 (diff) | |
download | lua-789e423b328b3483a11b0d85f92d4c5016388fa0.tar.gz lua-789e423b328b3483a11b0d85f92d4c5016388fa0.tar.bz2 lua-789e423b328b3483a11b0d85f92d4c5016388fa0.zip |
corrected comparisons of signed (int) with unsigned (size_t)
Diffstat (limited to 'lstrlib.c')
-rw-r--r-- | lstrlib.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstrlib.c,v 1.235 2015/10/08 15:53:05 roberto Exp roberto $ | 2 | ** $Id: lstrlib.c,v 1.236 2015/10/28 17:56:51 roberto Exp roberto $ |
3 | ** Standard library for string operations and pattern-matching | 3 | ** Standard library for string operations and pattern-matching |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -1339,11 +1339,11 @@ static int str_pack (lua_State *L) { | |||
1339 | case Kchar: { /* fixed-size string */ | 1339 | case Kchar: { /* fixed-size string */ |
1340 | size_t len; | 1340 | size_t len; |
1341 | const char *s = luaL_checklstring(L, arg, &len); | 1341 | const char *s = luaL_checklstring(L, arg, &len); |
1342 | if (size <= len) /* string larger than (or equal to) needed? */ | 1342 | if ((size_t)size <= len) /* string larger than (or equal to) needed? */ |
1343 | luaL_addlstring(&b, s, size); /* truncate string to asked size */ | 1343 | luaL_addlstring(&b, s, size); /* truncate string to asked size */ |
1344 | else { /* string smaller than needed */ | 1344 | else { /* string smaller than needed */ |
1345 | luaL_addlstring(&b, s, len); /* add it all */ | 1345 | luaL_addlstring(&b, s, len); /* add it all */ |
1346 | while (len++ < size) /* pad extra space */ | 1346 | while (len++ < (size_t)size) /* pad extra space */ |
1347 | luaL_addchar(&b, LUA_PACKPADBYTE); | 1347 | luaL_addchar(&b, LUA_PACKPADBYTE); |
1348 | } | 1348 | } |
1349 | break; | 1349 | break; |