From ed171f7be29f7337aaba8c420406afc8a58c1613 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 15 Jan 2019 22:20:26 +0100 Subject: PVS/V1028: cast operands, not the result --- src/nvim/ex_getln.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/nvim/ex_getln.c') 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; -- cgit From ea7491586fccb2ce6de43b77fd0bd06b6dbaa17d Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Wed, 16 Jan 2019 00:10:41 +0100 Subject: PVS/V1032: pointer cast to a more strictly aligned type --- src/nvim/ex_getln.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/ex_getln.c') diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 32620ac3c2..adba3d4e7e 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -4702,7 +4702,7 @@ ExpandFromContext ( return ret; } - *file = (char_u **)""; + *file = &vim_emptystr; *num_file = 0; if (xp->xp_context == EXPAND_HELP) { /* With an empty argument we would get all the help tags, which is -- cgit From aa39fc56f68e2087a2327bcd03cc5f3d2dc9a696 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Thu, 17 Jan 2019 23:43:43 +0100 Subject: PVS/V1032: pointer cast to a more strictly aligned type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rework-of: ea7491586fcc Helped-by: Björn Linse - The old (Vim) use of (char_u **)"" before ea7491586fcc is garbage, which hints that this value was never used. - The necessary condition is next to the NULL assigmnent, the pointer would only be started to be accessed, if the length assignment next to it is also changed. --- src/nvim/ex_getln.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/ex_getln.c') diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index adba3d4e7e..786769dc7d 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -4702,7 +4702,7 @@ ExpandFromContext ( return ret; } - *file = &vim_emptystr; + *file = NULL; *num_file = 0; if (xp->xp_context == EXPAND_HELP) { /* With an empty argument we would get all the help tags, which is -- cgit