style cleanup: if's on the same line.
authorCampbell Barton <ideasman42@gmail.com>
Sun, 18 Nov 2012 02:41:55 +0000 (02:41 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 18 Nov 2012 02:41:55 +0000 (02:41 +0000)
intern/ghost/intern/GHOST_SystemCocoa.mm
source/blender/avi/intern/avi_rgb.c
source/blender/blenkernel/intern/curve.c
source/blender/blenkernel/intern/library.c
source/blender/blenkernel/intern/particle.c
source/blender/blenlib/intern/noise.c
source/blender/editors/curve/editcurve.c
source/blender/editors/interface/interface_regions.c
source/blender/imbuf/intern/scaling.c

index 475ad2bdcb329bf1c021fbd8cab8bd3da49df5d6..628b0d038f925016ad8e9cff3b6c7124bcea0696 100644 (file)
@@ -1591,13 +1591,17 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
                                        if ((dx == 0) && (dy == 0)) break;
                                        
                                        /* Quadratic acceleration */
-                                       dx = dx*(fabs(dx)+0.5);
-                                       if (dx<0.0) dx-=0.5; else dx+=0.5;
-                                       if (dx< -deltaMax) dx= -deltaMax; else if (dx>deltaMax) dx=deltaMax;
+                                       dx = dx*(fabs(dx) + 0.5);
+                                       if (dx < 0.0) dx -= 0.5;
+                                       else          dx += 0.5;
+                                       if      (dx < -deltaMax) dx = -deltaMax;
+                                       else if (dx >  deltaMax) dx =  deltaMax;
                                        
-                                       dy = dy*(fabs(dy)+0.5);
-                                       if (dy<0.0) dy-=0.5; else dy+=0.5;
-                                       if (dy< -deltaMax) dy= -deltaMax; else if (dy>deltaMax) dy=deltaMax;
+                                       dy = dy*(fabs(dy) + 0.5);
+                                       if (dy < 0.0) dy -= 0.5;
+                                       else          dy += 0.5;
+                                       if      (dy < -deltaMax) dy= -deltaMax;
+                                       else if (dy >  deltaMax) dy=  deltaMax;
 
                                        window->clientToScreenIntern(mousePos.x, mousePos.y, x, y);
                                        dy = -dy;
index 11d9bdf8612a75f08f0ba8460f8e8dc8737ce21c..c6a78eccce25a59e680101d3939c67bd11ec72d1 100644 (file)
@@ -98,7 +98,7 @@ void *avi_converter_from_avi_rgb(AviMovie *movie, int stream, unsigned char *buf
                buf = MEM_mallocN(movie->header->Height * movie->header->Width * 3, "fromavirgbbuf");
        
                rowstride = movie->header->Width * 3;
-               if (bits != 16) if (movie->header->Width % 2) rowstride++;
+               if ((bits != 16) && (movie->header->Width % 2)) rowstride++;
        
                for (y = 0; y < movie->header->Height; y++) {
                        memcpy(&buf[y * movie->header->Width * 3], &buffer[((movie->header->Height - 1) - y) * rowstride], movie->header->Width * 3);
index f2cd695d64abc6cdd6640b0372594952da7eaba0..754a4fbc0c83c2b289c594b80952a4b2a6c60899 100644 (file)
@@ -1116,7 +1116,7 @@ void BKE_nurb_makeCurve(Nurb *nu, float *coord_array, float *tilt_array, float *
                        *fp = basisu[i] * bp->vec[3];
                        sumdiv += *fp;
                }
-               if (sumdiv != 0.0f) if (sumdiv < 0.999f || sumdiv > 1.001f) {
+               if ((sumdiv != 0.0f) && (sumdiv < 0.999f || sumdiv > 1.001f)) {
                        /* is normalizing needed? */
                        fp = sum;
                        for (i = istart; i <= iend; i++, fp++) {
index 9deff12f1241402ba00964a824cd012704d867f1..eb0612a75bddb2cfbacab7fcef153e2e8fc9c3ad 100644 (file)
@@ -1520,7 +1520,9 @@ void test_idbutton(char *name)
        /* search for id */
        idtest = BLI_findstring(lb, name, offsetof(ID, name) + 2);
 
-       if (idtest) if (new_id(lb, idtest, name) == 0) id_sort_by_name(lb, idtest);
+       if (idtest && (new_id(lb, idtest, name) == 0)) {
+               id_sort_by_name(lb, idtest);
+       }
 }
 
 void text_idbutton(struct ID *id, char *text)
index d645204d29c8dfd223f635e5c72854a8aa8bfad4..93bf5a5c0b4add225055f0e7edf3bf1c9a7d73d5 100644 (file)
@@ -3786,14 +3786,22 @@ static int get_particle_uv(DerivedMesh *dm, ParticleData *pa, int face_index, co
        return 1;
 }
 
-#define SET_PARTICLE_TEXTURE(type, pvalue, texfac)  \
-       if ((event & mtex->mapto) & type) { pvalue = texture_value_blend(def, pvalue, value, texfac, blend); } (void)0
-
-#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue)  \
-       if (event & type) { if (pvalue < 0.0f) pvalue = 1.0f + pvalue; CLAMP(pvalue, 0.0f, 1.0f); } (void)0
-
-#define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue)  \
-       if (event & type) { CLAMP(pvalue, -1.0f, 1.0f); } (void)0
+#define SET_PARTICLE_TEXTURE(type, pvalue, texfac)                            \
+       if ((event & mtex->mapto) & type) {                                       \
+               pvalue = texture_value_blend(def, pvalue, value, texfac, blend);      \
+       } (void)0
+
+#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue)                              \
+       if (event & type) {                                                       \
+               if (pvalue < 0.0f)                                                    \
+                       pvalue = 1.0f + pvalue;                                           \
+               CLAMP(pvalue, 0.0f, 1.0f);                                            \
+       } (void)0
+
+#define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue)                           \
+       if (event & type) {                                                       \
+               CLAMP(pvalue, -1.0f, 1.0f);                                           \
+       } (void)0
 
 static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSettings *part, ParticleData *par, int child_index, int face_index, const float fw[4], float *orco, ParticleTexture *ptex, int event, float cfra)
 {
@@ -3802,8 +3810,8 @@ static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSetti
        float value, rgba[4], texvec[3];
 
        ptex->ivel = ptex->life = ptex->exist = ptex->size = ptex->damp =
-                                                                ptex->gravity = ptex->field = ptex->time = ptex->clump = ptex->kink =
-                                                                                                                             ptex->effector = ptex->rough1 = ptex->rough2 = ptex->roughe = 1.f;
+       ptex->gravity = ptex->field = ptex->time = ptex->clump = ptex->kink =
+       ptex->effector = ptex->rough1 = ptex->rough2 = ptex->roughe = 1.0f;
 
        ptex->length = 1.0f - part->randlength * PSYS_FRAND(child_index + 26);
        ptex->length *= part->clength_thres < PSYS_FRAND(child_index + 27) ? part->clength : 1.0f;
index 6bb59e1e195ab0bfc5d2652c026b1f31acdf8a18..f37e1e03f39a868da180c1e4605be28d0c7ee309 100644 (file)
@@ -398,7 +398,8 @@ static float orgBlenderNoise(float x, float y, float z)
        h = hashvectf + 3 * hash[b21 + b11];
        n += i * (h[0] * jx + h[1] * jy + h[2] * jz);
 
-       if (n < 0.0f) n = 0.0f; else if (n > 1.0f) n = 1.0f;
+       if      (n < 0.0f) n = 0.0f;
+       else if (n > 1.0f) n = 1.0f;
        return n;
 }
 
@@ -1890,7 +1891,8 @@ float mg_RidgedMultiFractal(float x, float y, float z, float H, float lacunarity
                y *= lacunarity;
                z *= lacunarity;
                weight = signal * gain;
-               if (weight > 1.0f) weight = 1.0f; else if (weight < 0.0f) weight = 0.0f;
+               if      (weight > 1.0f) weight = 1.0f;
+               else if (weight < 0.0f) weight = 0.0f;
                signal = offset - fabsf(noisefunc(x, y, z));
                signal *= signal;
                signal *= weight;
index 957dcfbd8481cc295751e26886781f862c3af77a..348b98a03800fe361976438aaf226ed800e578dc 100644 (file)
@@ -3678,10 +3678,12 @@ static int is_u_selected(Nurb *nu, int u)
        /* what about resolu == 2? */
        bp = &nu->bp[u];
        for (v = 0; v < nu->pntsv - 1; v++, bp += nu->pntsu) {
-               if (v) if (bp->f1 & SELECT) return 1;
+               if ((v != 0) && (bp->f1 & SELECT)) {
+                       return TRUE;
+               }
        }
        
-       return 0;
+       return FALSE;
 }
 
 typedef struct NurbSort {
@@ -6464,7 +6466,7 @@ Nurb *add_nurbs_primitive(bContext *C, Object *obedit, float mat[4][4], int type
                                                bp->vec[0] += fac * grid;
                                                fac = (float)b - 1.5f;
                                                bp->vec[1] += fac * grid;
-                                               if (a == 1 || a == 2) if (b == 1 || b == 2) {
+                                               if ((a == 1 || a == 2) && (b == 1 || b == 2)) {
                                                        bp->vec[2] += grid;
                                                }
                                                mul_m4_v3(mat, bp->vec);
index 9b77072dee135fd65ad963b1d06ccc0e10da8fa0..c1547593f963ec2720ab03e6ef7ebf3da9ad6e60 100644 (file)
@@ -1409,8 +1409,8 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
                        dir1 &= (UI_TOP | UI_DOWN);
                }
 
-               if (dir2 == 0) if (dir1 == UI_LEFT || dir1 == UI_RIGHT) dir2 = UI_DOWN;
-               if (dir2 == 0) if (dir1 == UI_TOP || dir1 == UI_DOWN) dir2 = UI_LEFT;
+               if ((dir2 == 0) && (dir1 == UI_LEFT || dir1 == UI_RIGHT)) dir2 = UI_DOWN;
+               if ((dir2 == 0) && (dir1 == UI_TOP  || dir1 == UI_DOWN))  dir2 = UI_LEFT;
                
                /* no space at all? don't change */
                if (left || right) {
index b9525ccccf147cc8a5c43171e69bdb0a843068bc..1e701b8d615ee8713d9c2e97f497f91e6f83b602 100644 (file)
@@ -1467,10 +1467,10 @@ struct ImBuf *IMB_scaleImBuf(struct ImBuf *ibuf, unsigned int newx, unsigned int
                return ibuf;
        }
 
-       if (newx < ibuf->x) if (newx) scaledownx(ibuf, newx);
-       if (newy < ibuf->y) if (newy) scaledowny(ibuf, newy);
-       if (newx > ibuf->x) if (newx) scaleupx(ibuf, newx);
-       if (newy > ibuf->y) if (newy) scaleupy(ibuf, newy);
+       if (newx && (newx < ibuf->x)) scaledownx(ibuf, newx);
+       if (newy && (newy < ibuf->y)) scaledowny(ibuf, newy);
+       if (newx && (newx > ibuf->x)) scaleupx(ibuf, newx);
+       if (newy && (newy > ibuf->y)) scaleupy(ibuf, newy);
        
        return(ibuf);
 }