aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-01-15 22:20:26 +0100
committerJustin M. Keyes <justinkz@gmail.com>2019-01-18 00:09:50 +0100
commited171f7be29f7337aaba8c420406afc8a58c1613 (patch)
treeecee5c4316c5e02603b3f779ea769b4698d8d21f /src
parentdca0da4e3fa68b3da28a4571488e2c7d805615cf (diff)
downloadrneovim-ed171f7be29f7337aaba8c420406afc8a58c1613.tar.gz
rneovim-ed171f7be29f7337aaba8c420406afc8a58c1613.tar.bz2
rneovim-ed171f7be29f7337aaba8c420406afc8a58c1613.zip
PVS/V1028: cast operands, not the result
Diffstat (limited to 'src')
-rw-r--r--src/nvim/eval.c12
-rw-r--r--src/nvim/ex_docmd.c48
-rw-r--r--src/nvim/ex_getln.c11
-rw-r--r--src/nvim/normal.c14
4 files changed, 46 insertions, 39 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 4cf8a01ddb..85b838e443 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -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) {
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index f5c16d883a..ae618bfc61 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -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;
}
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 8efb027575..32620ac3c2 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -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;
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index 0e3946740a..0dc5f3175d 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -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. */