diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-07-01 16:07:03 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-07-01 16:07:03 -0300 |
| commit | 03bf7fdd4f3a588cd7ff0a8c51ed68c596d3d575 (patch) | |
| tree | bfa342b45e957a96d48ae05e677a50ca9b91538e | |
| parent | 59a1adf194efe43741c2bb2005d93d8320a19d14 (diff) | |
| download | lua-03bf7fdd4f3a588cd7ff0a8c51ed68c596d3d575.tar.gz lua-03bf7fdd4f3a588cd7ff0a8c51ed68c596d3d575.tar.bz2 lua-03bf7fdd4f3a588cd7ff0a8c51ed68c596d3d575.zip | |
Added missing casts from lua_Unsigned to size_t
size_t can be smaller than lua_Usigned.
| -rw-r--r-- | lstrlib.c | 4 | ||||
| -rw-r--r-- | lundump.c | 2 |
2 files changed, 3 insertions, 3 deletions
| @@ -1811,8 +1811,8 @@ static int str_unpack (lua_State *L) { | |||
| 1811 | lua_Unsigned len = (lua_Unsigned)unpackint(L, data + pos, | 1811 | lua_Unsigned len = (lua_Unsigned)unpackint(L, data + pos, |
| 1812 | h.islittle, cast_int(size), 0); | 1812 | h.islittle, cast_int(size), 0); |
| 1813 | luaL_argcheck(L, len <= ld - pos - size, 2, "data string too short"); | 1813 | luaL_argcheck(L, len <= ld - pos - size, 2, "data string too short"); |
| 1814 | lua_pushlstring(L, data + pos + size, len); | 1814 | lua_pushlstring(L, data + pos + size, cast_sizet(len)); |
| 1815 | pos += len; /* skip string */ | 1815 | pos += cast_sizet(len); /* skip string */ |
| 1816 | break; | 1816 | break; |
| 1817 | } | 1817 | } |
| 1818 | case Kzstr: { | 1818 | case Kzstr: { |
| @@ -109,7 +109,7 @@ static lua_Unsigned loadVarint (LoadState *S, lua_Unsigned limit) { | |||
| 109 | 109 | ||
| 110 | 110 | ||
| 111 | static size_t loadSize (LoadState *S) { | 111 | static size_t loadSize (LoadState *S) { |
| 112 | return loadVarint(S, MAX_SIZE); | 112 | return cast_sizet(loadVarint(S, MAX_SIZE)); |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | 115 | ||
