Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-03-22 05:35:13 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-03-22 05:35:13 +0400
commitb6c2f9ddabd54530906661150640daa31b50e1e9 (patch)
treebe881cc0d8d7f6060abf4f3d2ecf476dd356cc3a
parentb56d2f97662e0277076b7a7fd1f7a19380dc9f63 (diff)
style cleanup: enforce macros using a semicolon.
-rw-r--r--source/blender/blenkernel/intern/customdata_file.c5
-rw-r--r--source/blender/blenlib/BLI_utildefines.h65
-rw-r--r--source/blender/blenloader/intern/readfile.c10
-rw-r--r--source/blender/editors/mesh/meshtools.c5
-rw-r--r--source/blender/editors/physics/particle_edit.c16
-rw-r--r--source/blender/editors/uvedit/uvedit_ops.c2
-rw-r--r--source/blender/render/intern/source/occlusion.c5
7 files changed, 66 insertions, 42 deletions
diff --git a/source/blender/blenkernel/intern/customdata_file.c b/source/blender/blenkernel/intern/customdata_file.c
index 5538267a5f1..a89307399d9 100644
--- a/source/blender/blenkernel/intern/customdata_file.c
+++ b/source/blender/blenkernel/intern/customdata_file.c
@@ -328,8 +328,9 @@ int cdf_read_data(CDataFile *cdf, unsigned int size, void *data)
if(cdf->switchendian) {
fdata= data;
- for(a=0; a<size/sizeof(float); a++)
- SWITCH_INT(fdata[a])
+ for (a=0; a<size/sizeof(float); a++) {
+ SWITCH_INT(fdata[a]);
+ }
}
return 1;
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h
index d3f1d526317..4fa0438a9ea 100644
--- a/source/blender/blenlib/BLI_utildefines.h
+++ b/source/blender/blenlib/BLI_utildefines.h
@@ -53,8 +53,21 @@
#define ELEM11(a, b, c, d, e, f, g, h, i, j, k, l) ( ELEM4(a, b, c, d, e) || ELEM7(a, f, g, h, i, j, k, l) )
/* shift around elements */
-#define SHIFT3(type, a, b, c) { type tmp; tmp = a; a = c; c = b; b = tmp; }
-#define SHIFT4(type, a, b, c, d) { type tmp; tmp = a; a = d; d = c; c = b; b = tmp; }
+#define SHIFT3(type, a, b, c) { \
+ type tmp; \
+ tmp = a; \
+ a = c; \
+ c = b; \
+ b = tmp; \
+ } (void)0
+#define SHIFT4(type, a, b, c, d) { \
+ type tmp; \
+ tmp = a; \
+ a = d; \
+ d = c; \
+ c = b; \
+ b = tmp; \
+ } (void)0
/* min/max */
#define MIN2(x,y) ( (x)<(y) ? (x) : (y) )
@@ -72,17 +85,17 @@
#define INIT_MINMAX2(min, max) { \
(min)[0]= (min)[1]= 1.0e30f; \
(max)[0]= (max)[1]= -1.0e30f; \
- }
+ } (void)0
#define DO_MIN(vec, min) { \
if( (min)[0]>(vec)[0] ) (min)[0]= (vec)[0]; \
if( (min)[1]>(vec)[1] ) (min)[1]= (vec)[1]; \
if( (min)[2]>(vec)[2] ) (min)[2]= (vec)[2]; \
- }
+ } (void)0
#define DO_MAX(vec, max) { \
if( (max)[0]<(vec)[0] ) (max)[0]= (vec)[0]; \
if( (max)[1]<(vec)[1] ) (max)[1]= (vec)[1]; \
if( (max)[2]<(vec)[2] ) (max)[2]= (vec)[2]; \
- }
+ } (void)0
#define DO_MINMAX(vec, min, max) { \
if( (min)[0]>(vec)[0] ) (min)[0]= (vec)[0]; \
if( (min)[1]>(vec)[1] ) (min)[1]= (vec)[1]; \
@@ -90,13 +103,13 @@
if( (max)[0]<(vec)[0] ) (max)[0]= (vec)[0]; \
if( (max)[1]<(vec)[1] ) (max)[1]= (vec)[1]; \
if( (max)[2]<(vec)[2] ) (max)[2]= (vec)[2]; \
- }
+ } (void)0
#define DO_MINMAX2(vec, min, max) { \
if( (min)[0]>(vec)[0] ) (min)[0]= (vec)[0]; \
if( (min)[1]>(vec)[1] ) (min)[1]= (vec)[1]; \
if( (max)[0]<(vec)[0] ) (max)[0]= (vec)[0]; \
if( (max)[1]<(vec)[1] ) (max)[1]= (vec)[1]; \
- }
+ } (void)0
/* some math and copy defines */
@@ -113,59 +126,65 @@
(v1)[0]= FTOCHAR((v2[0])); \
(v1)[1]= FTOCHAR((v2[1])); \
(v1)[2]= FTOCHAR((v2[2])); \
- }
+ } (void)0
#define F3TOCHAR4(v2, v1) { \
(v1)[0]= FTOCHAR((v2[0])); \
(v1)[1]= FTOCHAR((v2[1])); \
(v1)[2]= FTOCHAR((v2[2])); \
(v1)[3]= 255; \
- }
+ } (void)0
#define F4TOCHAR4(v2, v1) { \
(v1)[0]= FTOCHAR((v2[0])); \
(v1)[1]= FTOCHAR((v2[1])); \
(v1)[2]= FTOCHAR((v2[2])); \
(v1)[3]= FTOCHAR((v2[3])); \
- }
+ } (void)0
#define VECCOPY(v1, v2) { \
*(v1)= *(v2); \
*(v1+1)= *(v2+1); \
*(v1+2)= *(v2+2); \
- }
+ } (void)0
#define VECCOPY2D(v1, v2) { \
*(v1)= *(v2); \
*(v1+1)= *(v2+1); \
- }
+ } (void)0
#define VECADD(v1,v2,v3) { \
*(v1)= *(v2) + *(v3); \
*(v1+1)= *(v2+1) + *(v3+1); \
*(v1+2)= *(v2+2) + *(v3+2); \
- }
+ } (void)0
#define VECSUB(v1,v2,v3) { \
*(v1)= *(v2) - *(v3); \
*(v1+1)= *(v2+1) - *(v3+1); \
*(v1+2)= *(v2+2) - *(v3+2); \
- }
+ } (void)0
#define VECSUB2D(v1,v2,v3) { \
*(v1)= *(v2) - *(v3); \
*(v1+1)= *(v2+1) - *(v3+1); \
- }
+ } (void)0
#define VECADDFAC(v1,v2,v3,fac) { \
*(v1)= *(v2) + *(v3)*(fac); \
*(v1+1)= *(v2+1) + *(v3+1)*(fac); \
*(v1+2)= *(v2+2) + *(v3+2)*(fac); \
- }
+ } (void)0
#define VECSUBFAC(v1,v2,v3,fac) { \
*(v1)= *(v2) - *(v3)*(fac); \
*(v1+1)= *(v2+1) - *(v3+1)*(fac); \
*(v1+2)= *(v2+2) - *(v3+2)*(fac); \
- }
+ } (void)0
#define INPR(v1, v2) ( (v1)[0]*(v2)[0] + (v1)[1]*(v2)[1] + (v1)[2]*(v2)[2] )
/* some misc stuff.... */
#define CLAMP(a, b, c) if((a)<(b)) (a)=(b); else if((a)>(c)) (a)=(c)
#define CLAMPIS(a, b, c) ((a)<(b) ? (b) : (a)>(c) ? (c) : (a))
-#define CLAMPTEST(a, b, c) if((b)<(c)) {CLAMP(a, b, c);} else {CLAMP(a, c, b);}
+#define CLAMPTEST(a, b, c) \
+ if ((b) < (c)) { \
+ CLAMP(a, b, c); \
+ } \
+ else { \
+ CLAMP(a, c, b); \
+ } (void)
#define IS_EQ(a,b) ((fabs((double)(a)-(b)) >= (double) FLT_EPSILON) ? 0 : 1)
#define IS_EQF(a,b) ((fabsf((float)(a)-(b)) >= (float) FLT_EPSILON) ? 0 : 1)
@@ -191,26 +210,26 @@
s_i= p_i[1]; p_i[1]= p_i[6]; p_i[6]= s_i; \
s_i= p_i[2]; p_i[2]= p_i[5]; p_i[5]= s_i; \
s_i= p_i[3]; p_i[3]= p_i[4]; p_i[4]= s_i; \
- }
+ } (void)0
#define SWITCH_INT(a) { \
char s_i, *p_i; \
p_i= (char *)&(a); \
s_i= p_i[0]; p_i[0]= p_i[3]; p_i[3]= s_i; \
s_i= p_i[1]; p_i[1]= p_i[2]; p_i[2]= s_i; \
- }
+ } (void)0
#define SWITCH_SHORT(a) { \
char s_i, *p_i; \
p_i= (char *)&(a); \
s_i=p_i[0]; p_i[0]=p_i[1]; p_i[1]=s_i; \
- }
+ } (void)0
/* Warning-free macros for storing ints in pointers. Use these _only_
* for storing an int in a pointer, not a pointer in an int (64bit)! */
-#define SET_INT_IN_POINTER(i) ((void*)(intptr_t)(i))
-#define GET_INT_FROM_POINTER(i) ((int)(intptr_t)(i))
+#define SET_INT_IN_POINTER(i) ((void *)(intptr_t)(i))
+#define GET_INT_FROM_POINTER(i) ((int)(intptr_t)(i))
/* Macro to convert a value to string in the preprocessor
* STRINGIFY_ARG: gives the argument as a string
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 99aa35f3355..f1e8d01cfd4 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -4489,20 +4489,20 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
if(mmd->bindoffsets)
for(a=0; a<mmd->totvert+1; a++)
- SWITCH_INT(mmd->bindoffsets[a])
+ SWITCH_INT(mmd->bindoffsets[a]);
if(mmd->bindcagecos)
for(a=0; a<mmd->totcagevert*3; a++)
- SWITCH_INT(mmd->bindcagecos[a])
+ SWITCH_INT(mmd->bindcagecos[a]);
if(mmd->dynverts)
for(a=0; a<mmd->totvert; a++)
- SWITCH_INT(mmd->dynverts[a])
+ SWITCH_INT(mmd->dynverts[a]);
if(mmd->bindweights)
for(a=0; a<mmd->totcagevert*mmd->totvert; a++)
- SWITCH_INT(mmd->bindweights[a])
+ SWITCH_INT(mmd->bindweights[a]);
if(mmd->bindcos)
for(a=0; a<mmd->totcagevert*3; a++)
- SWITCH_INT(mmd->bindcos[a])
+ SWITCH_INT(mmd->bindcos[a]);
}
}
else if (md->type==eModifierType_Ocean) {
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c
index 44d923a009b..919e2b03583 100644
--- a/source/blender/editors/mesh/meshtools.c
+++ b/source/blender/editors/mesh/meshtools.c
@@ -801,8 +801,9 @@ intptr_t mesh_octree_table(Object *ob, BMEditMesh *em, float *co, char mode)
BMIter iter;
BMVert *eve;
- BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL)
- DO_MINMAX(eve->co, min, max)
+ BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
+ DO_MINMAX(eve->co, min, max);
+ }
}
else {
MVert *mvert;
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 57809b2243b..dfec87b0da4 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -2645,10 +2645,12 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged)
newpa->fuv[2]= pa->fuv[0];
newpa->fuv[3]= pa->fuv[3];
while(rotation-- > 0)
- if(me->mface[pa->num].v4)
- SHIFT4(float, newpa->fuv[0], newpa->fuv[1], newpa->fuv[2], newpa->fuv[3])
- else
- SHIFT3(float, newpa->fuv[0], newpa->fuv[1], newpa->fuv[2])
+ if (me->mface[pa->num].v4) {
+ SHIFT4(float, newpa->fuv[0], newpa->fuv[1], newpa->fuv[2], newpa->fuv[3]);
+ }
+ else {
+ SHIFT3(float, newpa->fuv[0], newpa->fuv[1], newpa->fuv[2]);
+ }
/* assign face inddex */
newpa->num= mirrorfaces[pa->num*2];
@@ -3105,9 +3107,9 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm,
DO_MINMAX(v1,min,max);
DO_MINMAX(v2,min,max);
DO_MINMAX(v3,min,max);
- if(mface->v4)
- DO_MINMAX(v4,min,max)
- if(isect_aabb_aabb_v3(min,max,p_min,p_max)==0)
+ if (mface->v4)
+ DO_MINMAX(v4, min, max);
+ if (isect_aabb_aabb_v3(min,max,p_min,p_max)==0)
continue;
}
else{
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index 6722c72f686..744a415b23c 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -1354,7 +1354,7 @@ static void weld_align_uv(bContext *C, int tool)
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
if (uvedit_uv_selected(em, scene, l)) {
luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
- DO_MINMAX2(luv->uv, min, max)
+ DO_MINMAX2(luv->uv, min, max);
}
}
}
diff --git a/source/blender/render/intern/source/occlusion.c b/source/blender/render/intern/source/occlusion.c
index 47b13cd484d..6ebd84d6635 100644
--- a/source/blender/render/intern/source/occlusion.c
+++ b/source/blender/render/intern/source/occlusion.c
@@ -403,8 +403,9 @@ static int occ_find_bbox_axis(OcclusionTree *tree, int begin, int end, float *mi
INIT_MINMAX(min, max);
- for(a=begin; a<end; a++)
- DO_MINMAX(tree->co[a], min, max)
+ for (a = begin; a < end; a++) {
+ DO_MINMAX(tree->co[a], min, max);
+ }
for(a=0; a<3; a++) {
len= max[a] - min[a];