From a96fb6b1d00e5fded55fa541a88a99844772ac36 Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Fri, 4 Apr 2025 17:43:07 +0200 Subject: Fix 32 bits compilation warnings --- deep_userdata_example/deep_userdata_example.cpp | 16 ++++++++-------- 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_) // this is all we need to make a userdata lanes-clonable. no dependency on Lanes code. [[nodiscard]] -static int clonable_lanesclone(lua_State* L) +static int clonable_lanesclone(lua_State* const L_) { - switch (lua_gettop(L)) { + switch (lua_gettop(L_)) { case 3: { - MyClonableUserdata* self = static_cast(lua_touserdata(L, 1)); - MyClonableUserdata* from = static_cast(lua_touserdata(L, 2)); - size_t len = lua_tointeger(L, 3); - assert(len == sizeof(MyClonableUserdata)); - *self = *from; + MyClonableUserdata* const _self = static_cast(lua_touserdata(L_, 1)); + MyClonableUserdata* const _from = static_cast(lua_touserdata(L_, 2)); + auto const _len{ static_cast(lua_tointeger(L_, 3)) }; // make 32-bits builds happy + assert(_len == sizeof(MyClonableUserdata)); + *_self = *_from; } return 0; default: - raise_luaL_error(L, "Lanes called clonable_lanesclone with unexpected arguments"); + raise_luaL_error(L_, "Lanes called clonable_lanesclone with unexpected arguments"); } return 0; } 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 // we need to copy over the uservalues of the userdata as well { StackIndex const _mt{ luaG_absindex(L1, StackIndex{ -2 }) }; // L1: ... mt __lanesclone - size_t const userdata_size{ lua_rawlen(L1, _L1_i) }; + auto const userdata_size{ static_cast(lua_rawlen(L1, _L1_i)) }; // make 32-bits builds happy // extract all the uservalues, but don't transfer them yet UserValueCount const _nuv{ luaG_getalluservalues(L1, _L1_i) }; // L1: ... mt __lanesclone [uv]* // create the clone userdata with the required number of uservalue slots @@ -930,7 +930,7 @@ bool InterCopyContext::interCopyFunction() const _source = lua_touserdata(L1, -1); void* _clone{ nullptr }; // get the number of bytes to allocate for the clone - size_t const _userdata_size{ lua_rawlen(L1, kIdxTop) }; + auto const _userdata_size{ static_cast(lua_rawlen(L1, kIdxTop)) }; // make 32-bits builds happy { // extract uservalues (don't transfer them yet) UserValueCount const _nuv{ luaG_getalluservalues(L1, source_i) }; // L1: ... u [uv]* -- cgit v1.2.3-55-g6feb