code cleanup:

always use if (...) even if the macros dont require it (confuses parsers)
  define macros without the ';'s included.
This commit is contained in:
Campbell Barton 2012-04-02 02:41:28 +00:00
parent 6c4d675759
commit 670cdd5381
12 changed files with 112 additions and 97 deletions

@ -362,7 +362,10 @@ short ANIM_animdata_get_context (const bContext *C, bAnimContext *ac)
else {\
filter_mode |= ANIMFILTER_TMP_PEEK; \
} \
(void) _doSubChannels;
\
{ \
(void) _doSubChannels; \
}
/* ... standard sub-channel filtering can go on here now ... */
#define END_ANIMFILTER_SUBCHANNELS \
filter_mode = _filter; \
@ -954,7 +957,7 @@ static FCurve *animfilter_fcurve_next (bDopeSheet *ads, FCurve *first, bActionGr
/* only work with this channel and its subchannels if it is editable */
if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_FCU(fcu)) {
/* only include this curve if selected in a way consistent with the filtering requirements */
if ( ANIMCHANNEL_SELOK(SEL_FCU(fcu)) && ANIMCHANNEL_SELEDITOK(SEL_FCU(fcu)) ) {
if (ANIMCHANNEL_SELOK(SEL_FCU(fcu)) && ANIMCHANNEL_SELEDITOK(SEL_FCU(fcu))) {
/* only include if this curve is active */
if (!(filter_mode & ANIMFILTER_ACTIVE) || (fcu->flag & FCURVE_ACTIVE)) {
/* name based filtering... */
@ -1168,7 +1171,7 @@ static size_t animfilter_nla (bAnimContext *UNUSED(ac), ListBase *anim_data, bDo
/* only work with this channel and its subchannels if it is editable */
if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_NLT(nlt)) {
/* only include this track if selected in a way consistent with the filtering requirements */
if ( ANIMCHANNEL_SELOK(SEL_NLT(nlt)) ) {
if (ANIMCHANNEL_SELOK(SEL_NLT(nlt))) {
/* only include if this track is active */
if (!(filter_mode & ANIMFILTER_ACTIVE) || (nlt->flag & NLATRACK_ACTIVE)) {
ANIMCHANNEL_NEW_CHANNEL(nlt, ANIMTYPE_NLATRACK, owner_id);
@ -1348,7 +1351,7 @@ static size_t animdata_filter_ds_nodetree (bAnimContext *ac, ListBase *anim_data
/* include data-expand widget first */
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
/* check if filtering by active status */
if ANIMCHANNEL_ACTIVEOK(ntree) {
if (ANIMCHANNEL_ACTIVEOK(ntree)) {
ANIMCHANNEL_NEW_CHANNEL(ntree, ANIMTYPE_DSNTREE, owner_id);
}
}
@ -1433,7 +1436,7 @@ static size_t animdata_filter_ds_textures (bAnimContext *ac, ListBase *anim_data
/* include texture-expand widget? */
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
/* check if filtering by active status */
if ANIMCHANNEL_ACTIVEOK(tex) {
if (ANIMCHANNEL_ACTIVEOK(tex)) {
ANIMCHANNEL_NEW_CHANNEL(tex, ANIMTYPE_DSTEX, owner_id);
}
}
@ -1485,7 +1488,7 @@ static size_t animdata_filter_ds_materials (bAnimContext *ac, ListBase *anim_dat
// hmm... do we need to store the index of this material in the array anywhere?
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
/* check if filtering by active status */
if ANIMCHANNEL_ACTIVEOK(ma) {
if (ANIMCHANNEL_ACTIVEOK(ma)) {
ANIMCHANNEL_NEW_CHANNEL(ma, ANIMTYPE_DSMAT, ma);
}
}
@ -1527,7 +1530,7 @@ static size_t animdata_filter_ds_particles (bAnimContext *ac, ListBase *anim_dat
/* include particle-expand widget first */
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
/* check if filtering by active status */
if ANIMCHANNEL_ACTIVEOK(psys->part) {
if (ANIMCHANNEL_ACTIVEOK(psys->part)) {
ANIMCHANNEL_NEW_CHANNEL(psys->part, ANIMTYPE_DSPART, psys->part);
}
}
@ -1667,7 +1670,7 @@ static size_t animdata_filter_ds_obdata (bAnimContext *ac, ListBase *anim_data,
/* include data-expand widget first */
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
/* check if filtering by active status */
if ANIMCHANNEL_ACTIVEOK(iat) {
if (ANIMCHANNEL_ACTIVEOK(iat)) {
ANIMCHANNEL_NEW_CHANNEL(iat, type, iat);
}
}
@ -1701,7 +1704,7 @@ static size_t animdata_filter_ds_keyanim (bAnimContext *ac, ListBase *anim_data,
if (tmp_items) {
/* include key-expand widget first */
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
if ANIMCHANNEL_ACTIVEOK(key) {
if (ANIMCHANNEL_ACTIVEOK(key)) {
ANIMCHANNEL_NEW_CHANNEL(key, ANIMTYPE_DSSKEY, ob);
}
}
@ -1818,7 +1821,7 @@ static size_t animdata_filter_dopesheet_ob (bAnimContext *ac, ListBase *anim_dat
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
/* check if filtering by selection */
// XXX: double-check on this - most of the time, a lot of tools need to filter out these channels!
if ANIMCHANNEL_SELOK((base->flag & SELECT)) {
if (ANIMCHANNEL_SELOK((base->flag & SELECT))) {
/* check if filtering by active status */
if (ANIMCHANNEL_ACTIVEOK(ob)) {
ANIMCHANNEL_NEW_CHANNEL(base, ANIMTYPE_OBJECT, ob);
@ -1863,7 +1866,7 @@ static size_t animdata_filter_ds_world (bAnimContext *ac, ListBase *anim_data, b
/* include data-expand widget first */
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
/* check if filtering by active status */
if ANIMCHANNEL_ACTIVEOK(wo) {
if (ANIMCHANNEL_ACTIVEOK(wo)) {
ANIMCHANNEL_NEW_CHANNEL(wo, ANIMTYPE_DSWOR, sce);
}
}
@ -1968,7 +1971,7 @@ static size_t animdata_filter_dopesheet_scene (bAnimContext *ac, ListBase *anim_
/* firstly add object expander if required */
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
/* check if filtering by selection */
if ANIMCHANNEL_SELOK((sce->flag & SCE_DS_SELECTED)) {
if (ANIMCHANNEL_SELOK((sce->flag & SCE_DS_SELECTED))) {
/* NOTE: active-status doesn't matter for this! */
ANIMCHANNEL_NEW_CHANNEL(sce, ANIMTYPE_SCENE, sce);
}

@ -118,7 +118,7 @@ static void draw_fcurve_modifier_controls_envelope (FModifier *fcm, View2D *v2d)
/* only draw if visible
* - min/max here are fixed, not relative
*/
if IN_RANGE(fed->time, (v2d->cur.xmin - fac), (v2d->cur.xmax + fac)) {
if (IN_RANGE(fed->time, (v2d->cur.xmin - fac), (v2d->cur.xmax + fac))) {
glVertex2f(fed->time, fed->min);
glVertex2f(fed->time, fed->max);
}
@ -149,7 +149,7 @@ static void draw_fcurve_vertices_keyframes (FCurve *fcu, SpaceIpo *UNUSED(sipo),
/* as an optimization step, only draw those in view
* - we apply a correction factor to ensure that points don't pop in/out due to slight twitches of view size
*/
if IN_RANGE(bezt->vec[1][0], (v2d->cur.xmin - fac), (v2d->cur.xmax + fac)) {
if (IN_RANGE(bezt->vec[1][0], (v2d->cur.xmin - fac), (v2d->cur.xmax + fac))) {
if (edit) {
/* 'Keyframe' vertex only, as handle lines and handles have already been drawn
* - only draw those with correct selection state for the current drawing color

@ -4491,7 +4491,7 @@ static void set_trans_object_base_flags(TransInfo *t)
if (parsel->flag & SELECT) {
Base *parbase = object_in_scene(parsel, scene);
if (parbase) { /* in rare cases this can fail */
if TESTBASELIB_BGMODE(v3d, scene, parbase) {
if (TESTBASELIB_BGMODE(v3d, scene, parbase)) {
break;
}
}

@ -531,7 +531,7 @@ int calc_manipulator_stats(const bContext *C)
if (ob && !(ob->flag & SELECT)) ob= NULL;
for (base= scene->base.first; base; base= base->next) {
if TESTBASELIB(v3d, base) {
if (TESTBASELIB(v3d, base)) {
if (ob==NULL)
ob= base->object;
calc_tw_center(scene, base->object->obmat[3]);

@ -859,7 +859,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
if (ob && !(ob->flag & SELECT)) ob = NULL;
for (base= scene->base.first; base; base= base->next) {
if TESTBASELIB(v3d, base) {
if (TESTBASELIB(v3d, base)) {
if (ob == NULL) {
ob= base->object;
break;

@ -45,8 +45,12 @@
#undef AVIIF_KEYFRAME // redefined in AVI_avi.h
#undef AVIIF_LIST // redefined in AVI_avi.h
#define FIXCC(fcc) if (fcc == 0) fcc = mmioFOURCC('N', 'o', 'n', 'e'); \
if (fcc == BI_RLE8) fcc = mmioFOURCC('R', 'l', 'e', '8');
#define FIXCC(fcc) \
{ \
if (fcc == 0) { fcc = mmioFOURCC('N', 'o', 'n', 'e'); } \
if (fcc == BI_RLE8) { fcc = mmioFOURCC('R', 'l', 'e', '8'); } \
}
#endif
#include <sys/types.h>

@ -93,7 +93,7 @@ static int replace_if_different(char *tmpfile, const char *dep_files[])
return -1; \
} \
remove(tmpfile); \
return 1; \
return 1 \
/* end REN_IF_DIFF */

@ -47,66 +47,69 @@
#ifdef UNIT_TEST
#define DEF_VARS(type, prefix) \
static type prefix ## arr[ARRAY_SIZE]; \
static type prefix ## darr[DYNAMIC_ARRAY_SIZE]; \
static int prefix ## darr_len = ARRAY_SIZE; \
static type prefix ## marr MARRAY_DIM; \
static type prefix ## dmarr DYNAMIC_MARRAY_DIM; \
static int prefix ## dmarr_len = sizeof(prefix ## dmarr);
#define DEF_VARS(type, prefix) \
static type prefix ## arr[ARRAY_SIZE]; \
static type prefix ## darr[DYNAMIC_ARRAY_SIZE]; \
static int prefix ## darr_len = ARRAY_SIZE; \
static type prefix ## marr MARRAY_DIM; \
static type prefix ## dmarr DYNAMIC_MARRAY_DIM; \
static int prefix ## dmarr_len = sizeof(prefix ## dmarr); \
(void)0
#define DEF_GET_SET(type, arr) \
void rna_Test_ ## arr ## _get(PointerRNA *ptr, type *values) \
{ \
memcpy(values, arr, sizeof(arr)); \
} \
\
void rna_Test_ ## arr ## _set(PointerRNA *ptr, const type *values) \
{ \
memcpy(arr, values, sizeof(arr)); \
}
#define DEF_GET_SET(type, arr) \
void rna_Test_ ## arr ## _get(PointerRNA * ptr, type * values) \
{ \
memcpy(values, arr, sizeof(arr)); \
} \
\
void rna_Test_ ## arr ## _set(PointerRNA * ptr, const type * values) \
{ \
memcpy(arr, values, sizeof(arr)); \
} \
(void)0
#define DEF_GET_SET_LEN(arr, max) \
static int rna_Test_ ## arr ## _get_length(PointerRNA *ptr) \
{ \
return arr ## _len; \
} \
\
static int rna_Test_ ## arr ## _set_length(PointerRNA *ptr, int length) \
{ \
if (length > max) \
return 0; \
\
arr ## _len = length; \
\
return 1; \
} \
#define DEF_GET_SET_LEN(arr, max) \
static int rna_Test_ ## arr ## _get_length(PointerRNA * ptr) \
{ \
return arr ## _len; \
} \
\
static int rna_Test_ ## arr ## _set_length(PointerRNA * ptr, int length) \
{ \
if (length > max) \
return 0; \
\
arr ## _len = length; \
\
return 1; \
} \
(void)0
DEF_VARS(float, f)
DEF_VARS(int, i)
DEF_VARS(int, b)
DEF_VARS(float, f);
DEF_VARS(int, i);
DEF_VARS(int, b);
DEF_GET_SET(float, farr)
DEF_GET_SET(int, iarr)
DEF_GET_SET(int, barr)
DEF_GET_SET(float, farr);
DEF_GET_SET(int, iarr);
DEF_GET_SET(int, barr);
DEF_GET_SET(float, fmarr)
DEF_GET_SET(int, imarr)
DEF_GET_SET(int, bmarr)
DEF_GET_SET(float, fmarr);
DEF_GET_SET(int, imarr);
DEF_GET_SET(int, bmarr);
DEF_GET_SET(float, fdarr)
DEF_GET_SET_LEN(fdarr, DYNAMIC_ARRAY_SIZE)
DEF_GET_SET(int, idarr)
DEF_GET_SET_LEN(idarr, DYNAMIC_ARRAY_SIZE)
DEF_GET_SET(int, bdarr)
DEF_GET_SET_LEN(bdarr, DYNAMIC_ARRAY_SIZE)
DEF_GET_SET(float, fdarr);
DEF_GET_SET_LEN(fdarr, DYNAMIC_ARRAY_SIZE);
DEF_GET_SET(int, idarr);
DEF_GET_SET_LEN(idarr, DYNAMIC_ARRAY_SIZE);
DEF_GET_SET(int, bdarr);
DEF_GET_SET_LEN(bdarr, DYNAMIC_ARRAY_SIZE);
DEF_GET_SET(float, fdmarr)
DEF_GET_SET_LEN(fdmarr, DYNAMIC_MARRAY_SIZE(float))
DEF_GET_SET(int, idmarr)
DEF_GET_SET_LEN(idmarr, DYNAMIC_MARRAY_SIZE(int))
DEF_GET_SET(int, bdmarr)
DEF_GET_SET_LEN(bdmarr, DYNAMIC_MARRAY_SIZE(int))
DEF_GET_SET(float, fdmarr);
DEF_GET_SET_LEN(fdmarr, DYNAMIC_MARRAY_SIZE(float));
DEF_GET_SET(int, idmarr);
DEF_GET_SET_LEN(idmarr, DYNAMIC_MARRAY_SIZE(int));
DEF_GET_SET(int, bdmarr);
DEF_GET_SET_LEN(bdmarr, DYNAMIC_MARRAY_SIZE(int));
#endif
@ -186,4 +189,4 @@ void RNA_def_test(BlenderRNA *brna)
#endif
}
#endif /* RNA_RUNTIME */
#endif /* RNA_RUNTIME */

@ -205,10 +205,11 @@ static MFace *get_dface(DerivedMesh *dm, DerivedMesh *split, int cur, int i, MFa
}
#define SET_VERTS(a, b, c, d) \
v[0]=mf->v##a; uv[0]=a-1; \
v[1]=mf->v##b; uv[1]=b-1; \
v[2]=mf->v##c; uv[2]=c-1; \
v[3]=mf->v##d; uv[3]=d-1;
v[0] = mf->v##a; uv[0]=a-1; \
v[1] = mf->v##b; uv[1]=b-1; \
v[2] = mf->v##c; uv[2]=c-1; \
v[3] = mf->v##d; uv[3]=d-1; \
(void)0
#define GET_ES(v1, v2) edgecut_get(eh, v1, v2)
#define INT_UV(uvf, c0, c1) interp_v2_v2v2(uvf, mf->uv[c0], mf->uv[c1], 0.5f)
@ -683,30 +684,30 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
case 10:
case 11:
case 15:
SET_VERTS(1, 2, 3, 4)
SET_VERTS(1, 2, 3, 4);
break;
case 5:
case 6:
case 7:
SET_VERTS(2, 3, 4, 1)
SET_VERTS(2, 3, 4, 1);
break;
case 9:
case 13:
SET_VERTS(4, 1, 2, 3)
SET_VERTS(4, 1, 2, 3);
break;
case 12:
case 14:
SET_VERTS(3, 4, 1, 2)
SET_VERTS(3, 4, 1, 2);
break;
case 21:
case 23:
SET_VERTS(1, 2, 3, 4)
SET_VERTS(1, 2, 3, 4);
break;
case 19:
SET_VERTS(2, 3, 1, 4)
SET_VERTS(2, 3, 1, 4);
break;
case 22:
SET_VERTS(3, 1, 2, 4)
SET_VERTS(3, 1, 2, 4);
break;
}

@ -48,7 +48,8 @@ static bNodeSocketTemplate cmp_node_bilateralblur_out[]= {
mean1[0] = src[0]; \
mean1[1] = src[1]; \
mean1[2] = src[2]; \
mean1[3] = src[3];
mean1[3] = src[3]; \
(void)0
/* finds color distances */
#define COLOR_DISTANCE_C3(c1, c2) \
@ -66,25 +67,28 @@ static bNodeSocketTemplate cmp_node_bilateralblur_out[]= {
(double)COLOR_DISTANCE_C3(ref, ref_color ) * i2sigma_color; \
w = 1.0/(w*w + 1); \
mean0 += w; \
mean1[0] += (double)temp_color[0]*w; \
mean1[1] += (double)temp_color[1]*w; \
mean1[2] += (double)temp_color[2]*w; \
mean1[3] += (double)temp_color[3]*w;
mean1[0] += (double)temp_color[0] * w; \
mean1[1] += (double)temp_color[1] * w; \
mean1[2] += (double)temp_color[2] * w; \
mean1[3] += (double)temp_color[3] * w; \
(void)0
/* write blurred values to image */
#define UPDATE_OUTPUT_C3 \
mean0 = 1.0/mean0; \
dest[x*pix + 0] = mean1[0]*mean0; \
dest[x*pix + 1] = mean1[1]*mean0; \
dest[x*pix + 2] = mean1[2]*mean0; \
dest[x*pix + 3] = mean1[3]*mean0;
dest[x * pix + 0] = mean1[0] * mean0; \
dest[x * pix + 1] = mean1[1] * mean0; \
dest[x * pix + 2] = mean1[2] * mean0; \
dest[x * pix + 3] = mean1[3] * mean0; \
(void)0
/* initializes deltas for fast access to neighbor pixels */
#define INIT_3X3_DELTAS( deltas, step, nch ) \
((deltas)[0] = (nch), (deltas)[1] = -(step) + (nch), \
(deltas)[2] = -(step), (deltas)[3] = -(step) - (nch), \
(deltas)[4] = -(nch), (deltas)[5] = (step) - (nch), \
(deltas)[6] = (step), (deltas)[7] = (step) + (nch));
(deltas)[6] = (step), (deltas)[7] = (step) + (nch)); \
(void)0
/* code of this node was heavily inspired by the smooth function of opencv library.

@ -5861,7 +5861,7 @@ void RE_make_sticky(Scene *scene, View3D *v3d)
RE_SetView(re, mat);
for (base= FIRSTBASE; base; base= base->next) {
if TESTBASELIB(v3d, base) {
if (TESTBASELIB(v3d, base)) {
if (base->object->type==OB_MESH) {
ob= base->object;

@ -397,7 +397,7 @@ static float vol_get_phasefunc(ShadeInput *UNUSED(shi), float g, const float w[3
case MA_VOL_PH_RAYLEIGH:
return normalize * 3.f/4.f * (1 + costheta * costheta);
case MA_VOL_PH_HG:
return normalize * (1.f - g*g) / powf(1.f + g*g - 2.f * g * costheta, 1.5f));
return normalize * (1.f - g * g) / powf(1.f + g * g - 2.f * g * costheta, 1.5f);
case MA_VOL_PH_SCHLICK:
{
const float k = 1.55f * g - .55f * g * g * g;