mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
Merge #9508 from justinmk/pvs-warnings
This commit is contained in:
@@ -1541,7 +1541,7 @@ static void diff_read(int idx_orig, int idx_new, diffout_T *dout)
|
||||
diffstyle = DIFF_ED;
|
||||
} else if ((STRNCMP(line, "@@ ", 3) == 0)) {
|
||||
diffstyle = DIFF_UNIFIED;
|
||||
} else if ((STRNCMP(line, "--- ", 4) == 0)
|
||||
} else if ((STRNCMP(line, "--- ", 4) == 0) // -V501
|
||||
&& (vim_fgets(linebuf, LBUFLEN, fd) == 0) // -V501
|
||||
&& (STRNCMP(line, "+++ ", 4) == 0)
|
||||
&& (vim_fgets(linebuf, LBUFLEN, fd) == 0) // -V501
|
||||
|
@@ -19902,13 +19902,15 @@ void ex_function(exarg_T *eap)
|
||||
if (FUNCLINE(fp, j) == NULL)
|
||||
continue;
|
||||
msg_putchar('\n');
|
||||
msg_outnum((long)(j + 1));
|
||||
if (j < 9)
|
||||
msg_outnum((long)j + 1);
|
||||
if (j < 9) {
|
||||
msg_putchar(' ');
|
||||
if (j < 99)
|
||||
}
|
||||
if (j < 99) {
|
||||
msg_putchar(' ');
|
||||
msg_prt_line(FUNCLINE(fp, j), FALSE);
|
||||
ui_flush(); /* show a line at a time */
|
||||
}
|
||||
msg_prt_line(FUNCLINE(fp, j), false);
|
||||
ui_flush(); // show a line at a time
|
||||
os_breakcheck();
|
||||
}
|
||||
if (!got_int) {
|
||||
|
@@ -4895,7 +4895,7 @@ int find_help_tags(const char_u *arg, int *num_matches, char_u ***matches,
|
||||
}
|
||||
}
|
||||
|
||||
*matches = (char_u **)"";
|
||||
*matches = NULL;
|
||||
*num_matches = 0;
|
||||
int flags = TAG_HELP | TAG_REGEXP | TAG_NAMES | TAG_VERBOSE;
|
||||
if (keep_lang) {
|
||||
|
@@ -9191,33 +9191,38 @@ static int ses_winsizes(FILE *fd, int restore_size, win_T *tab_firstwin)
|
||||
|
||||
if (restore_size && (ssop_flags & SSOP_WINSIZE)) {
|
||||
for (wp = tab_firstwin; wp != NULL; wp = wp->w_next) {
|
||||
if (!ses_do_win(wp))
|
||||
if (!ses_do_win(wp)) {
|
||||
continue;
|
||||
++n;
|
||||
}
|
||||
n++;
|
||||
|
||||
/* restore height when not full height */
|
||||
// restore height when not full height
|
||||
if (wp->w_height + wp->w_status_height < topframe->fr_height
|
||||
&& (fprintf(fd,
|
||||
"exe '%dresize ' . ((&lines * %" PRId64
|
||||
" + %" PRId64 ") / %" PRId64 ")",
|
||||
n, (int64_t)wp->w_grid.Rows,
|
||||
(int64_t)(Rows / 2), (int64_t)Rows) < 0
|
||||
|| put_eol(fd) == FAIL))
|
||||
(int64_t)Rows / 2, (int64_t)Rows) < 0
|
||||
|| put_eol(fd) == FAIL)) {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
/* restore width when not full width */
|
||||
// restore width when not full width
|
||||
if (wp->w_width < Columns
|
||||
&& (fprintf(fd, "exe 'vert %dresize ' . ((&columns * %" PRId64
|
||||
" + %" PRId64 ") / %" PRId64 ")",
|
||||
n, (int64_t)wp->w_width, (int64_t)(Columns / 2),
|
||||
&& (fprintf(fd,
|
||||
"exe 'vert %dresize ' . ((&columns * %" PRId64
|
||||
" + %" PRId64 ") / %" PRId64 ")",
|
||||
n, (int64_t)wp->w_width, (int64_t)Columns / 2,
|
||||
(int64_t)Columns) < 0
|
||||
|| put_eol(fd) == FAIL))
|
||||
|| put_eol(fd) == FAIL)) {
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* Just equalise window sizes */
|
||||
if (put_line(fd, "wincmd =") == FAIL)
|
||||
// Just equalise window sizes
|
||||
if (put_line(fd, "wincmd =") == FAIL) {
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
@@ -9365,10 +9370,11 @@ put_view(
|
||||
* arguments may have been deleted, check if the index is valid. */
|
||||
if (wp->w_arg_idx != current_arg_idx && wp->w_arg_idx < WARGCOUNT(wp)
|
||||
&& flagp == &ssop_flags) {
|
||||
if (fprintf(fd, "%" PRId64 "argu", (int64_t)(wp->w_arg_idx + 1)) < 0
|
||||
|| put_eol(fd) == FAIL)
|
||||
if (fprintf(fd, "%" PRId64 "argu", (int64_t)wp->w_arg_idx + 1) < 0
|
||||
|| put_eol(fd) == FAIL) {
|
||||
return FAIL;
|
||||
did_next = TRUE;
|
||||
}
|
||||
did_next = true;
|
||||
}
|
||||
|
||||
/* Edit the file. Skip this when ":next" already did it. */
|
||||
@@ -9478,21 +9484,23 @@ put_view(
|
||||
return FAIL;
|
||||
} else {
|
||||
if (!wp->w_p_wrap && wp->w_leftcol > 0 && wp->w_width > 0) {
|
||||
if (fprintf(fd, "let s:c = %" PRId64 " - ((%" PRId64
|
||||
" * winwidth(0) + %" PRId64 ") / %" PRId64 ")",
|
||||
(int64_t)(wp->w_virtcol + 1),
|
||||
if (fprintf(fd,
|
||||
"let s:c = %" PRId64 " - ((%" PRId64
|
||||
" * winwidth(0) + %" PRId64 ") / %" PRId64 ")",
|
||||
(int64_t)wp->w_virtcol + 1,
|
||||
(int64_t)(wp->w_virtcol - wp->w_leftcol),
|
||||
(int64_t)(wp->w_width / 2),
|
||||
(int64_t)wp->w_width) < 0
|
||||
|| put_eol(fd) == FAIL
|
||||
|| put_line(fd, "if s:c > 0") == FAIL
|
||||
|| fprintf(fd, " exe 'normal! ' . s:c . '|zs' . %" PRId64 " . '|'",
|
||||
(int64_t)(wp->w_virtcol + 1)) < 0
|
||||
(int64_t)wp->w_virtcol + 1) < 0
|
||||
|| put_eol(fd) == FAIL
|
||||
|| put_line(fd, "else") == FAIL
|
||||
|| put_view_curpos(fd, wp, " ") == FAIL
|
||||
|| put_line(fd, "endif") == FAIL)
|
||||
|| put_line(fd, "endif") == FAIL) {
|
||||
return FAIL;
|
||||
}
|
||||
} else if (put_view_curpos(fd, wp, "") == FAIL) {
|
||||
return FAIL;
|
||||
}
|
||||
|
@@ -3393,14 +3393,11 @@ void cmdline_paste_str(char_u *s, int literally)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Delete characters on the command line, from "from" to the current
|
||||
* position.
|
||||
*/
|
||||
/// Delete characters on the command line, from "from" to the current position.
|
||||
static void cmdline_del(int from)
|
||||
{
|
||||
memmove(ccline.cmdbuff + from, ccline.cmdbuff + ccline.cmdpos,
|
||||
(size_t)(ccline.cmdlen - ccline.cmdpos + 1));
|
||||
(size_t)ccline.cmdlen - ccline.cmdpos + 1);
|
||||
ccline.cmdlen -= ccline.cmdpos - from;
|
||||
ccline.cmdpos = from;
|
||||
}
|
||||
@@ -3661,8 +3658,8 @@ nextwild (
|
||||
xp->xp_pattern = ccline.cmdbuff + i;
|
||||
}
|
||||
memmove(&ccline.cmdbuff[ccline.cmdpos + difflen],
|
||||
&ccline.cmdbuff[ccline.cmdpos],
|
||||
(size_t)(ccline.cmdlen - ccline.cmdpos + 1));
|
||||
&ccline.cmdbuff[ccline.cmdpos],
|
||||
(size_t)ccline.cmdlen - ccline.cmdpos + 1);
|
||||
memmove(&ccline.cmdbuff[i], p2, STRLEN(p2));
|
||||
ccline.cmdlen += difflen;
|
||||
ccline.cmdpos += difflen;
|
||||
@@ -4705,7 +4702,7 @@ ExpandFromContext (
|
||||
return ret;
|
||||
}
|
||||
|
||||
*file = (char_u **)"";
|
||||
*file = NULL;
|
||||
*num_file = 0;
|
||||
if (xp->xp_context == EXPAND_HELP) {
|
||||
/* With an empty argument we would get all the help tags, which is
|
||||
|
@@ -1072,16 +1072,14 @@ EXTERN char_u e_cmdmap_key[] INIT(=N_(
|
||||
EXTERN char top_bot_msg[] INIT(= N_("search hit TOP, continuing at BOTTOM"));
|
||||
EXTERN char bot_top_msg[] INIT(= N_("search hit BOTTOM, continuing at TOP"));
|
||||
|
||||
/* For undo we need to know the lowest time possible. */
|
||||
// For undo we need to know the lowest time possible.
|
||||
EXTERN time_t starttime;
|
||||
|
||||
EXTERN FILE *time_fd INIT(= NULL); /* where to write startup timing */
|
||||
|
||||
/*
|
||||
* Some compilers warn for not using a return value, but in some situations we
|
||||
* can't do anything useful with the value. Assign to this variable to avoid
|
||||
* the warning.
|
||||
*/
|
||||
// Some compilers warn for not using a return value, but in some situations we
|
||||
// can't do anything useful with the value. Assign to this variable to avoid
|
||||
// the warning.
|
||||
EXTERN int vim_ignored;
|
||||
|
||||
// Start a msgpack-rpc channel over stdin/stdout.
|
||||
|
@@ -3284,11 +3284,11 @@ void clear_showcmd(void)
|
||||
p_sbr = empty_option;
|
||||
getvcols(curwin, &curwin->w_cursor, &VIsual, &leftcol, &rightcol);
|
||||
p_sbr = saved_sbr;
|
||||
sprintf((char *)showcmd_buf, "%" PRId64 "x%" PRId64,
|
||||
(int64_t)lines, (int64_t)(rightcol - leftcol + 1));
|
||||
} else if (VIsual_mode == 'V' || VIsual.lnum != curwin->w_cursor.lnum)
|
||||
sprintf((char *)showcmd_buf, "%" PRId64, (int64_t)lines);
|
||||
else {
|
||||
snprintf((char *)showcmd_buf, SHOWCMD_BUFLEN, "%" PRId64 "x%" PRId64,
|
||||
(int64_t)lines, (int64_t)rightcol - leftcol + 1);
|
||||
} else if (VIsual_mode == 'V' || VIsual.lnum != curwin->w_cursor.lnum) {
|
||||
snprintf((char *)showcmd_buf, SHOWCMD_BUFLEN, "%" PRId64, (int64_t)lines);
|
||||
} else {
|
||||
char_u *s, *e;
|
||||
int l;
|
||||
int bytes = 0;
|
||||
@@ -4930,10 +4930,10 @@ get_visual_text (
|
||||
} else {
|
||||
if (lt(curwin->w_cursor, VIsual)) {
|
||||
*pp = ml_get_pos(&curwin->w_cursor);
|
||||
*lenp = (size_t)(VIsual.col - curwin->w_cursor.col + 1);
|
||||
*lenp = (size_t)VIsual.col - (size_t)curwin->w_cursor.col + 1;
|
||||
} else {
|
||||
*pp = ml_get_pos(&VIsual);
|
||||
*lenp = (size_t)(curwin->w_cursor.col - VIsual.col + 1);
|
||||
*lenp = (size_t)curwin->w_cursor.col - (size_t)VIsual.col + 1;
|
||||
}
|
||||
if (has_mbyte)
|
||||
/* Correct the length to include the whole last character. */
|
||||
|
@@ -1267,7 +1267,7 @@ int gen_expand_wildcards(int num_pat, char_u **pat, int *num_file,
|
||||
}
|
||||
|
||||
*num_file = ga.ga_len;
|
||||
*file = (ga.ga_data != NULL) ? (char_u **)ga.ga_data : (char_u **)"";
|
||||
*file = (ga.ga_data != NULL) ? (char_u **)ga.ga_data : NULL;
|
||||
|
||||
recursive = false;
|
||||
|
||||
|
Reference in New Issue
Block a user