diff options
author | Benoit Germain <benoit.germain@ubisoft.com> | 2025-04-04 17:43:07 +0200 |
---|---|---|
committer | Benoit Germain <benoit.germain@ubisoft.com> | 2025-04-04 17:43:07 +0200 |
commit | a96fb6b1d00e5fded55fa541a88a99844772ac36 (patch) | |
tree | 5603989e15ca0cac3c54db352a75ec184c76cf66 | |
parent | c3f3c6643ff90a5368a387367dce61d27428f42a (diff) | |
download | lanes-a96fb6b1d00e5fded55fa541a88a99844772ac36.tar.gz lanes-a96fb6b1d00e5fded55fa541a88a99844772ac36.tar.bz2 lanes-a96fb6b1d00e5fded55fa541a88a99844772ac36.zip |
Fix 32 bits compilation warnings
Diffstat (limited to '')
-rw-r--r-- | deep_userdata_example/deep_userdata_example.cpp | 16 | ||||
-rw-r--r-- | src/intercopycontext.cpp | 4 |
2 files changed, 10 insertions, 10 deletions
diff --git a/deep_userdata_example/deep_userdata_example.cpp b/deep_userdata_example/deep_userdata_example.cpp index a45cc7f..075cfbe 100644 --- a/deep_userdata_example/deep_userdata_example.cpp +++ b/deep_userdata_example/deep_userdata_example.cpp | |||
@@ -261,21 +261,21 @@ static int clonable_gc(lua_State* const L_) | |||
261 | 261 | ||
262 | // this is all we need to make a userdata lanes-clonable. no dependency on Lanes code. | 262 | // this is all we need to make a userdata lanes-clonable. no dependency on Lanes code. |
263 | [[nodiscard]] | 263 | [[nodiscard]] |
264 | static int clonable_lanesclone(lua_State* L) | 264 | static int clonable_lanesclone(lua_State* const L_) |
265 | { | 265 | { |
266 | switch (lua_gettop(L)) { | 266 | switch (lua_gettop(L_)) { |
267 | case 3: | 267 | case 3: |
268 | { | 268 | { |
269 | MyClonableUserdata* self = static_cast<MyClonableUserdata*>(lua_touserdata(L, 1)); | 269 | MyClonableUserdata* const _self = static_cast<MyClonableUserdata*>(lua_touserdata(L_, 1)); |
270 | MyClonableUserdata* from = static_cast<MyClonableUserdata*>(lua_touserdata(L, 2)); | 270 | MyClonableUserdata* const _from = static_cast<MyClonableUserdata*>(lua_touserdata(L_, 2)); |
271 | size_t len = lua_tointeger(L, 3); | 271 | auto const _len{ static_cast<size_t>(lua_tointeger(L_, 3)) }; // make 32-bits builds happy |
272 | assert(len == sizeof(MyClonableUserdata)); | 272 | assert(_len == sizeof(MyClonableUserdata)); |
273 | *self = *from; | 273 | *_self = *_from; |
274 | } | 274 | } |
275 | return 0; | 275 | return 0; |
276 | 276 | ||
277 | default: | 277 | default: |
278 | raise_luaL_error(L, "Lanes called clonable_lanesclone with unexpected arguments"); | 278 | raise_luaL_error(L_, "Lanes called clonable_lanesclone with unexpected arguments"); |
279 | } | 279 | } |
280 | return 0; | 280 | return 0; |
281 | } | 281 | } |
diff --git a/src/intercopycontext.cpp b/src/intercopycontext.cpp index d6716a3..93a8160 100644 --- a/src/intercopycontext.cpp +++ b/src/intercopycontext.cpp | |||
@@ -770,7 +770,7 @@ bool InterCopyContext::tryCopyClonable() const | |||
770 | // we need to copy over the uservalues of the userdata as well | 770 | // we need to copy over the uservalues of the userdata as well |
771 | { | 771 | { |
772 | StackIndex const _mt{ luaG_absindex(L1, StackIndex{ -2 }) }; // L1: ... mt __lanesclone | 772 | StackIndex const _mt{ luaG_absindex(L1, StackIndex{ -2 }) }; // L1: ... mt __lanesclone |
773 | size_t const userdata_size{ lua_rawlen(L1, _L1_i) }; | 773 | auto const userdata_size{ static_cast<size_t>(lua_rawlen(L1, _L1_i)) }; // make 32-bits builds happy |
774 | // extract all the uservalues, but don't transfer them yet | 774 | // extract all the uservalues, but don't transfer them yet |
775 | UserValueCount const _nuv{ luaG_getalluservalues(L1, _L1_i) }; // L1: ... mt __lanesclone [uv]* | 775 | UserValueCount const _nuv{ luaG_getalluservalues(L1, _L1_i) }; // L1: ... mt __lanesclone [uv]* |
776 | // create the clone userdata with the required number of uservalue slots | 776 | // create the clone userdata with the required number of uservalue slots |
@@ -930,7 +930,7 @@ bool InterCopyContext::interCopyFunction() const | |||
930 | _source = lua_touserdata(L1, -1); | 930 | _source = lua_touserdata(L1, -1); |
931 | void* _clone{ nullptr }; | 931 | void* _clone{ nullptr }; |
932 | // get the number of bytes to allocate for the clone | 932 | // get the number of bytes to allocate for the clone |
933 | size_t const _userdata_size{ lua_rawlen(L1, kIdxTop) }; | 933 | auto const _userdata_size{ static_cast<size_t>(lua_rawlen(L1, kIdxTop)) }; // make 32-bits builds happy |
934 | { | 934 | { |
935 | // extract uservalues (don't transfer them yet) | 935 | // extract uservalues (don't transfer them yet) |
936 | UserValueCount const _nuv{ luaG_getalluservalues(L1, source_i) }; // L1: ... u [uv]* | 936 | UserValueCount const _nuv{ luaG_getalluservalues(L1, source_i) }; // L1: ... u [uv]* |