Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-11-03 22:23:30 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-11-03 22:23:30 +0400
commit9b948717b019fbd8e511595bd23ed1970b077085 (patch)
tree52e9203e26a4900b43bb82e699f6ca8a8a5b2cda /source/blender
parenta18ead1521ccd14d45adc335dd1dddd89a71cc96 (diff)
code cleanup: float <> double conversion.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_idprop.h12
-rw-r--r--source/blender/blenkernel/intern/mask.c14
-rw-r--r--source/blender/blenkernel/intern/mask_rasterize.c2
-rw-r--r--source/blender/blenkernel/intern/mball.c2
-rw-r--r--source/blender/blenlib/intern/math_rotation.c6
-rw-r--r--source/blender/blenlib/intern/voronoi.c2
-rw-r--r--source/blender/bmesh/intern/bmesh_polygon.c4
-rw-r--r--source/blender/bmesh/operators/bmo_primitive.c2
-rw-r--r--source/blender/bmesh/operators/bmo_smooth_laplacian.c10
-rw-r--r--source/blender/bmesh/operators/bmo_subdivide.c2
-rw-r--r--source/blender/editors/armature/meshlaplacian.c2
-rw-r--r--source/blender/editors/interface/interface_widgets.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c12
-rw-r--r--source/blender/editors/space_view3d/view3d_project.c8
-rw-r--r--source/blender/gpu/intern/gpu_buffers.c4
-rw-r--r--source/blender/gpu/intern/gpu_material.c4
-rw-r--r--source/blender/modifiers/intern/MOD_laplaciansmooth.c10
-rw-r--r--source/blender/python/generic/idprop_py_api.c24
-rw-r--r--source/blender/windowmanager/intern/wm_playanim.c16
19 files changed, 69 insertions, 69 deletions
diff --git a/source/blender/blenkernel/BKE_idprop.h b/source/blender/blenkernel/BKE_idprop.h
index 2dd1bfc2a51..a9f6a61a655 100644
--- a/source/blender/blenkernel/BKE_idprop.h
+++ b/source/blender/blenkernel/BKE_idprop.h
@@ -318,12 +318,12 @@ void IDP_FreeProperty(struct IDProperty *prop);
/** Unlinks any struct IDProperty<->ID linkage that might be going on.*/
void IDP_UnlinkProperty(struct IDProperty *prop);
-#define IDP_Int(prop) ((prop)->data.val)
-#define IDP_Float(prop) (*(float *)&(prop)->data.val)
-#define IDP_String(prop) ((char *)(prop)->data.pointer)
-#define IDP_Array(prop) ((prop)->data.pointer)
-#define IDP_IDPArray(prop) ((IDProperty *)(prop)->data.pointer)
-#define IDP_Double(prop) (*(double *)&(prop)->data.val)
+#define IDP_Int(prop) ((prop)->data.val)
+#define IDP_Float(prop) (*(float *)&(prop)->data.val)
+#define IDP_Double(prop) (*(double *)&(prop)->data.val)
+#define IDP_String(prop) ((char *) (prop)->data.pointer)
+#define IDP_Array(prop) ((prop)->data.pointer)
+#define IDP_IDPArray(prop) ((IDProperty *) (prop)->data.pointer)
#ifdef DEBUG
/* for printout only */
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c
index da0fb895ec2..b7f4c4bd61e 100644
--- a/source/blender/blenkernel/intern/mask.c
+++ b/source/blender/blenkernel/intern/mask.c
@@ -378,8 +378,8 @@ float BKE_mask_spline_project_co(MaskSpline *spline, MaskSplinePoint *point,
if (len_squared_v2(v1) > proj_eps_squared) {
ang1 = angle_v2v2(v1, n1);
- if (ang1 > M_PI / 2.0f)
- ang1 = M_PI - ang1;
+ if (ang1 > (float)M_PI / 2.0f)
+ ang1 = (float)M_PI - ang1;
if (ang < 0.0f || ang1 < ang) {
ang = ang1;
@@ -405,8 +405,8 @@ float BKE_mask_spline_project_co(MaskSpline *spline, MaskSplinePoint *point,
if (len_squared_v2(v2) > proj_eps_squared) {
ang2 = angle_v2v2(v2, n2);
- if (ang2 > M_PI / 2.0f)
- ang2 = M_PI - ang2;
+ if (ang2 > (float)M_PI / 2.0f)
+ ang2 = (float)M_PI - ang2;
if (ang2 < ang) {
ang = ang2;
@@ -555,7 +555,7 @@ float BKE_mask_point_weight_scalar(MaskSpline *spline, MaskSplinePoint *point, c
if (!bezt_next) {
return bezt->weight;
}
- else if (u <= 0.0) {
+ else if (u <= 0.0f) {
return bezt->weight;
}
else if (u >= 1.0f) {
@@ -576,7 +576,7 @@ float BKE_mask_point_weight(MaskSpline *spline, MaskSplinePoint *point, const fl
if (!bezt_next) {
return bezt->weight;
}
- else if (u <= 0.0) {
+ else if (u <= 0.0f) {
return bezt->weight;
}
else if (u >= 1.0f) {
@@ -1805,7 +1805,7 @@ static void interp_weights_uv_v2_calc(float r_uv[2], const float pt[2], const fl
float pt_on_line[2];
r_uv[0] = closest_to_line_v2(pt_on_line, pt, pt_a, pt_b);
r_uv[1] = (len_v2v2(pt_on_line, pt) / len_v2v2(pt_a, pt_b)) *
- ((line_point_side_v2(pt_a, pt_b, pt) < 0.0f) ? -1.0 : 1.0); /* this line only sets the sign */
+ ((line_point_side_v2(pt_a, pt_b, pt) < 0.0f) ? -1.0f : 1.0f); /* this line only sets the sign */
}
diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c
index 086ecadc8de..88393fab79c 100644
--- a/source/blender/blenkernel/intern/mask_rasterize.c
+++ b/source/blender/blenkernel/intern/mask_rasterize.c
@@ -428,7 +428,7 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size)
/* width and height of each bucket */
const float bucket_size_x = (bucket_dim_x + FLT_EPSILON) / layer->buckets_x;
const float bucket_size_y = (bucket_dim_y + FLT_EPSILON) / layer->buckets_y;
- const float bucket_max_rad = (max_ff(bucket_size_x, bucket_size_y) * M_SQRT2) + FLT_EPSILON;
+ const float bucket_max_rad = (max_ff(bucket_size_x, bucket_size_y) * (float)M_SQRT2) + FLT_EPSILON;
const float bucket_max_rad_squared = bucket_max_rad * bucket_max_rad;
unsigned int *face = &layer->face_array[0][0];
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index 5da7ff86e61..805e77cf84f 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -1505,7 +1505,7 @@ static void find_first_points(PROCESS *mbproc, MetaBall *mb, int a)
float f = 0.0f;
ml = G_mb.mainb[a];
- f = 1.0 - (mb->thresh / ml->s);
+ f = 1.0f - (mb->thresh / ml->s);
/* Skip, when Stiffness of MetaElement is too small ... MetaElement can't be
* visible alone ... but still can influence others MetaElements :-) */
diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c
index 70d9ef27734..589e6462f62 100644
--- a/source/blender/blenlib/intern/math_rotation.c
+++ b/source/blender/blenlib/intern/math_rotation.c
@@ -234,7 +234,7 @@ void quat_to_mat4(float m[][4], const float q[4])
double q0, q1, q2, q3, qda, qdb, qdc, qaa, qab, qac, qbb, qbc, qcc;
#ifdef DEBUG
- if (!((q0 = dot_qtqt(q, q)) == 0.0f || (fabsf(q0 - 1.0) < QUAT_EPSILON))) {
+ if (!((q0 = dot_qtqt(q, q)) == 0.0f || (fabsf(q0 - 1.0) < (float)QUAT_EPSILON))) {
fprintf(stderr, "Warning! quat_to_mat4() called with non-normalized: size %.8f *** report a bug ***\n", (float)q0);
}
#endif
@@ -1077,11 +1077,11 @@ void compatible_eul(float eul[3], const float oldrot[3])
for (i = 0; i < 3; i++) {
deul[i] = eul[i] - oldrot[i];
if (deul[i] > pi_thresh) {
- eul[i] -= floorf(( deul[i] / pi_x2) + 0.5) * pi_x2;
+ eul[i] -= floorf(( deul[i] / pi_x2) + 0.5f) * pi_x2;
deul[i] = eul[i] - oldrot[i];
}
else if (deul[i] < -pi_thresh) {
- eul[i] += floorf((-deul[i] / pi_x2) + 0.5) * pi_x2;
+ eul[i] += floorf((-deul[i] / pi_x2) + 0.5f) * pi_x2;
deul[i] = eul[i] - oldrot[i];
}
}
diff --git a/source/blender/blenlib/intern/voronoi.c b/source/blender/blenlib/intern/voronoi.c
index 9674012a73d..0d411038b3e 100644
--- a/source/blender/blenlib/intern/voronoi.c
+++ b/source/blender/blenlib/intern/voronoi.c
@@ -39,7 +39,7 @@
#include "BLI_voronoi.h"
#include "BLI_utildefines.h"
-#define VORONOI_EPS 1e-2
+#define VORONOI_EPS 1e-2f
enum {
voronoiEventType_Site = 0,
diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c
index bd0f93ee7aa..98edceb30a2 100644
--- a/source/blender/bmesh/intern/bmesh_polygon.c
+++ b/source/blender/bmesh/intern/bmesh_polygon.c
@@ -313,7 +313,7 @@ void poly_rotate_plane(const float normal[3], float (*verts)[3], const int nvert
float up[3] = {0.0f, 0.0f, 1.0f}, axis[3], q[4];
float mat[3][3];
- double angle;
+ float angle;
int i;
cross_v3_v3v3(axis, normal, up);
@@ -329,7 +329,7 @@ void poly_rotate_plane(const float normal[3], float (*verts)[3], const int nvert
axis[2] = 0.0f;
}
- axis_angle_to_quat(q, axis, (float)angle);
+ axis_angle_to_quat(q, axis, angle);
quat_to_mat3(mat, q);
for (i = 0; i < nverts; i++)
diff --git a/source/blender/bmesh/operators/bmo_primitive.c b/source/blender/bmesh/operators/bmo_primitive.c
index 30561e47d20..d7b163cb760 100644
--- a/source/blender/bmesh/operators/bmo_primitive.c
+++ b/source/blender/bmesh/operators/bmo_primitive.c
@@ -365,7 +365,7 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op)
len2 = len_v3v3(vec, vec2);
/* use shortest segment length divided by 3 as merge threshold */
- BMO_op_callf(bm, op->flag, "remove_doubles verts=%fv dist=%f", VERT_MARK, MIN2(len, len2) / 3.0f);
+ BMO_op_callf(bm, op->flag, "remove_doubles verts=%fv dist=%f", VERT_MARK, min_ff(len, len2) / 3.0f);
}
/* and now do imat */
diff --git a/source/blender/bmesh/operators/bmo_smooth_laplacian.c b/source/blender/bmesh/operators/bmo_smooth_laplacian.c
index 9ab1589b5bc..51b9adb5de3 100644
--- a/source/blender/bmesh/operators/bmo_smooth_laplacian.c
+++ b/source/blender/bmesh/operators/bmo_smooth_laplacian.c
@@ -45,8 +45,8 @@
#define SMOOTH_LAPLACIAN_AREA_FACTOR 4.0f
#define SMOOTH_LAPLACIAN_EDGE_FACTOR 2.0f
-#define SMOOTH_LAPLACIAN_MAX_EDGE_PERCENTAGE 1.8
-#define SMOOTH_LAPLACIAN_MIN_EDGE_PERCENTAGE 0.15
+#define SMOOTH_LAPLACIAN_MAX_EDGE_PERCENTAGE 1.8f
+#define SMOOTH_LAPLACIAN_MIN_EDGE_PERCENTAGE 0.15f
struct BLaplacianSystem {
float *eweights; /* Length weights per Edge */
@@ -236,7 +236,7 @@ static void init_laplacian_matrix(LaplacianSystem *sys)
areaf = area_tri_v3(v1, v2, v3);
}
- if (fabs(areaf) < sys->min_area) {
+ if (fabsf(areaf) < sys->min_area) {
sys->zerola[idv1] = 1;
sys->zerola[idv2] = 1;
sys->zerola[idv3] = 1;
@@ -443,13 +443,13 @@ static float compute_volume(BMesh *bm)
y3 = vf[2]->co[1];
z3 = vf[2]->co[2];
- vol += (1.0 / 6.0) * (0.0 - x3 * y2 * z1 + x2 * y3 * z1 + x3 * y1 * z2 - x1 * y3 * z2 - x2 * y1 * z3 + x1 * y2 * z3);
+ vol += (1.0f / 6.0f) * (0.0f - x3 * y2 * z1 + x2 * y3 * z1 + x3 * y1 * z2 - x1 * y3 * z2 - x2 * y1 * z3 + x1 * y2 * z3);
if (i == 4) {
x4 = vf[3]->co[0];
y4 = vf[3]->co[1];
z4 = vf[3]->co[2];
- vol += (1.0 / 6.0) * (x1 * y3 * z4 - x1 * y4 * z3 - x3 * y1 * z4 + x3 * z1 * y4 + y1 * x4 * z3 - x4 * y3 * z1);
+ vol += (1.0f / 6.0f) * (x1 * y3 * z4 - x1 * y4 * z3 - x3 * y1 * z4 + x3 * z1 * y4 + y1 * x4 * z3 - x4 * y3 * z1);
}
}
return fabs(vol);
diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c
index c6726ec6f3e..346daf830d0 100644
--- a/source/blender/bmesh/operators/bmo_subdivide.c
+++ b/source/blender/bmesh/operators/bmo_subdivide.c
@@ -54,7 +54,7 @@
#define ELE_SPLIT 16
/* see bug [#32665], 0.00005 means a we get face splits at a little under 1.0 degrees */
-#define FLT_FACE_SPLIT_EPSILON 0.00005
+#define FLT_FACE_SPLIT_EPSILON 0.00005f
/*
* NOTE: beauty has been renamed to flag!
diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c
index e7586311312..9152ea8e198 100644
--- a/source/blender/editors/armature/meshlaplacian.c
+++ b/source/blender/editors/armature/meshlaplacian.c
@@ -1226,7 +1226,7 @@ static void harmonic_ray_callback(void *userdata, int index, const BVHTreeRay *r
hit->dist = dist;
copy_v3_v3(hit->co, co);
- isec->isect = dot_v3v3(no, ray->direction) <= 0.0;
+ isec->isect = (dot_v3v3(no, ray->direction) <= 0.0f);
isec->labda = dist;
isec->face = mf;
}
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 7d0adce5007..f41abce947e 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -2000,7 +2000,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti *
/* draws in resolution of 20x4 colors */
void ui_draw_gradient(rcti *rect, const float hsv[3], const int type, const float alpha)
{
- const float color_step = (type == UI_GRAD_H) ? 0.02 : 0.05f;
+ const float color_step = (type == UI_GRAD_H) ? 0.02f : 0.05f;
int a;
float h = hsv[0], s = hsv[1], v = hsv[2];
float dx, dy, sx1, sx2, sy;
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 0e647105dd2..0a282a17f74 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -1216,13 +1216,13 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
if (ca->flag & CAM_SHOWTITLESAFE) {
UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0);
- hmargin = 0.1 * (x2 - x1);
- vmargin = 0.05 * (y2 - y1);
- uiDrawBox(GL_LINE_LOOP, x1 + hmargin, y1+vmargin, x2 - hmargin, y2 - vmargin, 2.0);
+ hmargin = 0.1f * (x2 - x1);
+ vmargin = 0.05f * (y2 - y1);
+ uiDrawBox(GL_LINE_LOOP, x1 + hmargin, y1+vmargin, x2 - hmargin, y2 - vmargin, 2.0f);
- hmargin = 0.035 * (x2 - x1);
- vmargin = 0.035 * (y2 - y1);
- uiDrawBox(GL_LINE_LOOP, x1 + hmargin, y1+vmargin, x2 - hmargin, y2 - vmargin, 2.0);
+ hmargin = 0.035f * (x2 - x1);
+ vmargin = 0.035f * (y2 - y1);
+ uiDrawBox(GL_LINE_LOOP, x1 + hmargin, y1+vmargin, x2 - hmargin, y2 - vmargin, 2.0f);
}
if (ca && (ca->flag & CAM_SHOWSENSOR)) {
/* determine sensor fit, and get sensor x/y, for auto fit we
diff --git a/source/blender/editors/space_view3d/view3d_project.c b/source/blender/editors/space_view3d/view3d_project.c
index 5362f0377c3..6ba05abae9a 100644
--- a/source/blender/editors/space_view3d/view3d_project.c
+++ b/source/blender/editors/space_view3d/view3d_project.c
@@ -163,8 +163,8 @@ eV3DProjStatus ED_view3d_project_short_ex(ARegion *ar, float perspmat[4][4], con
float tvec[2];
eV3DProjStatus ret = ed_view3d_project__internal(ar, perspmat, is_local, co, tvec, flag);
if (ret == V3D_PROJ_RET_OK) {
- if ((tvec[0] > -32700.0 && tvec[0] < 32700.0f) &&
- (tvec[1] > -32700.0 && tvec[1] < 32700.0f))
+ if ((tvec[0] > -32700.0f && tvec[0] < 32700.0f) &&
+ (tvec[1] > -32700.0f && tvec[1] < 32700.0f))
{
r_co[0] = (short)floor(tvec[0]);
r_co[1] = (short)floor(tvec[1]);
@@ -182,8 +182,8 @@ eV3DProjStatus ED_view3d_project_int_ex(ARegion *ar, float perspmat[4][4], const
float tvec[2];
eV3DProjStatus ret = ed_view3d_project__internal(ar, perspmat, is_local, co, tvec, flag);
if (ret == V3D_PROJ_RET_OK) {
- if ((tvec[0] > -2140000000.0 && tvec[0] < 2140000000.0f) &&
- (tvec[1] > -2140000000.0 && tvec[1] < 2140000000.0f))
+ if ((tvec[0] > -2140000000.0f && tvec[0] < 2140000000.0f) &&
+ (tvec[1] > -2140000000.0f && tvec[1] < 2140000000.0f))
{
r_co[0] = (int)floor(tvec[0]);
r_co[1] = (int)floor(tvec[1]);
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index 3aa8f84c3de..6e475ace09d 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -1442,7 +1442,7 @@ void GPU_update_mesh_buffers(GPU_Buffers *buffers, MVert *mvert,
fmask = (vmask[fv[0]] +
vmask[fv[1]] +
vmask[fv[2]] +
- vmask[fv[3]]) * 0.25;
+ vmask[fv[3]]) * 0.25f;
}
}
else {
@@ -1915,7 +1915,7 @@ static void gpu_draw_buffers_legacy_mesh(GPU_Buffers *buffers)
buffers->vmask[fv[1]] +
buffers->vmask[fv[2]]);
if (f->v4)
- fmask = (fmask + buffers->vmask[fv[3]]) * 0.25;
+ fmask = (fmask + buffers->vmask[fv[3]]) * 0.25f;
else
fmask /= 3.0f;
gpu_color_from_mask_set(fmask, diffuse_color);
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index 1fd215b1ec2..ef73764753c 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -1589,8 +1589,8 @@ void GPU_lamp_update_distance(GPULamp *lamp, float distance, float att1, float a
void GPU_lamp_update_spot(GPULamp *lamp, float spotsize, float spotblend)
{
- lamp->spotsi= cos(M_PI*spotsize/360.0);
- lamp->spotbl= (1.0f - lamp->spotsi)*spotblend;
+ lamp->spotsi= cosf((float)M_PI * spotsize / 360.0f);
+ lamp->spotbl= (1.0f - lamp->spotsi) * spotblend;
}
static void gpu_lamp_from_blender(Scene *scene, Object *ob, Object *par, Lamp *la, GPULamp *lamp)
diff --git a/source/blender/modifiers/intern/MOD_laplaciansmooth.c b/source/blender/modifiers/intern/MOD_laplaciansmooth.c
index 566c6bdd089..6f6589d4d14 100644
--- a/source/blender/modifiers/intern/MOD_laplaciansmooth.c
+++ b/source/blender/modifiers/intern/MOD_laplaciansmooth.c
@@ -52,8 +52,8 @@
#include "ONL_opennl.h"
-#define MOD_LAPLACIANSMOOTH_MAX_EDGE_PERCENTAGE 1.8
-#define MOD_LAPLACIANSMOOTH_MIN_EDGE_PERCENTAGE 0.02
+#define MOD_LAPLACIANSMOOTH_MAX_EDGE_PERCENTAGE 1.8f
+#define MOD_LAPLACIANSMOOTH_MIN_EDGE_PERCENTAGE 0.02f
struct BLaplacianSystem {
float *eweights; /* Length weights per Edge */
@@ -279,13 +279,13 @@ static float compute_volume(float (*vertexCos)[3], MFace *mfaces, int numFaces)
z3 = vf[2][2];
- vol += (1.0 / 6.0) * (x2 * y3 * z1 + x3 * y1 * z2 - x1 * y3 * z2 - x2 * y1 * z3 + x1 * y2 * z3 - x3 * y2 * z1);
+ vol += (1.0f / 6.0f) * (x2 * y3 * z1 + x3 * y1 * z2 - x1 * y3 * z2 - x2 * y1 * z3 + x1 * y2 * z3 - x3 * y2 * z1);
if ((&mfaces[i])->v4) {
vf[3] = vertexCos[mfaces[i].v4];
x4 = vf[3][0];
y4 = vf[3][1];
z4 = vf[3][2];
- vol += (1.0 / 6.0) * (x1 * y3 * z4 - x1 * y4 * z3 - x3 * y1 * z4 + x3 * z1 * y4 + y1 * x4 * z3 - x4 * y3 * z1);
+ vol += (1.0f / 6.0f) * (x1 * y3 * z4 - x1 * y4 * z3 - x3 * y1 * z4 + x3 * z1 * y4 + y1 * x4 * z3 - x4 * y3 * z1);
}
}
return fabsf(vol);
@@ -365,7 +365,7 @@ static void init_laplacian_matrix(LaplacianSystem *sys)
else {
areaf = area_tri_v3(v1, v2, v3);
}
- if (fabs(areaf) < sys->min_area) {
+ if (fabsf(areaf) < sys->min_area) {
sys->zerola[idv1] = 1;
sys->zerola[idv2] = 1;
sys->zerola[idv3] = 1;
diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c
index 12c2909523d..d2890bc046e 100644
--- a/source/blender/python/generic/idprop_py_api.c
+++ b/source/blender/python/generic/idprop_py_api.c
@@ -49,33 +49,33 @@
* static conversion functions to avoid duplicate code, no type checking.
*/
-static PyObject *idprop_py_from_idp_string(IDProperty *prop)
+static PyObject *idprop_py_from_idp_string(const IDProperty *prop)
{
if (prop->subtype == IDP_STRING_SUB_BYTE) {
- return PyBytes_FromStringAndSize(IDP_Array(prop), prop->len);
+ return PyBytes_FromStringAndSize(IDP_String(prop), prop->len);
}
else {
#ifdef USE_STRING_COERCE
return PyC_UnicodeFromByteAndSize(IDP_Array(prop), prop->len - 1);
#else
- return PyUnicode_FromStringAndSize(IDP_Array(prop), prop->len - 1);
+ return PyUnicode_FromStringAndSize(IDP_String(prop), prop->len - 1);
#endif
}
}
-static PyObject *idprop_py_from_idp_int(IDProperty *prop)
+static PyObject *idprop_py_from_idp_int(const IDProperty *prop)
{
- return PyLong_FromLong((long)prop->data.val);
+ return PyLong_FromLong((long)IDP_Int(prop));
}
-static PyObject *idprop_py_from_idp_float(IDProperty *prop)
+static PyObject *idprop_py_from_idp_float(const IDProperty *prop)
{
- return PyFloat_FromDouble((double)(*(float *)(&prop->data.val)));
+ return PyFloat_FromDouble((double)IDP_Float(prop));
}
-static PyObject *idprop_py_from_idp_double(IDProperty *prop)
+static PyObject *idprop_py_from_idp_double(const IDProperty *prop)
{
- return PyFloat_FromDouble((*(double *)(&prop->data.val)));
+ return PyFloat_FromDouble(IDP_Double(prop));
}
static PyObject *idprop_py_from_idp_group(ID *id, IDProperty *prop, IDProperty *parent)
@@ -189,7 +189,7 @@ static int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject
PyErr_SetString(PyExc_TypeError, "expected an int type");
return -1;
}
- prop->data.val = ivalue;
+ IDP_Int(prop) = ivalue;
break;
}
case IDP_FLOAT:
@@ -199,7 +199,7 @@ static int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject
PyErr_SetString(PyExc_TypeError, "expected a float");
return -1;
}
- *(float *)&self->prop->data.val = fvalue;
+ IDP_Float(self->prop) = fvalue;
break;
}
case IDP_DOUBLE:
@@ -209,7 +209,7 @@ static int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject
PyErr_SetString(PyExc_TypeError, "expected a float");
return -1;
}
- *(double *)&self->prop->data.val = dvalue;
+ IDP_Double(self->prop) = dvalue;
break;
}
default:
diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c
index cf5bce568d5..96bbedfee1b 100644
--- a/source/blender/windowmanager/intern/wm_playanim.c
+++ b/source/blender/windowmanager/intern/wm_playanim.c
@@ -590,8 +590,8 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
break;
case GHOST_kKeyNumpadPlus:
if (val == 0) break;
- zoomx += 2.0;
- zoomy += 2.0;
+ zoomx += 2.0f;
+ zoomy += 2.0f;
/* no break??? - is this intentional? - campbell XXX25 */
case GHOST_kKeyNumpadMinus:
{
@@ -599,8 +599,8 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
/* int ofsx, ofsy; */ /* UNUSED */
if (val == 0) break;
- if (zoomx > 1.0) zoomx -= 1.0;
- if (zoomy > 1.0) zoomy -= 1.0;
+ if (zoomx > 1.0f) zoomx -= 1.0f;
+ if (zoomy > 1.0f) zoomy -= 1.0f;
// playanim_window_get_position(&ofsx, &ofsy);
playanim_window_get_size(&sizex, &sizey);
/* ofsx += sizex / 2; */ /* UNUSED */
@@ -665,10 +665,10 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
zoomx = (float) sizex / ps->ibufx;
zoomy = (float) sizey / ps->ibufy;
- zoomx = floor(zoomx + 0.5);
- zoomy = floor(zoomy + 0.5);
- if (zoomx < 1.0) zoomx = 1.0;
- if (zoomy < 1.0) zoomy = 1.0;
+ zoomx = floor(zoomx + 0.5f);
+ zoomy = floor(zoomy + 0.5f);
+ if (zoomx < 1.0f) zoomx = 1.0f;
+ if (zoomy < 1.0f) zoomy = 1.0f;
sizex = zoomx * ps->ibufx;
sizey = zoomy * ps->ibufy;