diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/dynamicpaint.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/fcurve.c | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/softbody.c | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/scanfill.c | 14 | ||||
-rw-r--r-- | source/blender/editors/animation/keyframing.c | 5 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_bvh.c | 5 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_select.c | 7 | ||||
-rw-r--r-- | source/blender/editors/physics/particle_edit.c | 2 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_conversions.c | 4 | ||||
-rw-r--r-- | source/gameengine/Rasterizer/RAS_MeshObject.cpp | 8 |
10 files changed, 29 insertions, 32 deletions
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 06807dfcbad..f47ac641cf9 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -2595,7 +2595,7 @@ void dynamicPaint_outputSurfaceImage(DynamicPaintSurface *surface, char *filenam int format = (surface->image_fileformat & MOD_DPAINT_IMGFORMAT_OPENEXR) ? R_IMF_IMTYPE_OPENEXR : R_IMF_IMTYPE_PNG; char output_file[FILE_MAX]; - if (!sData || !sData->type_data) { setError(surface->canvas, "Image save failed: Invalid surface."); return; } + if (!sData->type_data) { setError(surface->canvas, "Image save failed: Invalid surface."); return; } /* if selected format is openexr, but current build doesnt support one */ #ifndef WITH_OPENEXR if (format == R_IMF_IMTYPE_OPENEXR) format = R_IMF_IMTYPE_PNG; @@ -4800,7 +4800,7 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su PaintBakeData *bData = sData->bData; DynamicPaintCanvasSettings *canvas = surface->canvas; int ret = 1; - if (!sData || sData->total_points < 1) return 0; + if (sData->total_points < 1) return 0; dynamicPaint_surfacePreStep(surface, timescale); /* @@ -4875,7 +4875,7 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su /* Apply brush on the surface depending on it's collision type */ /* Particle brush: */ if (brush->collision == MOD_DPAINT_COL_PSYS) { - if (brush && brush->psys && brush->psys->part && brush->psys->part->type == PART_EMITTER && + if (brush->psys && brush->psys->part && brush->psys->part->type == PART_EMITTER && psys_check_enabled(brushObj, brush->psys)) { diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index b78ab9b28cd..5fea74d52de 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -74,12 +74,10 @@ void free_fcurve(FCurve *fcu) { if (fcu == NULL) return; - + /* free curve data */ - if (fcu) { - if (fcu->bezt) MEM_freeN(fcu->bezt); - if (fcu->fpt) MEM_freeN(fcu->fpt); - } + if (fcu->bezt) MEM_freeN(fcu->bezt); + if (fcu->fpt) MEM_freeN(fcu->fpt); /* free RNA-path, as this were allocated when getting the path string */ if (fcu->rna_path) diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 008dc332710..4a88bfbfdad 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -2291,7 +2291,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo /* done goal stuff */ /* gravitation */ - if (sb && scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY) { + if (scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY) { float gravity[3]; copy_v3_v3(gravity, scene->physics_settings.gravity); mul_v3_fl(gravity, sb_grav_force_scale(ob)*_final_mass(ob, bp)*sb->effector_weights->global_gravity); /* individual mass of node here */ diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c index 4ce718aeb16..32afaba2b5c 100644 --- a/source/blender/blenlib/intern/scanfill.c +++ b/source/blender/blenlib/intern/scanfill.c @@ -423,12 +423,16 @@ static void testvertexnearedge(ScanFillContext *sf_ctx) for (eve = sf_ctx->fillvertbase.first; eve; eve = eve->next) { if (eve->h == 1) { - /* find the edge which has vertex eve */ - ed1 = sf_ctx->filledgebase.first; - while (ed1) { - if (ed1->v1 == eve || ed1->v2 == eve) break; - ed1 = ed1->next; + /* find the edge which has vertex eve, + * note: we _know_ this will crash if 'ed1' becomes NULL + * but this will never happen. */ + for (ed1 = sf_ctx->filledgebase.first; + !(ed1->v1 == eve || ed1->v2 == eve); + ed1 = ed1->next) + { + /* do nothing */ } + if (ed1->v1 == eve) { ed1->v1 = ed1->v2; ed1->v2 = eve; diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 3ef686910e6..8cd8cfaea51 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -164,10 +164,7 @@ FCurve *verify_fcurve(bAction *act, const char group[], PointerRNA *ptr, * - add if not found and allowed to add one * TODO: add auto-grouping support? how this works will need to be resolved */ - if (act) - fcu = list_find_fcurve(&act->curves, rna_path, array_index); - else - fcu = NULL; + fcu = list_find_fcurve(&act->curves, rna_path, array_index); if ((fcu == NULL) && (add)) { /* use default settings to make a F-Curve */ diff --git a/source/blender/editors/mesh/editmesh_bvh.c b/source/blender/editors/mesh/editmesh_bvh.c index 580592c02f6..0b7d396b696 100644 --- a/source/blender/editors/mesh/editmesh_bvh.c +++ b/source/blender/editors/mesh/editmesh_bvh.c @@ -398,11 +398,6 @@ int BMBVH_EdgeVisible(BMBVHTree *tree, BMEdge *e, ARegion *ar, View3D *v3d, Obje float end[3]; const float mval_f[2] = {ar->winx / 2.0f, ar->winy / 2.0f}; - - if (!ar) { - printf("error in BMBVH_EdgeVisible!\n"); - return 0; - } ED_view3d_win_to_segment_clip(ar, v3d, mval_f, origin, end); diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index 3ac011550be..dc5d1cea443 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -268,11 +268,14 @@ int EDBM_backbuf_border_mask_init(ViewContext *vc, int mcords[][2], short tot, s /* grab mask */ bufmask = view3d_read_backbuf(vc, xmin, ymin, xmax, ymax); - drm = bufmask->rect; + if (bufmask == NULL) { return 0; /* only when mem alloc fails, go crash somewhere else! */ } - + else { + drm = bufmask->rect; + } + /* build selection lookup */ selbuf = MEM_callocN(bm_vertoffs + 1, "selbuf"); diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 3ed31abca94..b7ce32aa10a 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -4135,7 +4135,7 @@ static void PE_create_particle_edit(Scene *scene, Object *ob, PointCache *cache, if (cache && cache->flag & PTCACHE_DISK_CACHE) return; - if (psys == NULL && cache->mem_cache.first == NULL) + if (psys == NULL && (cache && cache->mem_cache.first == NULL)) return; if (!edit) { diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index e635c4b3fb8..c1859407789 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -861,7 +861,7 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan) data->rootbone = 0; /* watch-it! has to be 0 here, since we're still on the same bone for the first time through the loop [#25885] */ /* we only include bones that are part of a continual connected chain */ - while (pchan) { + do { /* here, we set ik-settings for bone from pchan->protectflag */ // XXX: careful with quats/axis-angle rotations where we're locking 4d components if (pchan->protectflag & OB_LOCK_ROTX) pchan->ikflag |= BONE_IK_NO_XDOF_TEMP; @@ -876,7 +876,7 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan) pchan = pchan->parent; else pchan = NULL; - } + } while (pchan); /* make a copy of maximum chain-length */ data->max_rootbone = data->rootbone; diff --git a/source/gameengine/Rasterizer/RAS_MeshObject.cpp b/source/gameengine/Rasterizer/RAS_MeshObject.cpp index 7da0be3a506..25afefbcc5a 100644 --- a/source/gameengine/Rasterizer/RAS_MeshObject.cpp +++ b/source/gameengine/Rasterizer/RAS_MeshObject.cpp @@ -536,18 +536,18 @@ void RAS_MeshObject::SortPolygons(RAS_MeshSlot& ms, const MT_Transform &transfor const MT_Vector3 pnorm(transform.getBasis()[2]); // unneeded: const MT_Scalar pval = transform.getOrigin()[2]; - vector<polygonSlot> slots(totpoly); + vector<polygonSlot> poly_slots(totpoly); /* get indices and z into temporary array */ for (j=0; j<totpoly; j++) - slots[j].get(it.vertex, it.index, j*nvert, nvert, pnorm); + poly_slots[j].get(it.vertex, it.index, j*nvert, nvert, pnorm); /* sort (stable_sort might be better, if flickering happens?) */ - std::sort(slots.begin(), slots.end(), backtofront()); + std::sort(poly_slots.begin(), poly_slots.end(), backtofront()); /* get indices from temporary array again */ for (j=0; j<totpoly; j++) - slots[j].set(it.index, j*nvert, nvert); + poly_slots[j].set(it.index, j*nvert, nvert); } } |