mirror of
https://github.com/neovim/neovim.git
synced 2025-09-27 21:48:35 +00:00
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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user