diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-01-22 06:50:09 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-01-22 06:50:09 +0300 |
commit | 799e9c48c1a210386873ae01a0f208675eafffe7 (patch) | |
tree | cabbf41a49c072f62336a41c4afde5dd302d2126 /source | |
parent | f6d54bd1eed7a6d6382d237b7d2291c4ba495246 (diff) |
comment dead code and fix 2 missing NULL checks (pointer used after NULL check and checking against incorrect pointer before use).
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/implicit.c | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle_system.c | 4 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 8 | ||||
-rw-r--r-- | source/blender/editors/armature/editarmature.c | 11 | ||||
-rw-r--r-- | source/blender/editors/curve/editcurve.c | 21 | ||||
-rw-r--r-- | source/blender/editors/object/object_add.c | 4 | ||||
-rw-r--r-- | source/blender/editors/object/object_constraint.c | 8 | ||||
-rw-r--r-- | source/blender/imbuf/intern/jp2.c | 6 | ||||
-rw-r--r-- | source/blender/render/intern/source/rayobject_octree.c | 2 |
10 files changed, 37 insertions, 36 deletions
diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c index fc9c41070dc..8004f23c22a 100644 --- a/source/blender/blenkernel/intern/implicit.c +++ b/source/blender/blenkernel/intern/implicit.c @@ -1317,8 +1317,9 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s, VECSUB(extent, X[s->ij], tvect); - dot = INPR(extent, extent); - length = sqrt(dot); + // SEE MSG BELOW (these are UNUSED) + // dot = INPR(extent, extent); + // length = sqrt(dot); k = clmd->sim_parms->goalspring; diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 5526edf0a8c..87c39abd561 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -2743,7 +2743,7 @@ void psys_cache_child_paths(ParticleSimulationData *sim, float cfra, int editupd { ParticleThread *pthreads; ParticleThreadContext *ctx; - ParticleCacheKey **cache; + /*ParticleCacheKey **cache;*/ /*UNUSED*/ ListBase threads; int i, totchild, totparent, totthread; @@ -2762,7 +2762,7 @@ void psys_cache_child_paths(ParticleSimulationData *sim, float cfra, int editupd totparent= ctx->totparent; if(editupdate && sim->psys->childcache && totchild == sim->psys->totchildcache) { - cache = sim->psys->childcache; + /*cache = sim->psys->childcache;*/ /*UNUSED*/ } else { /* clear out old and create new empty path cache */ diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 6ec08e76606..62bfde601f6 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -3403,7 +3403,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra) PARTICLE_P; float timestep; /* current time */ - float ctime; + /* float ctime; */ /*UNUSED*/ /* frame & time changes */ float dfra, dtime; float birthtime, dietime; @@ -3412,7 +3412,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra) dfra= cfra - psys->cfra; timestep = psys_get_timestep(sim); - ctime= cfra*timestep; + /*ctime= cfra*timestep;*/ /*UNUSED*/ dtime= dfra*timestep; if(dfra<0.0){ diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 9619a111ddb..e1d6c9fc48b 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -3823,11 +3823,11 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) clmd->sim_parms->reset = 0; clmd->sim_parms->effector_weights = newdataadr(fd, clmd->sim_parms->effector_weights); - } - if(!clmd->sim_parms->effector_weights) - clmd->sim_parms->effector_weights = BKE_add_effector_weights(NULL); - + if(!clmd->sim_parms->effector_weights) { + clmd->sim_parms->effector_weights = BKE_add_effector_weights(NULL); + } + } } else if (md->type==eModifierType_Fluidsim) { FluidsimModifierData *fluidmd = (FluidsimModifierData*) md; diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 2252c926c71..e0172b603b7 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -3000,14 +3000,13 @@ static int armature_fill_bones_exec (bContext *C, wmOperator *op) bArmature *arm= (obedit) ? obedit->data : NULL; Scene *scene= CTX_data_scene(C); View3D *v3d= CTX_wm_view3d(C); - EditBone *newbone=NULL; ListBase points = {NULL, NULL}; int count; - + /* sanity checks */ - if ELEM(NULL, obedit, arm) + if (ELEM(NULL, obedit, arm)) return OPERATOR_CANCELLED; - + /* loop over all bones, and only consider if visible */ CTX_DATA_BEGIN(C, EditBone *, ebone, visible_bones) { @@ -3041,7 +3040,7 @@ static int armature_fill_bones_exec (bContext *C, wmOperator *op) mul_v3_m4v3(curs, obedit->imat, give_cursor(scene, v3d)); /* Create a bone */ - newbone= add_points_bone(obedit, ebp->vec, curs); + /* newbone= */ add_points_bone(obedit, ebp->vec, curs); } else if (count == 2) { EditBonePoint *ebp, *ebp2; @@ -3102,7 +3101,7 @@ static int armature_fill_bones_exec (bContext *C, wmOperator *op) /* add new bone and parent it to the appropriate end */ if (headtail) { - newbone= add_points_bone(obedit, head, tail); + EditBone *newbone= add_points_bone(obedit, head, tail); /* do parenting (will need to set connected flag too) */ if (headtail == 2) { diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index db9b82423b0..3eaf53b4bcb 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -6096,21 +6096,18 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob) Curve *cu= (Curve*)obedit->data; float vec[3], zvec[3]= {0.0f, 0.0f, 1.0f}; float umat[4][4]= MAT4_UNITY, viewmat[4][4]= MAT4_UNITY; - float fac, grid; - int a, b, cutype, stype; - int force_3d = ((Curve *)obedit->data)->flag & CU_3D; /* could be adding to an existing 3D curve */ + float fac; + int a, b; + const float grid= v3d ? v3d->grid : 1.0f; + const int cutype= (type & CU_TYPE); // poly, bezier, nurbs, etc + const int stype= (type & CU_PRIMITIVE); + const int force_3d = ((Curve *)obedit->data)->flag & CU_3D; /* could be adding to an existing 3D curve */ if(rv3d) { copy_m4_m4(viewmat, rv3d->viewmat); VECCOPY(zvec, rv3d->viewinv[2]); } - - cutype= type & CU_TYPE; // poly, bezier, nurbs, etc - stype= type & CU_PRIMITIVE; - - if (v3d) grid = v3d->grid; - else grid = 1.0; - + setflagsNurb(editnurb, 0); /* these types call this function to return a Nurb */ @@ -6432,6 +6429,10 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob) } break; + + default: /* should never happen */ + BLI_assert(!"invalid nurbs type"); + return NULL; } /* always do: */ diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index cd2b0f79f1a..eee17bc78ef 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -491,7 +491,7 @@ void OBJECT_OT_camera_add(wmOperatorType *ot) static int object_metaball_add_exec(bContext *C, wmOperator *op) { Object *obedit= CTX_data_edit_object(C); - MetaElem *elem; + /*MetaElem *elem;*/ /*UNUSED*/ int newob= 0; int enter_editmode; unsigned int layer; @@ -511,7 +511,7 @@ static int object_metaball_add_exec(bContext *C, wmOperator *op) ED_object_new_primitive_matrix(C, obedit, loc, rot, mat); - elem= (MetaElem*)add_metaball_primitive(C, mat, RNA_enum_get(op->ptr, "type"), newob); + /* elem= (MetaElem *) */ add_metaball_primitive(C, mat, RNA_enum_get(op->ptr, "type"), newob); /* userdef */ if (newob && !enter_editmode) { diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index 9322886266a..344c2c13861 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -469,11 +469,11 @@ static EnumPropertyItem constraint_owner_items[] = { static int edit_constraint_poll_generic(bContext *C, StructRNA *rna_type) { PointerRNA ptr= CTX_data_pointer_get_type(C, "constraint", rna_type); - Object *ob= (ptr.id.data)?ptr.id.data:ED_object_active_context(C); - + Object *ob= (ptr.id.data) ? ptr.id.data : ED_object_active_context(C); + if (!ob || ob->id.lib) return 0; - if (ptr.data && ((ID*)ptr.id.data)->lib) return 0; - + if (ptr.id.data && ((ID*)ptr.id.data)->lib) return 0; + return 1; } diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c index 49920219d8c..c0f54898119 100644 --- a/source/blender/imbuf/intern/jp2.c +++ b/source/blender/imbuf/intern/jp2.c @@ -95,9 +95,9 @@ struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags) struct ImBuf *ibuf = 0; int use_float = 0; /* for precision higher then 8 use float */ - long signed_offsets[4] = {0,0,0,0}; - int float_divs[4]; - + long signed_offsets[4]= {0, 0, 0, 0}; + int float_divs[4]= {1, 1, 1, 1}; + int index; int w, h, depth; diff --git a/source/blender/render/intern/source/rayobject_octree.c b/source/blender/render/intern/source/rayobject_octree.c index 2637643989e..3957e6b2c68 100644 --- a/source/blender/render/intern/source/rayobject_octree.c +++ b/source/blender/render/intern/source/rayobject_octree.c @@ -976,7 +976,7 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is) } xo=ocx1; yo=ocy1; zo=ocz1; - labdao= ddalabda= MIN3(labdax,labday,labdaz); + /*labdao= ddalabda= MIN3(labdax,labday,labdaz);*/ /*NEVER READ*/ vec2[0]= ox1; vec2[1]= oy1; |