Code cleanup: correct abs use and quiet warnings
This commit is contained in:
@@ -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++;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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++;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user