From b8c4c54ff0a0d2315b711612238192ca4c4562f5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 23 Apr 2012 16:29:13 +0000 Subject: [PATCH] corrected more issues from [#31069] Analyzing the Blender project with PVS-Studio --- .../blender/blenkernel/intern/dynamicpaint.c | 6 ++--- source/blender/blenkernel/intern/ipo.c | 24 +++++++++---------- .../editors/space_view3d/view3d_draw.c | 2 +- .../render/intern/source/convertblender.c | 5 ++-- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 943c8a20990..9ce4d68eeed 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -1577,14 +1577,14 @@ static struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData if (pmd->canvas && !(pmd->canvas->flags & MOD_DPAINT_BAKING)) { - DynamicPaintSurface *surface = pmd->canvas->surfaces.first; + DynamicPaintSurface *surface; int update_normals = 0; /* loop through surfaces */ - for (; surface; surface=surface->next) { + for (surface = pmd->canvas->surfaces.first; surface; surface=surface->next) { PaintSurfaceData *sData = surface->data; - if (surface && surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ && sData) { + if (surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ && sData) { if (!(surface->flags & (MOD_DPAINT_ACTIVE))) continue; /* process vertex surface previews */ diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index c1b5d07de4a..2fd1d291363 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -1105,20 +1105,18 @@ static void fcurve_add_to_list (ListBase *groups, ListBase *list, FCurve *fcu, c /* get the group to use */ agrp= action_groups_find_named(&tmp_act, grpname); + /* no matching group, so add one */ if (agrp == NULL) { - /* no matching group, so add one */ - if (agrp == NULL) { - /* Add a new group, and make it active */ - agrp= MEM_callocN(sizeof(bActionGroup), "bActionGroup"); - - agrp->flag = AGRP_SELECTED; - if (muteipo) agrp->flag |= AGRP_MUTED; - - BLI_strncpy(agrp->name, grpname, sizeof(agrp->name)); - - BLI_addtail(&tmp_act.groups, agrp); - BLI_uniquename(&tmp_act.groups, agrp, "Group", '.', offsetof(bActionGroup, name), sizeof(agrp->name)); - } + /* Add a new group, and make it active */ + agrp= MEM_callocN(sizeof(bActionGroup), "bActionGroup"); + + agrp->flag = AGRP_SELECTED; + if (muteipo) agrp->flag |= AGRP_MUTED; + + BLI_strncpy(agrp->name, grpname, sizeof(agrp->name)); + + BLI_addtail(&tmp_act.groups, agrp); + BLI_uniquename(&tmp_act.groups, agrp, "Group", '.', offsetof(bActionGroup, name), sizeof(agrp->name)); } /* add F-Curve to group */ diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 95a9d58c36e..ec383e1dbdb 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -98,7 +98,7 @@ static void star_stuff_init_func(void) { - cpack(-1); + cpack(0xFFFFFF); glPointSize(1.0); glBegin(GL_POINTS); } diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index ba8fd40db61..66ed0bd85a9 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -1782,9 +1782,10 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem hasize = ma->hasize; + /* XXX 'tpsys' is alwyas NULL, this code won't run! */ /* get orco */ - if (tpsys && part->phystype==PART_PHYS_NO) { - tpa=tpsys->particles+pa->num; + if (tpsys && part->phystype == PART_PHYS_NO) { + tpa = tpsys->particles + pa->num; psys_particle_on_emitter(psmd,tpart->from,tpa->num,pa->num_dmcache,tpa->fuv,tpa->foffset,co,nor,0,0,sd.orco,0); } else