0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.1089: Coverity warns for pointer computation

Problem:    Coverity warns for pointer computation.
Solution:   Avoid computing a pointer to invalid memory.
This commit is contained in:
Bram Moolenaar
2020-06-29 22:24:56 +02:00
parent 6378b21d6d
commit 927b7dd0fe
2 changed files with 4 additions and 3 deletions

View File

@@ -5908,7 +5908,8 @@ mkspell(
spin.si_newcompID = 127; // start compound ID at first maximum spin.si_newcompID = 127; // start compound ID at first maximum
// default: fnames[0] is output file, following are input files // default: fnames[0] is output file, following are input files
innames = &fnames[1]; // When "fcount" is 1 there is only one file.
innames = &fnames[fcount == 1 ? 0 : 1];
incount = fcount - 1; incount = fcount - 1;
wfname = alloc(MAXPATHL); wfname = alloc(MAXPATHL);
@@ -5922,14 +5923,12 @@ mkspell(
{ {
// For ":mkspell path/en.latin1.add" output file is // For ":mkspell path/en.latin1.add" output file is
// "path/en.latin1.add.spl". // "path/en.latin1.add.spl".
innames = &fnames[0];
incount = 1; incount = 1;
vim_snprintf((char *)wfname, MAXPATHL, "%s.spl", fnames[0]); vim_snprintf((char *)wfname, MAXPATHL, "%s.spl", fnames[0]);
} }
else if (fcount == 1) else if (fcount == 1)
{ {
// For ":mkspell path/vim" output file is "path/vim.latin1.spl". // For ":mkspell path/vim" output file is "path/vim.latin1.spl".
innames = &fnames[0];
incount = 1; incount = 1;
vim_snprintf((char *)wfname, MAXPATHL, SPL_FNAME_TMPL, vim_snprintf((char *)wfname, MAXPATHL, SPL_FNAME_TMPL,
fnames[0], spin.si_ascii ? (char_u *)"ascii" : spell_enc()); fnames[0], spin.si_ascii ? (char_u *)"ascii" : spell_enc());

View File

@@ -754,6 +754,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1089,
/**/ /**/
1088, 1088,
/**/ /**/