aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2021-09-24 05:13:55 -0700
committerGitHub <noreply@github.com>2021-09-24 05:13:55 -0700
commitbc570b00641386f6c60b24bc2207661b7551ca10 (patch)
tree9bce911896cb8b9f87f61b2a5e4bb704f3204b99 /src
parent55d1e630b4d66ecb774824c9839e7f5821d23341 (diff)
parent03ed72642ddfe6a603673efdc0998a154e581b88 (diff)
downloadrneovim-bc570b00641386f6c60b24bc2207661b7551ca10.tar.gz
rneovim-bc570b00641386f6c60b24bc2207661b7551ca10.tar.bz2
rneovim-bc570b00641386f6c60b24bc2207661b7551ca10.zip
Merge #15774 fix(pvs): fix warnings, script
Diffstat (limited to 'src')
-rw-r--r--src/nvim/buffer.c5
-rw-r--r--src/nvim/eval.c2
-rw-r--r--src/nvim/ex_cmds2.c2
-rw-r--r--src/nvim/ex_session.c6
-rw-r--r--src/nvim/memory.c2
5 files changed, 10 insertions, 7 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 2b5325a917..c58eb1610e 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -3112,12 +3112,13 @@ void fileinfo(int fullname, // when non-zero print full path
(size_t)(IOSIZE - (p - buffer)), true);
}
+ bool dontwrite = bt_dontwrite(curbuf);
vim_snprintf_add((char *)buffer, IOSIZE, "\"%s%s%s%s%s%s",
curbufIsChanged()
? (shortmess(SHM_MOD) ? " [+]" : _(" [Modified]")) : " ",
- (curbuf->b_flags & BF_NOTEDITED) && !bt_dontwrite(curbuf)
+ (curbuf->b_flags & BF_NOTEDITED) && !dontwrite
? _("[Not edited]") : "",
- (curbuf->b_flags & BF_NEW) && !bt_dontwrite(curbuf)
+ (curbuf->b_flags & BF_NEW) && !dontwrite
? new_file_message() : "",
(curbuf->b_flags & BF_READERR)
? _("[Read errors]") : "",
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index ae64732eb9..0b73d6b37f 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -6193,7 +6193,7 @@ int assert_inrange(typval_T *argvars)
char msg[55];
vim_snprintf(msg, sizeof(msg),
"range %" PRIdVARNUMBER " - %" PRIdVARNUMBER ",",
- lower, upper);
+ lower, upper); // -V576
fill_assert_error(&ga, &argvars[3], (char_u *)msg, NULL, &argvars[2],
ASSERT_INRANGE);
assert_error(&ga);
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index d8827f0a3d..1a576bd891 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -1950,7 +1950,7 @@ static int source_using_linegetter(void *cookie, LineGetter fgetline, const char
snprintf((char *)sourcing_name_buf, sizeof(sourcing_name_buf),
"%s called at %s:%" PRIdLINENR, traceback_name, save_sourcing_name,
save_sourcing_lnum);
- sourcing_name = sourcing_name_buf;
+ sourcing_name = sourcing_name_buf; // -V507 reassigned below, before return.
}
sourcing_lnum = 0;
diff --git a/src/nvim/ex_session.c b/src/nvim/ex_session.c
index 11e8353e3a..4aadd77d45 100644
--- a/src/nvim/ex_session.c
+++ b/src/nvim/ex_session.c
@@ -450,11 +450,11 @@ static int put_view(FILE *fd, win_T *wp, int add_edit, unsigned *flagp, int curr
}
} else if (fprintf(fd,
"let s:l = %" PRIdLINENR " - ((%" PRIdLINENR
- " * winheight(0) + %" PRId64 ") / %" PRId64 ")\n",
+ " * winheight(0) + %d) / %d)\n",
wp->w_cursor.lnum,
wp->w_cursor.lnum - wp->w_topline,
- (int64_t)(wp->w_height_inner / 2),
- (int64_t)wp->w_height_inner) < 0) {
+ (wp->w_height_inner / 2),
+ wp->w_height_inner) < 0) {
return FAIL;
}
if (fprintf(fd,
diff --git a/src/nvim/memory.c b/src/nvim/memory.c
index cc9c047fa0..0f5f4c1e40 100644
--- a/src/nvim/memory.c
+++ b/src/nvim/memory.c
@@ -170,6 +170,8 @@ void *xrealloc(void *ptr, size_t size)
/// xmalloc() wrapper that allocates size + 1 bytes and zeroes the last byte
///
+/// Commonly used to allocate strings, e.g. `char *s = xmallocz(len)`.
+///
/// @see {xmalloc}
/// @param size
/// @return pointer to allocated space. Never NULL