Code cleanup: fix some clang static checker warnings.

This commit is contained in:
Brecht Van Lommel
2011-12-22 20:29:44 +00:00
parent 3563f677f8
commit 4d7c44717a
26 changed files with 41 additions and 78 deletions
+2 -1
View File
@@ -225,11 +225,12 @@ void IK_SetStiffness(IK_Segment *seg, IK_SegmentAxis axis, float stiffness)
void IK_GetBasisChange(IK_Segment *seg, float basis_change[][3])
{
IK_QSegment *qseg = (IK_QSegment*)seg;
const MT_Matrix3x3& change = qseg->BasisChange();
if (qseg->Translational() && qseg->Composite())
qseg = qseg->Composite();
const MT_Matrix3x3& change = qseg->BasisChange();
// convert from moto row major to blender column major
basis_change[0][0] = (float)change[0][0];
basis_change[1][0] = (float)change[0][1];
-1
View File
@@ -1350,7 +1350,6 @@ static tbool GenerateTSpaces(STSpace psTspace[], const STriInfo pTriInfos[], con
for(s=0; s<iUniqueSubGroups; s++)
free(pUniSubGroups[s].pTriMembers);
iUniqueTspaces += iUniqueSubGroups;
iUniqueSubGroups = 0;
}
// clean up
+1 -1
View File
@@ -1137,7 +1137,7 @@ static NLboolean __nlInvert_SUPERLU(__NLContext *context) {
/* SuperLU variables */
SuperMatrix B;
NLint info;
NLint info = 0;
for(j=0; j<context->nb_rhs; j++, b+=n, x+=n) {
/* Create superlu array for B */
+9 -9
View File
@@ -368,7 +368,7 @@ get_perm_c(int ispec, SuperMatrix *A, int *perm_c)
int m, n, bnz, *b_colptr, i;
int delta, maxint, nofsub, *invp;
int *b_rowind, *dhead, *qsize, *llist, *marker;
double t, SuperLU_timer_();
/* double t, SuperLU_timer_(); */
/* make gcc happy */
b_rowind=NULL;
@@ -377,7 +377,7 @@ get_perm_c(int ispec, SuperMatrix *A, int *perm_c)
m = A->nrow;
n = A->ncol;
t = SuperLU_timer_();
/* t = SuperLU_timer_(); */
switch ( ispec ) {
case 0: /* Natural ordering */
for (i = 0; i < n; ++i) perm_c[i] = i;
@@ -391,8 +391,8 @@ get_perm_c(int ispec, SuperMatrix *A, int *perm_c)
#if ( PRNTlevel>=1 )
printf("Use minimum degree ordering on A'*A.\n");
#endif
t = SuperLU_timer_() - t;
/*printf("Form A'*A time = %8.3f\n", t);*/
/*t = SuperLU_timer_() - t;
printf("Form A'*A time = %8.3f\n", t);*/
break;
case 2: /* Minimum degree ordering on A'+A */
if ( m != n ) ABORT("Matrix is not square");
@@ -401,8 +401,8 @@ get_perm_c(int ispec, SuperMatrix *A, int *perm_c)
#if ( PRNTlevel>=1 )
printf("Use minimum degree ordering on A'+A.\n");
#endif
t = SuperLU_timer_() - t;
/*printf("Form A'+A time = %8.3f\n", t);*/
/*t = SuperLU_timer_() - t;
printf("Form A'+A time = %8.3f\n", t);*/
break;
case 3: /* Approximate minimum degree column ordering. */
get_colamd(m, n, Astore->nnz, Astore->colptr, Astore->rowind,
@@ -417,7 +417,7 @@ get_perm_c(int ispec, SuperMatrix *A, int *perm_c)
}
if ( bnz != 0 ) {
t = SuperLU_timer_();
/* t = SuperLU_timer_(); */
/* Initialize and allocate storage for GENMMD. */
delta = 1; /* DELTA is a parameter to allow the choice of nodes
@@ -452,8 +452,8 @@ get_perm_c(int ispec, SuperMatrix *A, int *perm_c)
SUPERLU_FREE(llist);
SUPERLU_FREE(marker);
t = SuperLU_timer_() - t;
/* printf("call GENMMD time = %8.3f\n", t);*/
/* t = SuperLU_timer_() - t;
printf("call GENMMD time = %8.3f\n", t);*/
} else { /* Empty adjacency structure */
for (i = 0; i < n; ++i) perm_c[i] = i;
-1
View File
@@ -303,7 +303,6 @@ scolumn_bmod (
d_fsupc=0 if fsupc >= fpanelc. */
d_fsupc = fst_col - fsupc;
lptr = xlsub[fsupc] + d_fsupc;
luptr = xlusup[fst_col] + d_fsupc;
nsupr = xlsub[fsupc+1] - xlsub[fsupc]; /* Leading dimension */
nsupc = jcol - fst_col; /* Excluding jcol */
-13
View File
@@ -9,9 +9,6 @@ int strsv_(char *, char *, char *, int *, float *, int *, float *, int *);
{
/* System generated locals */
int i__1, i__2;
/* Local variables */
static int info;
static float temp;
@@ -213,14 +210,12 @@ int strsv_(char *, char *, char *, int *, float *, int *, float *, int *);
}
} else {
if (*incx == 1) {
i__1 = *n;
for (j = 1; j <= *n; ++j) {
if (X(j) != 0.f) {
if (nounit) {
X(j) /= A(j,j);
}
temp = X(j);
i__2 = *n;
for (i = j + 1; i <= *n; ++i) {
X(i) -= temp * A(i,j);
/* L50: */
@@ -230,7 +225,6 @@ int strsv_(char *, char *, char *, int *, float *, int *, float *, int *);
}
} else {
jx = kx;
i__1 = *n;
for (j = 1; j <= *n; ++j) {
if (X(jx) != 0.f) {
if (nounit) {
@@ -238,7 +232,6 @@ int strsv_(char *, char *, char *, int *, float *, int *, float *, int *);
}
temp = X(jx);
ix = jx;
i__2 = *n;
for (i = j + 1; i <= *n; ++i) {
ix += *incx;
X(ix) -= temp * A(i,j);
@@ -256,10 +249,8 @@ int strsv_(char *, char *, char *, int *, float *, int *, float *, int *);
if (lsame_(uplo, "U")) {
if (*incx == 1) {
i__1 = *n;
for (j = 1; j <= *n; ++j) {
temp = X(j);
i__2 = j - 1;
for (i = 1; i <= j-1; ++i) {
temp -= A(i,j) * X(i);
/* L90: */
@@ -272,11 +263,9 @@ int strsv_(char *, char *, char *, int *, float *, int *, float *, int *);
}
} else {
jx = kx;
i__1 = *n;
for (j = 1; j <= *n; ++j) {
temp = X(jx);
ix = kx;
i__2 = j - 1;
for (i = 1; i <= j-1; ++i) {
temp -= A(i,j) * X(ix);
ix += *incx;
@@ -294,7 +283,6 @@ int strsv_(char *, char *, char *, int *, float *, int *, float *, int *);
if (*incx == 1) {
for (j = *n; j >= 1; --j) {
temp = X(j);
i__1 = j + 1;
for (i = *n; i >= j+1; --i) {
temp -= A(i,j) * X(i);
/* L130: */
@@ -311,7 +299,6 @@ int strsv_(char *, char *, char *, int *, float *, int *, float *, int *);
for (j = *n; j >= 1; --j) {
temp = X(jx);
ix = kx;
i__1 = j + 1;
for (i = *n; i >= j+1; --i) {
temp -= A(i,j) * X(ix);
ix -= *incx;
-4
View File
@@ -370,8 +370,6 @@ void
sFillRHS(trans_t trans, int nrhs, float *x, int ldx,
SuperMatrix *A, SuperMatrix *B)
{
NCformat *Astore;
float *Aval;
DNformat *Bstore;
float *rhs;
float one = 1.0;
@@ -379,8 +377,6 @@ sFillRHS(trans_t trans, int nrhs, float *x, int ldx,
int ldc;
char transc[1];
Astore = A->Store;
Aval = (float *) Astore->nzval;
Bstore = B->Store;
rhs = Bstore->nzval;
ldc = Bstore->lda;
+2 -1
View File
@@ -24,7 +24,8 @@
#define NUM_TEMPV(m,w,t,b) ( SUPERLU_MAX(m, (t + b)*w) )
#ifndef USER_ABORT
#define USER_ABORT(msg) superlu_abort_and_exit(msg)
#define USER_ABORT(msg) \
{ fprintf(stderr, "%s", msg); exit (-1); }
#endif
#define ABORT(err_msg) \
+6 -9
View File
@@ -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) {
+1 -4
View File
@@ -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 */
+2 -2
View File
@@ -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) {
@@ -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));
+2 -2
View File
@@ -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
{
@@ -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
}
}
}
@@ -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;
+2 -6
View File
@@ -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));
+1 -1
View File
@@ -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;
-1
View File
@@ -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);
@@ -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;
@@ -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;
@@ -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 */
@@ -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) ) {
@@ -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) {
@@ -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;
}
}
@@ -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 */
@@ -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;
}