comparison src/spellfile.c @ 25583:7d3c296a117f v8.2.3328

patch 8.2.3328: Coverity error for not checking return value Commit: https://github.com/vim/vim/commit/b85d3627d9a7b41d603c58a16d0ddbf6b88beeaf Author: Bram Moolenaar <Bram@vim.org> Date: Wed Aug 11 15:54:59 2021 +0200 patch 8.2.3328: Coverity error for not checking return value Problem: Coverity error for not checking return value. Solution: Check value is not negative.
author Bram Moolenaar <Bram@vim.org>
date Wed, 11 Aug 2021 16:00:06 +0200
parents 8f2262c72178
children b18f3b0f317c
comparison
equal deleted inserted replaced
25582:38e113f68d1e 25583:7d3c296a117f
1256 --todo; 1256 --todo;
1257 slang->sl_compoptions = c; 1257 slang->sl_compoptions = c;
1258 1258
1259 gap = &slang->sl_comppat; 1259 gap = &slang->sl_comppat;
1260 c = get2c(fd); // <comppatcount> 1260 c = get2c(fd); // <comppatcount>
1261 if (c < 0)
1262 return SP_TRUNCERROR;
1261 todo -= 2; 1263 todo -= 2;
1262 ga_init2(gap, sizeof(char_u *), c); 1264 ga_init2(gap, sizeof(char_u *), c);
1263 if (ga_grow(gap, c) == OK) 1265 if (ga_grow(gap, c) == OK)
1264 while (--c >= 0) 1266 while (--c >= 0)
1265 { 1267 {
1266 ((char_u **)(gap->ga_data))[gap->ga_len++] = 1268 ((char_u **)(gap->ga_data))[gap->ga_len++] =
1267 read_cnt_string(fd, 1, &cnt); 1269 read_cnt_string(fd, 1, &cnt);
1268 // <comppatlen> <comppattext> 1270 // <comppatlen> <comppattext>
1269 if (cnt < 0) 1271 if (cnt < 0)
1270 return cnt; 1272 return cnt;
1271 todo -= cnt + 1; 1273 todo -= cnt + 1;
1272 } 1274 }