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 <campbell@blender.org>2022-09-25 11:33:28 +0300
committerCampbell Barton <campbell@blender.org>2022-09-25 13:17:08 +0300
commitf68cfd6bb078482c4a779a6e26a56e2734edb5b8 (patch)
tree2878e5b80dba5bdeba186d99661d604eb38879cd /source/blender/blenkernel/intern/mesh_legacy_convert.cc
parentc7b247a118e302a3afc6473797e53b6af28b69e2 (diff)
Cleanup: replace C-style casts with functional casts for numeric types
Diffstat (limited to 'source/blender/blenkernel/intern/mesh_legacy_convert.cc')
-rw-r--r--source/blender/blenkernel/intern/mesh_legacy_convert.cc30
1 files changed, 15 insertions, 15 deletions
diff --git a/source/blender/blenkernel/intern/mesh_legacy_convert.cc b/source/blender/blenkernel/intern/mesh_legacy_convert.cc
index 2c75c477b9a..b68117b7eb2 100644
--- a/source/blender/blenkernel/intern/mesh_legacy_convert.cc
+++ b/source/blender/blenkernel/intern/mesh_legacy_convert.cc
@@ -110,24 +110,24 @@ static void bm_corners_to_loops_ex(ID *id,
BLI_assert(fd->totdisp == 0);
}
else {
- const int side = (int)sqrtf((float)(fd->totdisp / corners));
+ const int side = int(sqrtf(float(fd->totdisp / corners)));
const int side_sq = side * side;
for (int i = 0; i < tot; i++, disps += side_sq, ld++) {
ld->totdisp = side_sq;
- ld->level = (int)(logf((float)side - 1.0f) / (float)M_LN2) + 1;
+ ld->level = int(logf(float(side) - 1.0f) / float(M_LN2)) + 1;
if (ld->disps) {
MEM_freeN(ld->disps);
}
ld->disps = (float(*)[3])MEM_malloc_arrayN(
- (size_t)side_sq, sizeof(float[3]), "converted loop mdisps");
+ size_t(side_sq), sizeof(float[3]), "converted loop mdisps");
if (fd->disps) {
- memcpy(ld->disps, disps, (size_t)side_sq * sizeof(float[3]));
+ memcpy(ld->disps, disps, size_t(side_sq) * sizeof(float[3]));
}
else {
- memset(ld->disps, 0, (size_t)side_sq * sizeof(float[3]));
+ memset(ld->disps, 0, size_t(side_sq) * sizeof(float[3]));
}
}
}
@@ -212,7 +212,7 @@ static void convert_mfaces_to_mpolys(ID *id,
CustomData_external_read(fdata, id, CD_MASK_MDISPS, totface_i);
}
- eh = BLI_edgehash_new_ex(__func__, (uint)totedge_i);
+ eh = BLI_edgehash_new_ex(__func__, uint(totedge_i));
/* build edge hash */
me = medge;
@@ -609,15 +609,15 @@ static int mesh_tessface_calc(CustomData *fdata,
* if all faces are triangles it will be correct, `quads == 2x` allocations. */
/* Take care since memory is _not_ zeroed so be sure to initialize each field. */
mface_to_poly_map = (int *)MEM_malloc_arrayN(
- (size_t)looptri_num, sizeof(*mface_to_poly_map), __func__);
- mface = (MFace *)MEM_malloc_arrayN((size_t)looptri_num, sizeof(*mface), __func__);
- lindices = (uint(*)[4])MEM_malloc_arrayN((size_t)looptri_num, sizeof(*lindices), __func__);
+ size_t(looptri_num), sizeof(*mface_to_poly_map), __func__);
+ mface = (MFace *)MEM_malloc_arrayN(size_t(looptri_num), sizeof(*mface), __func__);
+ lindices = (uint(*)[4])MEM_malloc_arrayN(size_t(looptri_num), sizeof(*lindices), __func__);
mface_index = 0;
mp = mpoly;
for (poly_index = 0; poly_index < totpoly; poly_index++, mp++) {
- const uint mp_loopstart = (uint)mp->loopstart;
- const uint mp_totloop = (uint)mp->totloop;
+ const uint mp_loopstart = uint(mp->loopstart);
+ const uint mp_totloop = uint(mp->totloop);
uint l1, l2, l3, l4;
uint *lidx;
if (mp_totloop < 3) {
@@ -701,8 +701,8 @@ static int mesh_tessface_calc(CustomData *fdata,
arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__);
}
- tris = (uint(*)[3])BLI_memarena_alloc(arena, sizeof(*tris) * (size_t)totfilltri);
- projverts = (float(*)[2])BLI_memarena_alloc(arena, sizeof(*projverts) * (size_t)mp_totloop);
+ tris = (uint(*)[3])BLI_memarena_alloc(arena, sizeof(*tris) * size_t(totfilltri));
+ projverts = (float(*)[2])BLI_memarena_alloc(arena, sizeof(*projverts) * size_t(mp_totloop));
zero_v3(normal);
@@ -774,9 +774,9 @@ static int mesh_tessface_calc(CustomData *fdata,
/* Not essential but without this we store over-allocated memory in the #CustomData layers. */
if (LIKELY(looptri_num != totface)) {
- mface = (MFace *)MEM_reallocN(mface, sizeof(*mface) * (size_t)totface);
+ mface = (MFace *)MEM_reallocN(mface, sizeof(*mface) * size_t(totface));
mface_to_poly_map = (int *)MEM_reallocN(mface_to_poly_map,
- sizeof(*mface_to_poly_map) * (size_t)totface);
+ sizeof(*mface_to_poly_map) * size_t(totface));
}
CustomData_add_layer(fdata, CD_MFACE, CD_ASSIGN, mface, totface);