From acc646ad8fc3ef11fcc63b69f3d8484e4a91accd Mon Sep 17 00:00:00 2001 From: dundargoc Date: Fri, 29 Sep 2023 14:58:48 +0200 Subject: refactor: the long goodbye long is 32 bits on windows, while it is 64 bits on other architectures. This makes the type suboptimal for a codebase meant to be cross-platform. Replace it with more appropriate integer types. --- src/nvim/lua/stdlib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/nvim/lua/stdlib.c') diff --git a/src/nvim/lua/stdlib.c b/src/nvim/lua/stdlib.c index 60be771b6c..606c9878e6 100644 --- a/src/nvim/lua/stdlib.c +++ b/src/nvim/lua/stdlib.c @@ -183,8 +183,8 @@ int nlua_str_utfindex(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL size_t codepoints = 0, codeunits = 0; mb_utflen(s1, (size_t)idx, &codepoints, &codeunits); - lua_pushinteger(lstate, (long)codepoints); - lua_pushinteger(lstate, (long)codeunits); + lua_pushinteger(lstate, (lua_Integer)codepoints); + lua_pushinteger(lstate, (lua_Integer)codeunits); return 2; } @@ -204,7 +204,7 @@ static int nlua_str_utf_pos(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL size_t clen; for (size_t i = 0; i < s1_len && s1[i] != NUL; i += clen) { clen = (size_t)utf_ptr2len_len(s1 + i, (int)(s1_len - i)); - lua_pushinteger(lstate, (long)i + 1); + lua_pushinteger(lstate, (lua_Integer)i + 1); lua_rawseti(lstate, -2, (int)idx); idx++; } @@ -276,7 +276,7 @@ int nlua_str_byteindex(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL return luaL_error(lstate, "index out of range"); } - lua_pushinteger(lstate, (long)byteidx); + lua_pushinteger(lstate, (lua_Integer)byteidx); return 1; } -- cgit