Merge #9458 from justinmk/pvs-warnings

This commit is contained in:
Justin M. Keyes 2019-01-06 02:32:30 +01:00 committed by GitHub
commit f3d2d3c814
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 16 deletions

View File

@ -1542,7 +1542,7 @@ static void diff_read(int idx_orig, int idx_new, diffout_T *dout)
} else if ((STRNCMP(line, "@@ ", 3) == 0)) {
diffstyle = DIFF_UNIFIED;
} else if ((STRNCMP(line, "--- ", 4) == 0)
&& (vim_fgets(linebuf, LBUFLEN, fd) == 0)
&& (vim_fgets(linebuf, LBUFLEN, fd) == 0) // -V501
&& (STRNCMP(line, "+++ ", 4) == 0)
&& (vim_fgets(linebuf, LBUFLEN, fd) == 0) // -V501
&& (STRNCMP(line, "@@ ", 3) == 0)) {

View File

@ -6197,9 +6197,6 @@ static int open_cmdwin(void)
stuffReadbuff(p);
stuffcharReadbuff(CAR);
}
} else if (cmdwin_result == K_XF2) { /* :qa typed */
ccline.cmdbuff = vim_strsave((char_u *)"qa");
cmdwin_result = CAR;
} else if (cmdwin_result == Ctrl_C) {
/* :q or :close, don't execute any command
* and don't modify the cmd window. */

View File

@ -544,10 +544,8 @@ int get_expr_indent(void)
// Need to make a copy, the 'indentexpr' option could be changed while
// evaluating it.
char_u *inde_copy = vim_strsave(curbuf->b_p_inde);
if (inde_copy != NULL) {
indent = (int)eval_to_number(inde_copy);
xfree(inde_copy);
}
indent = (int)eval_to_number(inde_copy);
xfree(inde_copy);
if (use_sandbox) {
sandbox--;

View File

@ -1,11 +1,11 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
/*
* normal.c: Contains the main routine for processing characters in command
* mode. Communicates closely with the code in ops.c to handle
* the operators.
*/
//
// normal.c: Contains the main routine for processing characters in command
// mode. Communicates closely with the code in ops.c to handle
// the operators.
//
#include <assert.h>
#include <inttypes.h>
@ -3939,9 +3939,11 @@ static bool nv_screengo(oparg_T *oap, int dir, long dist)
(void)hasFolding(curwin->w_cursor.lnum,
&curwin->w_cursor.lnum, NULL);
linelen = linetabsize(get_cursor_line_ptr());
if (linelen > width1)
curwin->w_curswant += (((linelen - width1 - 1) / width2)
+ 1) * width2;
if (linelen > width1) {
int w = (((linelen - width1 - 1) / width2) + 1) * width2;
assert(curwin->w_curswant <= INT_MAX - w);
curwin->w_curswant += w;
}
}
} else { /* dir == FORWARD */
if (linelen > width1)