Commit: 13ea967cce4032564cfbbfe3010b538486f36524
Author: Campbell Barton
Date:   Sat Mar 1 14:20:54 2014 +1100
https://developer.blender.org/rB13ea967cce4032564cfbbfe3010b538486f36524

Code cleanup: correct abs use and quiet warnings

===================================================================

M       source/blender/blenkernel/intern/curve.c
M       source/blender/blenkernel/intern/dynamicpaint.c
M       source/blender/blenkernel/intern/seqeffects.c
M       source/blender/blenlib/intern/graph.c
M       source/blender/editors/curve/editcurve.c
M       source/blender/editors/interface/interface_handlers.c
M       source/blender/editors/mesh/editmesh_knife.c
M       source/blender/editors/sculpt_paint/sculpt.c
M       source/blender/editors/space_view3d/drawobject.c
M       source/blender/editors/uvedit/uvedit_parametrizer.c
M       source/blender/python/bmesh/bmesh_py_ops_call.c
M       source/blender/render/intern/source/pixelshading.c

===================================================================

diff --git a/source/blender/blenkernel/intern/curve.c 
b/source/blender/blenkernel/intern/curve.c
index 6c04100..2a4882f 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -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++;
                                }
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c 
b/source/blender/blenkernel/intern/dynamicpaint.c
index 997876d..b565220 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -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);
        }
diff --git a/source/blender/blenkernel/intern/seqeffects.c 
b/source/blender/blenkernel/intern/seqeffects.c
index 0d05966..145b695 100644
--- a/source/blender/blenkernel/intern/seqeffects.c
+++ b/source/blender/blenkernel/intern/seqeffects.c
@@ -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;
                        
diff --git a/source/blender/blenlib/intern/graph.c 
b/source/blender/blenlib/intern/graph.c
index e7651b7..d4d87df 100644
--- a/source/blender/blenlib/intern/graph.c
+++ b/source/blender/blenlib/intern/graph.c
@@ -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);
        }
        
diff --git a/source/blender/editors/curve/editcurve.c 
b/source/blender/editors/curve/editcurve.c
index 7659372..2bd9bba 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -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++;
        }
diff --git a/source/blender/editors/interface/interface_handlers.c 
b/source/blender/editors/interface/interface_handlers.c
index 527eb9b..079b64f 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -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);
diff --git a/source/blender/editors/mesh/editmesh_knife.c 
b/source/blender/editors/mesh/editmesh_knife.c
index 1273797..c762c82 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -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;
 }
diff --git a/source/blender/editors/sculpt_paint/sculpt.c 
b/source/blender/editors/sculpt_paint/sculpt.c
index 2775d55..d0edecb 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -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);
diff --git a/source/blender/editors/space_view3d/drawobject.c 
b/source/blender/editors/space_view3d/drawobject.c
index c7e6c45..b0eb8d2 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -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;
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c 
b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 40d2cc7..105f3a8 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -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;
diff --git a/source/blender/python/bmesh/bmesh_py_ops_call.c 
b/source/blender/python/bmesh/bmesh_py_ops_call.c
index eef2e14..f4fe1ed 100644
--- a/source/blender/python/bmesh/bmesh_py_ops_call.c
+++ b/source/blender/python/bmesh/bmesh_py_ops_call.c
@@ -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;
                                }
                        }
diff --git a/source/blender/render/intern/source/pixelshading.c 
b/source/blender/render/intern/source/pixelshading.c
index feaf68a..661c8de 100644
--- a/source/blender/render/intern/source/pixelshading.c
+++ b/source/blender/render/intern/source/pixelshading.c
@@ -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);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to