Fixing more errors coverity found.

Imagepaint make sure ibuf exists before we use it.  This is CID# 545
editmesh_tools.c make sure were not indexing array with -1 This is CID# 137
	(also removed some trailing whitespace I found)

anim5.c	totlen could be -1 so check its > -1  This is CID# 134

Kent
This commit is contained in:
2009-04-15 16:16:00 +00:00
parent 514c78ba39
commit 3616eb9031
3 changed files with 17 additions and 14 deletions

View File

@@ -425,7 +425,7 @@ int startanim5(struct anim * anim) {
/* de hele file wordt in het geheugen gemapped */
totlen = BLI_filesize(file);
if (totlen && file>=0) {
if (totlen>0 && file>=0) {
lseek(file, 0L, SEEK_SET);
mem= MEM_mallocN(totlen, "mmap");

View File

@@ -2520,11 +2520,13 @@ void esubdivideflag(int flag, float rad, int beauty, int numcuts, int seltype)
}
}
}
sort[hold]->f &= ~SELECT;
sort[hold]->f2 |= EDGENEW;
length[hold] = -1;
}
}
if (hold > -1) {
sort[hold]->f &= ~SELECT;
sort[hold]->f2 |= EDGENEW;
length[hold] = -1;
}
}
}
// Beauty Long Edges
else {
@@ -2541,13 +2543,15 @@ void esubdivideflag(int flag, float rad, int beauty, int numcuts, int seltype)
}
}
}
sort[hold]->f &= ~SELECT;
sort[hold]->f2 |= EDGENEW;
length[hold] = -1;
}
}
if (hold > -1) {
sort[hold]->f &= ~SELECT;
sort[hold]->f2 |= EDGENEW;
length[hold] = -1;
}
}
}
}
}
}
}
gh = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp);

View File

@@ -708,8 +708,7 @@ static int project_paint_PickColor(const ProjPaintState *ps, float pt[2], float
}
ibuf = BKE_image_get_ibuf((Image *)tf->tpage, NULL); /* TODO - this may be slow, the only way around it is to have an ibuf index per face */
if (!ibuf) return 0;
if (interp) {
float x, y;