mirror of
https://github.com/neovim/neovim.git
synced 2025-09-30 23:18:33 +00:00
build: enable MSVC level 3 warnings (#21934)
MSVC has 4 different warning levels: 1 (severe), 2 (significant), 3 (production quality) and 4 (informational). Enabling level 3 warnings mostly revealed conversion problems, similar to GCC/clang -Wconversion flag.
This commit is contained in:
@@ -78,20 +78,20 @@ static int regex_match_line(lua_State *lstate)
|
||||
return luaL_error(lstate, "not enough args");
|
||||
}
|
||||
|
||||
long bufnr = luaL_checkinteger(lstate, 2);
|
||||
handle_T bufnr = (handle_T)luaL_checkinteger(lstate, 2);
|
||||
linenr_T rownr = (linenr_T)luaL_checkinteger(lstate, 3);
|
||||
long start = 0, end = -1;
|
||||
int start = 0, end = -1;
|
||||
if (narg >= 4) {
|
||||
start = luaL_checkinteger(lstate, 4);
|
||||
start = (int)luaL_checkinteger(lstate, 4);
|
||||
}
|
||||
if (narg >= 5) {
|
||||
end = luaL_checkinteger(lstate, 5);
|
||||
end = (int)luaL_checkinteger(lstate, 5);
|
||||
if (end < 0) {
|
||||
return luaL_error(lstate, "invalid end");
|
||||
}
|
||||
}
|
||||
|
||||
buf_T *buf = bufnr ? handle_get_buffer((int)bufnr) : curbuf;
|
||||
buf_T *buf = bufnr ? handle_get_buffer(bufnr) : curbuf;
|
||||
if (!buf || buf->b_ml.ml_mfp == NULL) {
|
||||
return luaL_error(lstate, "invalid buffer");
|
||||
}
|
||||
@@ -218,7 +218,7 @@ static int nlua_str_utf_start(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
size_t s1_len;
|
||||
const char *s1 = luaL_checklstring(lstate, 1, &s1_len);
|
||||
long offset = luaL_checkinteger(lstate, 2);
|
||||
ptrdiff_t offset = luaL_checkinteger(lstate, 2);
|
||||
if (offset < 0 || offset > (intptr_t)s1_len) {
|
||||
return luaL_error(lstate, "index out of range");
|
||||
}
|
||||
@@ -238,7 +238,7 @@ static int nlua_str_utf_end(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
size_t s1_len;
|
||||
const char *s1 = luaL_checklstring(lstate, 1, &s1_len);
|
||||
long offset = luaL_checkinteger(lstate, 2);
|
||||
ptrdiff_t offset = luaL_checkinteger(lstate, 2);
|
||||
if (offset < 0 || offset > (intptr_t)s1_len) {
|
||||
return luaL_error(lstate, "index out of range");
|
||||
}
|
||||
|
@@ -393,7 +393,7 @@ static int parser_parse(lua_State *L)
|
||||
TSTree *new_tree = NULL;
|
||||
size_t len;
|
||||
const char *str;
|
||||
long bufnr;
|
||||
handle_T bufnr;
|
||||
buf_T *buf;
|
||||
TSInput input;
|
||||
|
||||
@@ -406,13 +406,13 @@ static int parser_parse(lua_State *L)
|
||||
break;
|
||||
|
||||
case LUA_TNUMBER:
|
||||
bufnr = lua_tointeger(L, 3);
|
||||
buf = handle_get_buffer((handle_T)bufnr);
|
||||
bufnr = (handle_T)lua_tointeger(L, 3);
|
||||
buf = handle_get_buffer(bufnr);
|
||||
|
||||
if (!buf) {
|
||||
#define BUFSIZE 256
|
||||
char ebuf[BUFSIZE] = { 0 };
|
||||
vim_snprintf(ebuf, BUFSIZE, "invalid buffer handle: %ld", bufnr);
|
||||
vim_snprintf(ebuf, BUFSIZE, "invalid buffer handle: %d", bufnr);
|
||||
return luaL_argerror(L, 3, ebuf);
|
||||
#undef BUFSIZE
|
||||
}
|
||||
@@ -898,8 +898,8 @@ static int node_child(lua_State *L)
|
||||
if (!node_check(L, 1, &node)) {
|
||||
return 0;
|
||||
}
|
||||
long num = lua_tointeger(L, 2);
|
||||
TSNode child = ts_node_child(node, (uint32_t)num);
|
||||
uint32_t num = (uint32_t)lua_tointeger(L, 2);
|
||||
TSNode child = ts_node_child(node, num);
|
||||
|
||||
push_node(L, child, 1);
|
||||
return 1;
|
||||
@@ -911,8 +911,8 @@ static int node_named_child(lua_State *L)
|
||||
if (!node_check(L, 1, &node)) {
|
||||
return 0;
|
||||
}
|
||||
long num = lua_tointeger(L, 2);
|
||||
TSNode child = ts_node_named_child(node, (uint32_t)num);
|
||||
uint32_t num = (uint32_t)lua_tointeger(L, 2);
|
||||
TSNode child = ts_node_named_child(node, num);
|
||||
|
||||
push_node(L, child, 1);
|
||||
return 1;
|
||||
|
@@ -257,13 +257,13 @@ static NluaXdiffMode process_xdl_diff_opts(lua_State *lstate, xdemitconf_t *cfg,
|
||||
if (check_xdiff_opt(v->type, kObjectTypeInteger, "ctxlen", err)) {
|
||||
goto exit_1;
|
||||
}
|
||||
cfg->ctxlen = v->data.integer;
|
||||
cfg->ctxlen = (long)v->data.integer;
|
||||
} else if (strequal("interhunkctxlen", k.data)) {
|
||||
if (check_xdiff_opt(v->type, kObjectTypeInteger, "interhunkctxlen",
|
||||
err)) {
|
||||
goto exit_1;
|
||||
}
|
||||
cfg->interhunkctxlen = v->data.integer;
|
||||
cfg->interhunkctxlen = (long)v->data.integer;
|
||||
} else if (strequal("linematch", k.data)) {
|
||||
*linematch = api_object_to_bool(*v, "linematch", false, err);
|
||||
if (ERROR_SET(err)) {
|
||||
|
Reference in New Issue
Block a user