mirror of
https://github.com/neovim/neovim.git
synced 2024-12-26 14:11:15 -07:00
refactor: fix clang and PVS warnings (#19532)
This commit is contained in:
parent
7d9e68669c
commit
e0c433833f
@ -514,6 +514,7 @@ static const char *list_arg_vars(exarg_T *eap, const char *arg, int *first)
|
||||
const char *const used_name = (arg == arg_subsc
|
||||
? name
|
||||
: name_start);
|
||||
assert(used_name != NULL);
|
||||
const ptrdiff_t name_size = (used_name == tofree
|
||||
? (ptrdiff_t)strlen(used_name)
|
||||
: (arg - used_name));
|
||||
|
@ -3052,6 +3052,7 @@ char *find_ex_command(exarg_T *eap, int *full)
|
||||
} else {
|
||||
eap->cmdidx = CMD_bang;
|
||||
}
|
||||
assert(eap->cmdidx >= 0);
|
||||
|
||||
for (; (int)eap->cmdidx < CMD_SIZE;
|
||||
eap->cmdidx = (cmdidx_T)((int)eap->cmdidx + 1)) {
|
||||
|
@ -3336,7 +3336,7 @@ static void ui_ext_cmdline_show(CmdlineInfo *line)
|
||||
{
|
||||
Arena arena = ARENA_EMPTY;
|
||||
arena_start(&arena, &ui_ext_fixblk);
|
||||
Array content = ARRAY_DICT_INIT;
|
||||
Array content;
|
||||
if (cmdline_star) {
|
||||
content = arena_array(&arena, 1);
|
||||
size_t len = 0;
|
||||
|
@ -956,8 +956,8 @@ void do_highlight(const char *line, const bool forceit, const bool init)
|
||||
linep++;
|
||||
}
|
||||
size_t key_len = (size_t)(linep - key_start);
|
||||
if (key_len > sizeof key - 1) {
|
||||
semsg(_("E423: Illegal argument"));
|
||||
if (key_len > sizeof(key) - 1) {
|
||||
emsg(_("E423: Illegal argument"));
|
||||
error = true;
|
||||
break;
|
||||
}
|
||||
@ -1004,8 +1004,8 @@ void do_highlight(const char *line, const bool forceit, const bool init)
|
||||
break;
|
||||
}
|
||||
size_t arg_len = (size_t)(linep - arg_start);
|
||||
if (arg_len > sizeof arg - 1) {
|
||||
semsg(_("E423: Illegal argument"));
|
||||
if (arg_len > sizeof(arg) - 1) {
|
||||
emsg(_("E423: Illegal argument"));
|
||||
error = true;
|
||||
break;
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ static bool v_do_log_to_file(FILE *log_file, int log_level, const char *context,
|
||||
const char *parent = path_tail(os_getenv(ENV_NVIM));
|
||||
// Servername. Empty until starting=false.
|
||||
const char *serv = path_tail(get_vim_var_str(VV_SEND_SERVER));
|
||||
if (parent && parent[0] != NUL) {
|
||||
if (parent[0] != NUL) {
|
||||
snprintf(name, sizeof(name), "%s/c", parent); // "/c" indicates child.
|
||||
} else if (serv[0] != NUL) {
|
||||
snprintf(name, sizeof(name), "%s", serv);
|
||||
|
@ -491,7 +491,7 @@ fmark_T *mark_get_visual(buf_T *buf, int name)
|
||||
mark = pos_to_mark(buf, NULL, endp);
|
||||
}
|
||||
|
||||
if (mark != NULL && buf->b_visual.vi_mode == 'V') {
|
||||
if (buf->b_visual.vi_mode == 'V') {
|
||||
if (name == '<') {
|
||||
mark->mark.col = 0;
|
||||
} else {
|
||||
|
@ -425,8 +425,8 @@ redo:
|
||||
arena_start(&p->arena, &p->reuse_blk);
|
||||
p->grid_line_event = arena_alloc(&p->arena, sizeof *p->grid_line_event, true);
|
||||
g = p->grid_line_event;
|
||||
FALLTHROUGH;
|
||||
}
|
||||
FALLTHROUGH;
|
||||
|
||||
case 13:
|
||||
NEXT_TYPE(tok, MPACK_TOKEN_ARRAY);
|
||||
|
@ -5102,6 +5102,7 @@ static void nv_brackets(cmdarg_T *cap)
|
||||
} else if (cap->nchar == '\'' || cap->nchar == '`') {
|
||||
// "['", "[`", "]'" and "]`": jump to next mark
|
||||
fmark_T *fm = pos_to_mark(curbuf, NULL, curwin->w_cursor);
|
||||
assert(fm != NULL);
|
||||
fmark_T *prev_fm;
|
||||
for (n = cap->count1; n > 0; n--) {
|
||||
prev_fm = fm;
|
||||
|
@ -2119,7 +2119,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
|
||||
bool has_decor = false; // this buffer has decoration
|
||||
int win_col_offset = 0; // offset for window columns
|
||||
|
||||
char_u buf_fold[FOLD_TEXT_LEN + 1]; // Hold value returned by get_foldtext
|
||||
char_u buf_fold[FOLD_TEXT_LEN]; // Hold value returned by get_foldtext
|
||||
|
||||
bool area_active = false;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user