diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-03-01 07:20:54 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-03-01 07:26:18 +0400 |
commit | 13ea967cce4032564cfbbfe3010b538486f36524 (patch) | |
tree | fff7d2eaddd8bc1b6034f76729bb34c12c555607 /source/blender | |
parent | 315d85faa1b4f58a91041030dcac70085808c038 (diff) |
Code cleanup: correct abs use and quiet warnings
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/curve.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/dynamicpaint.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/seqeffects.c | 4 | ||||
-rw-r--r-- | source/blender/blenlib/intern/graph.c | 6 | ||||
-rw-r--r-- | source/blender/editors/curve/editcurve.c | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 12 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_knife.c | 2 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 8 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 4 | ||||
-rw-r--r-- | source/blender/editors/uvedit/uvedit_parametrizer.c | 6 | ||||
-rw-r--r-- | source/blender/python/bmesh/bmesh_py_ops_call.c | 2 | ||||
-rw-r--r-- | source/blender/render/intern/source/pixelshading.c | 4 |
12 files changed, 27 insertions, 27 deletions
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 6c04100feff..2a4882f7d4b 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 997876dcd58..b56522034c5 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 0d05966dfa5..145b6954eb0 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 e7651b70a5b..d4d87dfdbf6 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 765937256c6..2bd9bba365b 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 527eb9b966b..079b64f852c 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 12737976436..c762c82442e 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 2775d5521d0..d0edecb5489 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 c7e6c4598fc..b0eb8d20554 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 40d2cc7dcd2..105f3a835f3 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 eef2e147736..f4fe1ede088 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 feaf68a8c4a..661c8dec5ef 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); |