PVS/V1028: cast operands, not the result

This commit is contained in:
Justin M. Keyes
2019-01-15 22:20:26 +01:00
parent dca0da4e3f
commit ed171f7be2
4 changed files with 46 additions and 39 deletions

View File

@@ -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) {

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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. */