Merge #8218 'Fix errors reported by PVS'

closes #4983
This commit is contained in:
Justin M. Keyes
2018-04-27 09:25:02 +02:00
committed by GitHub
54 changed files with 1045 additions and 1016 deletions

View File

@@ -298,8 +298,7 @@ readfile (
off_T filesize = 0;
int skip_read = false;
context_sha256_T sha_ctx;
int read_undo_file = FALSE;
int split = 0; /* number of split lines */
int read_undo_file = false;
linenr_T linecnt;
int error = FALSE; /* errors encountered */
int ff_error = EOL_UNKNOWN; /* file format with errors */
@@ -1029,8 +1028,8 @@ retry:
size = size / ICONV_MULT; /* worst case */
if (conv_restlen > 0) {
/* Insert unconverted bytes from previous line. */
memmove(ptr, conv_rest, conv_restlen);
// Insert unconverted bytes from previous line.
memmove(ptr, conv_rest, conv_restlen); // -V614
ptr += conv_restlen;
size -= conv_restlen;
}
@@ -1842,10 +1841,6 @@ failed:
STRCAT(IObuff, _("[CR missing]"));
c = TRUE;
}
if (split) {
STRCAT(IObuff, _("[long lines split]"));
c = TRUE;
}
if (notconverted) {
STRCAT(IObuff, _("[NOT converted]"));
c = TRUE;
@@ -3352,9 +3347,9 @@ restore_backup:
*s++ = NL;
}
}
if (++len == bufsize && end) {
if (++len == bufsize) {
if (buf_write_bytes(&write_info) == FAIL) {
end = 0; /* write error: break loop */
end = 0; // Write error: break loop.
break;
}
nchars += bufsize;
@@ -3363,7 +3358,7 @@ restore_backup:
os_breakcheck();
if (got_int) {
end = 0; /* Interrupted, break loop */
end = 0; // Interrupted, break loop.
break;
}
}