Code cleanup: correct abs use and quiet warnings
authorCampbell Barton <ideasman42@gmail.com>
Sat, 1 Mar 2014 03:20:54 +0000 (14:20 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 1 Mar 2014 03:26:18 +0000 (14:26 +1100)
12 files changed:
source/blender/blenkernel/intern/curve.c
source/blender/blenkernel/intern/dynamicpaint.c
source/blender/blenkernel/intern/seqeffects.c
source/blender/blenlib/intern/graph.c
source/blender/editors/curve/editcurve.c
source/blender/editors/interface/interface_handlers.c
source/blender/editors/mesh/editmesh_knife.c
source/blender/editors/sculpt_paint/sculpt.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/uvedit/uvedit_parametrizer.c
source/blender/python/bmesh/bmesh_py_ops_call.c
source/blender/render/intern/source/pixelshading.c

index 6c04100feff5760af174bdb19e6fc75f6fb4b935..2a4882f7d4bfa64f7a9afcf64e2a9d319fa49554 100644 (file)
@@ -3600,7 +3600,7 @@ void BKE_nurb_direction_switch(Nurb *nu)
                                a--;
                                fp2[a] = fp1[a];
                                while (a--) {
-                                       fp2[0] = fabs(fp1[1] - fp1[0]);
+                                       fp2[0] = fabsf(fp1[1] - fp1[0]);
                                        fp1++;
                                        fp2++;
                                }
index 997876dcd5898a7fb2462364ce38801f48fed33f..b56522034c5368a353b9a5d126c22b791af9b4c2 100644 (file)
@@ -4133,7 +4133,7 @@ static void surface_determineForceTargetPoints(PaintSurfaceData *sData, int inde
                closest_d[0] = 1.0f - closest_d[1];
 
                /* and multiply depending on how deeply force intersects surface */
-               temp = fabs(force_intersect);
+               temp = fabsf(force_intersect);
                CLAMP(temp, 0.0f, 1.0f);
                mul_v2_fl(closest_d, acosf(temp) / (float)M_PI_2);
        }
index 0d05966dfa5bcde5a84735d9f056334e382c668b..145b6954eb06ca51884f869bf26e5aee73d3ff5f 100644 (file)
@@ -1501,8 +1501,8 @@ static float check_zone(WipeZone *wipezone, int x, int y, Sequence *seq, float f
                        pointdist = sqrt(temp1 * temp1 + temp1 * temp1);
 
                        temp2 = sqrt((halfx - x) * (halfx - x) + (halfy - y) * (halfy - y));
-                       if (temp2 > pointdist) output = in_band(hwidth, fabs(temp2 - pointdist), 0, 1);
-                       else output = in_band(hwidth, fabs(temp2 - pointdist), 1, 1);
+                       if (temp2 > pointdist) output = in_band(hwidth, fabsf(temp2 - pointdist), 0, 1);
+                       else output = in_band(hwidth, fabsf(temp2 - pointdist), 1, 1);
 
                        if (!wipe->forward) output = 1 - output;
                        
index e7651b70a5bdfb7ecfb6f177f94b887a08dccc66..d4d87dfdbf66b36420e2b769f4276f06e3cfc2c8 100644 (file)
@@ -722,13 +722,13 @@ static void testAxialSymmetry(BGraph *graph, BNode *root_node, BNode *node1, BNo
        
        cross_v3_v3v3(nor, vec, axis);
        
-       if (abs(nor[0]) > abs(nor[1]) && abs(nor[0]) > abs(nor[2]) && nor[0] < 0) {
+       if (fabsf(nor[0]) > fabsf(nor[1]) && fabsf(nor[0]) > fabsf(nor[2]) && nor[0] < 0) {
                negate_v3(nor);
        }
-       else if (abs(nor[1]) > abs(nor[0]) && abs(nor[1]) > abs(nor[2]) && nor[1] < 0) {
+       else if (fabsf(nor[1]) > fabsf(nor[0]) && fabsf(nor[1]) > fabsf(nor[2]) && nor[1] < 0) {
                negate_v3(nor);
        }
-       else if (abs(nor[2]) > abs(nor[1]) && abs(nor[2]) > abs(nor[0]) && nor[2] < 0) {
+       else if (fabsf(nor[2]) > fabsf(nor[1]) && fabsf(nor[2]) > fabsf(nor[0]) && nor[2] < 0) {
                negate_v3(nor);
        }
        
index 765937256c60a65c3c9720d99e9e2cbd5d8bcc44..2bd9bba365b5e6a00893818fa3680b70c7a916f3 100644 (file)
@@ -3864,7 +3864,7 @@ static void switchdirection_knots(float *base, int tot)
        fp1 = base;
        fp2 = tempf = MEM_mallocN(sizeof(float) * a, "switchdirect");
        while (a--) {
-               fp2[0] = fabs(fp1[1] - fp1[0]);
+               fp2[0] = fabsf(fp1[1] - fp1[0]);
                fp1++;
                fp2++;
        }
index 527eb9b966b1b0464024ef6c4e67e3ab0636d898..079b64f852c5a7f4ab3fcff2a3c6834940fdf8f3 100644 (file)
@@ -3364,11 +3364,11 @@ static bool ui_numedit_but_NUM(uiBut *but, uiHandleButtonData *data,
 
                if ((is_float == true) && (softrange > 11)) {
                        /* non linear change in mouse input- good for high precicsion */
-                       data->dragf += (((float)(mx - data->draglastx)) / deler) * (fabsf(mx - data->dragstartx) / 500.0f);
+                       data->dragf += (((float)(mx - data->draglastx)) / deler) * ((float)abs(mx - data->dragstartx) / 500.0f);
                }
                else if ((is_float == false) && (softrange > 129)) { /* only scale large int buttons */
                        /* non linear change in mouse input- good for high precicsionm ints need less fine tuning */
-                       data->dragf += (((float)(mx - data->draglastx)) / deler) * (fabsf(mx - data->dragstartx) / 250.0f);
+                       data->dragf += (((float)(mx - data->draglastx)) / deler) * ((float)abs(mx - data->dragstartx) / 250.0f);
                }
                else {
                        /*no scaling */
@@ -3487,8 +3487,8 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
                        float fac;
 
 #ifdef USE_DRAG_MULTINUM
-                       data->multi_data.drag_dir[0] += fabsf(data->draglastx - mx);
-                       data->multi_data.drag_dir[1] += fabsf(data->draglasty - my);
+                       data->multi_data.drag_dir[0] += abs(data->draglastx - mx);
+                       data->multi_data.drag_dir[1] += abs(data->draglasty - my);
 #endif
 
                        fac = 1.0f;
@@ -3770,8 +3770,8 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
                }
                else if (event->type == MOUSEMOVE) {
 #ifdef USE_DRAG_MULTINUM
-                       data->multi_data.drag_dir[0] += fabsf(data->draglastx - mx);
-                       data->multi_data.drag_dir[1] += fabsf(data->draglasty - my);
+                       data->multi_data.drag_dir[0] += abs(data->draglastx - mx);
+                       data->multi_data.drag_dir[1] += abs(data->draglasty - my);
 #endif
                        if (ui_numedit_but_SLI(but, data, mx, true, event->ctrl != 0, event->shift != 0))
                                ui_numedit_apply(C, block, but, data);
index 127379764368385678666c90ff8349c7393deec7..c762c82442e20dbfca5bd2e657405a7fe21b6e4a 100644 (file)
@@ -1147,7 +1147,7 @@ static void calc_ortho_extent(KnifeTool_OpData *kcd)
 
        BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
                for (i = 0; i < 3; i++)
-                       max_xyz = max_ff(max_xyz, fabs(v->co[i]));
+                       max_xyz = max_ff(max_xyz, fabsf(v->co[i]));
        }
        kcd->ortho_extent = max_xyz;
 }
index 2775d5521d088b17292dfbc97591426f374a7dfb..d0edecb548949093d0e89f74f5b8975d63b03e9c 100644 (file)
@@ -638,9 +638,9 @@ static bool sculpt_brush_test_cube(SculptBrushTest *test, float co[3], float loc
 
        mul_v3_m4v3(local_co, local, co);
 
-       local_co[0] = fabs(local_co[0]);
-       local_co[1] = fabs(local_co[1]);
-       local_co[2] = fabs(local_co[2]);
+       local_co[0] = fabsf(local_co[0]);
+       local_co[1] = fabsf(local_co[1]);
+       local_co[2] = fabsf(local_co[2]);
 
        if (local_co[0] <= side && local_co[1] <= side && local_co[2] <= side) {
                float p = 4.0f;
@@ -719,7 +719,7 @@ static float overlapped_curve(Brush *br, float x)
        for (i = 0; i < n; i++) {
                float xx;
 
-               xx = fabs(x0 + i * h);
+               xx = fabsf(x0 + i * h);
 
                if (xx < 1.0f)
                        sum += BKE_brush_curve_strength(br, xx, 1);
index c7e6c4598fc0cf6712b799ec4f4d2bd4cff6dce9..b0eb8d20554e28c47600fb2d6c33ab35cd7c7d43 100644 (file)
@@ -1036,7 +1036,7 @@ static void spotvolume(float lvec[3], float vvec[3], const float inp)
 
 static void draw_spot_cone(Lamp *la, float x, float z)
 {
-       z = fabs(z);
+       z = fabsf(z);
 
        glBegin(GL_TRIANGLE_FAN);
        glVertex3f(0.0f, 0.0f, -x);
@@ -1251,7 +1251,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
                glTranslatef(0.0, 0.0,  x);
                if (la->mode & LA_SQUARE) {
                        float tvec[3];
-                       float z_abs = fabs(z);
+                       float z_abs = fabsf(z);
 
                        tvec[0] = tvec[1] = z_abs;
                        tvec[2] = 0.0;
index 40d2cc7dcd2285920b3465de1683f75d0cf3cf81..105f3a835f30be7524bb79cda41f05ec004bdd2c 100644 (file)
@@ -2821,9 +2821,9 @@ static void p_chart_pin_positions(PChart *chart, PVert **pin1, PVert **pin2)
                float sub[3];
 
                sub_v3_v3v3(sub, (*pin1)->co, (*pin2)->co);
-               sub[0] = fabs(sub[0]);
-               sub[1] = fabs(sub[1]);
-               sub[2] = fabs(sub[2]);
+               sub[0] = fabsf(sub[0]);
+               sub[1] = fabsf(sub[1]);
+               sub[2] = fabsf(sub[2]);
 
                if ((sub[0] > sub[1]) && (sub[0] > sub[2])) {
                        dirx = 0;
index eef2e14773664d358de67845e7f6fd5761aa8fa0..f4fe1ede088a29292abc257bd412e51fb6fbea7e 100644 (file)
@@ -503,7 +503,7 @@ static int bpy_slot_from_py(BMesh *bm, BMOperator *bmop, BMOpSlot *slot, PyObjec
                                {
                                        /* can't convert from these */
                                        PyErr_Format(PyExc_NotImplementedError,
-                                                    "This arguments mapping subtype %d is not supported", slot->slot_subtype);
+                                                    "This arguments mapping subtype %d is not supported", slot->slot_subtype.map);
                                        return -1;
                                }
                        }
index feaf68a8c4a78aa43146043eba12257c0795697a..661c8dec5efa325b6324995c88b68f4ef082cc4f 100644 (file)
@@ -517,14 +517,14 @@ void shadeSkyView(float col_r[3], const float rco[3], const float view[3], const
                
                if (blend<0.0f) skyflag= 0;
                
-               blend= fabs(blend);
+               blend = fabsf(blend);
        }
        else if (R.wrld.skytype & WO_SKYPAPER) {
                blend= 0.5f + 0.5f * view[1];
        }
        else {
                /* the fraction of how far we are above the bottom of the screen */
-               blend= fabs(0.5f + view[1]);
+               blend = fabsf(0.5f + view[1]);
        }
 
        copy_v3_v3(hor, &R.wrld.horr);