diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-12-23 00:29:44 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-12-23 00:29:44 +0400 |
commit | 4d7c44717aa67671518431183d38dab5d2a7a3dd (patch) | |
tree | 7738e22f5990b9bfbd4d15c845990b41b91728b1 /source | |
parent | 3563f677f88baf7b1f68d7f435787e3bf4a20d24 (diff) |
Code cleanup: fix some clang static checker warnings.
Diffstat (limited to 'source')
18 files changed, 27 insertions, 47 deletions
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 4eaf49dc679..e17566b7d55 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -1704,7 +1704,7 @@ static void scene_sort_groups(Main *bmain, Scene *sce) /* sort the base list on dependency order */ void DAG_scene_sort(Main *bmain, Scene *sce) { - DagNode *node; + DagNode *node, *rootnode; DagNodeQueue *nqueue; DagAdjList *itA; int time; @@ -1726,11 +1726,10 @@ void DAG_scene_sort(Main *bmain, Scene *sce) time = 1; - node = sce->theDag->DagNode.first; - - node->color = DAG_GRAY; + rootnode = sce->theDag->DagNode.first; + rootnode->color = DAG_GRAY; time++; - push_stack(nqueue,node); + push_stack(nqueue,rootnode); while(nqueue->count) { @@ -2848,10 +2847,8 @@ void DAG_pose_sort(Object *ob) for(node = dag->DagNode.first; node; node= node->next) node->color = DAG_WHITE; - node = dag->DagNode.first; - - node->color = DAG_GRAY; - push_stack(nqueue, node); + rootnode->color = DAG_GRAY; + push_stack(nqueue, rootnode); while(nqueue->count) { diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index b9947c506d1..318165af804 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -1414,10 +1414,7 @@ void driver_free_variable (ChannelDriver *driver, DriverVar *dvar) DRIVER_TARGETS_LOOPER_END /* remove the variable from the driver */ - if (driver) - BLI_freelinkN(&driver->variables, dvar); - else - MEM_freeN(dvar); + BLI_freelinkN(&driver->variables, dvar); #ifdef WITH_PYTHON /* since driver variables are cached, the expression needs re-compiling too */ diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index 736c889f66c..7b2cfd46d33 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -988,9 +988,9 @@ void unlink_movieclip(Main *bmain, MovieClip *clip) } for(ob= bmain->object.first; ob; ob= ob->id.next) { - bConstraint *con= ob->constraints.first; + bConstraint *con; - for (con= ob->constraints.first; con; con= con->next) { + for(con= ob->constraints.first; con; con= con->next) { bConstraintTypeInfo *cti= constraint_get_typeinfo(con); if(cti->type==CONSTRAINT_TYPE_FOLLOWTRACK) { diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 374ef3512e8..e773eb6dd35 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -2292,6 +2292,9 @@ static int ccgdm_adjacent_grid(CCGSubSurf *ss, int *gridOffset, CCGFace *f, int break; } } + + if(numEdges == 0) + return -1; fIndex = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, adjf)); diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index 83adfa12236..04e8c3df077 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -1288,8 +1288,8 @@ int BKE_tracking_next(MovieTrackingContext *context) MEM_freeN(image_new); } - coords_correct= !isnan(x2) && !isnan(y2) && finite(x2) && finite(y2); - if(coords_correct && !onbound && (tracked || !context->disable_failed)) { + coords_correct= !onbound && !isnan(x2) && !isnan(y2) && finite(x2) && finite(y2); + if(coords_correct && (tracked || !context->disable_failed)) { if(context->first_time) { #pragma omp critical { diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 8c699c840dc..a21c394a81e 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -496,7 +496,7 @@ void ANIM_flush_setting_anim_channels (bAnimContext *ac, ListBase *anim_data, bA break; /* store this level as the 'old' level now */ - prevLevel= level; // XXX: prevLevel is unused + // prevLevel= level; // XXX: prevLevel is unused } } } diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index fe6aed77462..45b715c406a 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -2205,12 +2205,12 @@ size_t ANIM_animdata_filter (bAnimContext *ac, ListBase *anim_data, int filter_m /* only filter data if there's somewhere to put it */ if (data && anim_data) { - Object *obact= (ac) ? ac->obact : NULL; /* firstly filter the data */ switch (datatype) { case ANIMCONT_ACTION: /* 'Action Editor' */ { + Object *obact= ac->obact; SpaceAction *saction = (SpaceAction *)ac->sl; bDopeSheet *ads = (saction)? &saction->ads : NULL; diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c index 33796b7c215..7182bbc38e2 100644 --- a/source/blender/gpu/intern/gpu_codegen.c +++ b/source/blender/gpu/intern/gpu_codegen.c @@ -538,12 +538,8 @@ static void codegen_call_functions(DynStr *ds, ListBase *nodes, GPUOutput *final BLI_dynstr_appendf(ds, ", gl_TexCoord[%d].st", input->texid); } else if (input->source == GPU_SOURCE_TEX_PIXEL) { - if (input->link && input->link->output) - codegen_convert_datatype(ds, input->link->output->type, input->type, - "tmp", input->link->output->id); - else - codegen_convert_datatype(ds, input->link->output->type, input->type, - "tex", input->texid); + codegen_convert_datatype(ds, input->link->output->type, input->type, + "tmp", input->link->output->id); } else if(input->source == GPU_SOURCE_BUILTIN) BLI_dynstr_appendf(ds, "%s", GPU_builtin_name(input->builtin)); diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 2dcce996065..5d36ba169f3 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -1069,7 +1069,7 @@ void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, O /* setting do_alpha_after = 1 indicates this object needs to be * drawn in a second alpha pass for improved blending */ - if(GMS.use_alpha_pass && !GMS.is_alpha_pass) + if(do_alpha_after && !GMS.is_alpha_pass) if(ELEM3(alphablend, GPU_BLEND_ALPHA, GPU_BLEND_ADD, GPU_BLEND_ALPHA_SORT)) *do_alpha_after= 1; diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 250ea51f8c8..fb1d10b5491 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -972,7 +972,6 @@ static void do_material_tex(GPUShadeInput *shi) GPU_link(mat, "mtex_mapping_ofs", texco, GPU_uniform(ofs), &texco); talpha = 0; - rgbnor = 0; if(tex && tex->type == TEX_IMAGE && tex->ima) { GPU_link(mat, "mtex_image", texco, GPU_image(tex->ima, &tex->iuser), &tin, &trgb); diff --git a/source/blender/render/intern/raytrace/rayobject_octree.cpp b/source/blender/render/intern/raytrace/rayobject_octree.cpp index 20202319d44..14b4a7bcf9f 100644 --- a/source/blender/render/intern/raytrace/rayobject_octree.cpp +++ b/source/blender/render/intern/raytrace/rayobject_octree.cpp @@ -978,7 +978,7 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is) } xo=ocx1; yo=ocy1; zo=ocz1; - labdao= ddalabda= MIN3(labdax,labday,labdaz); + ddalabda= MIN3(labdax,labday,labdaz); vec2[0]= ox1; vec2[1]= oy1; diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 78f2fe6171b..122b47016eb 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -592,7 +592,7 @@ static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangen { MemArena *arena= NULL; VertexTangent **vtangents= NULL; - int a, iCalcNewMethod; + int a; if(do_nmap_tangent) { arena= BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "nmap tangent arena"); @@ -680,8 +680,7 @@ static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangen } } - iCalcNewMethod = 1; - if(iCalcNewMethod!=0 && do_nmap_tangent!=0) + if(do_nmap_tangent!=0) { SRenderMeshToTangent mesh2tangent; SMikkTSpaceContext sContext; @@ -701,11 +700,9 @@ static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangen sInterface.m_getNormal = GetNormal; sInterface.m_setTSpaceBasic = SetTSpace; - // 0 if failed - iCalcNewMethod = genTangSpaceDefault(&sContext); + genTangSpaceDefault(&sContext); } - if(arena) BLI_memarena_free(arena); if(vtangents) @@ -1068,7 +1065,6 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par mul_v3_fl(cross, width); } - else width= 1.0f; if(ma->mode & MA_TANGENT_STR) flag= R_SMOOTH|R_TANGENT; diff --git a/source/blender/render/intern/source/pixelshading.c b/source/blender/render/intern/source/pixelshading.c index b62484a6995..f261ec41746 100644 --- a/source/blender/render/intern/source/pixelshading.c +++ b/source/blender/render/intern/source/pixelshading.c @@ -176,7 +176,6 @@ static void render_lighting_halo(HaloRen *har, float col_r[3]) if(inpr<t) continue; else { t= inpr-t; - i= 1.0; soft= 1.0; if(t<lar->spotbl && lar->spotbl!=0.0f) { /* soft area */ diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c index b8c4b05de50..41bfcb55068 100644 --- a/source/blender/render/intern/source/rayshade.c +++ b/source/blender/render/intern/source/rayshade.c @@ -2010,7 +2010,7 @@ static void ray_ao_qmc(ShadeInput *shi, float ao[3], float env[3]) samples++; - if (qsa->type == SAMP_TYPE_HALTON) { + if (qsa && qsa->type == SAMP_TYPE_HALTON) { /* adaptive sampling - consider samples below threshold as in shadow (or vice versa) and exit early */ if (adapt_thresh > 0.0f && (samples > max_samples/2) ) { diff --git a/source/blender/render/intern/source/renderdatabase.c b/source/blender/render/intern/source/renderdatabase.c index 25575fa965f..43761be9d71 100644 --- a/source/blender/render/intern/source/renderdatabase.c +++ b/source/blender/render/intern/source/renderdatabase.c @@ -1026,7 +1026,7 @@ HaloRen *RE_inithalo(Render *re, ObjectRen *obr, Material *ma, float *vec, f externtex(mtex, texvec, &tin, &tr, &tg, &tb, &ta, 0); yn= tin*mtex->colfac; - zn= tin*mtex->alphafac; + //zn= tin*mtex->alphafac; if(mtex->mapto & MAP_COL) { zn= 1.0f-yn; @@ -1112,10 +1112,8 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater if(ma->mode & MA_HALO_RINGS) har->ringc= ma->ringc; if(ma->mode & MA_HALO_FLARE) har->flarec= ma->flarec; - if((ma->mode & MA_HALOTEX) && ma->mtex[0]){ + if((ma->mode & MA_HALOTEX) && ma->mtex[0]) har->tex= 1; - i=1; - } for(i=0; i<MAX_MTEX; i++) if(ma->mtex[i] && (ma->septex & (1<<i))==0) { diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index 4d654beb287..b99bab04b10 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -269,14 +269,12 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens) if(p1[2]<-ladist) t1= t3; } else { - ok1= 1; t1= t3; } if(ok2) { if(p2[2]<-ladist) t2= t3; } else { - ok2= 1; t2= t3; } } diff --git a/source/blender/render/intern/source/strand.c b/source/blender/render/intern/source/strand.c index 4fc3bb7c5da..89f74418563 100644 --- a/source/blender/render/intern/source/strand.c +++ b/source/blender/render/intern/source/strand.c @@ -833,7 +833,6 @@ int zbuffer_strands_abuf(Render *re, RenderPart *pa, APixstrand *apixbuf, ListBa memarena= BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "strand sort arena"); firstseg= NULL; - sortseg= sortsegments; totsegment= 0; /* for all object instances */ diff --git a/source/blender/render/intern/source/volumetric.c b/source/blender/render/intern/source/volumetric.c index a46ef3888d8..3637c2de1fb 100644 --- a/source/blender/render/intern/source/volumetric.c +++ b/source/blender/render/intern/source/volumetric.c @@ -746,7 +746,6 @@ void shade_volume_shadow(struct ShadeInput *shi, struct ShadeResult *shr, struct float tr[3] = {1.0,1.0,1.0}; Isect is= {{0}}; float *startco, *endco; - int intersect_type = VOL_BOUNDS_DEPTH; memset(shr, 0, sizeof(ShadeResult)); @@ -755,12 +754,11 @@ void shade_volume_shadow(struct ShadeInput *shi, struct ShadeResult *shr, struct if (shi->flippednor) { startco = last_is->start; endco = shi->co; - intersect_type = VOL_BOUNDS_SS; } /* trace to find a backface, the other side bounds of the volume */ /* (ray intersect ignores front faces here) */ - else if (vol_get_bounds(shi, shi->co, shi->view, hitco, &is, intersect_type)) { + else if (vol_get_bounds(shi, shi->co, shi->view, hitco, &is, VOL_BOUNDS_DEPTH)) { startco = shi->co; endco = hitco; } |