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>2020-08-08 06:29:21 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-08-08 06:38:00 +0300
commit171e77c3c25a1224fc5f7db40ec6f8879f8dbbb0 (patch)
treeea51f4fa508a39807e6f6d333b2d53af8a2b9fc1 /source/blender/blenkernel
parent4bf3ca20165959f98c7c830a138ba2901d3dd851 (diff)
Cleanup: use array syntax for sizeof with fixed values
Also order sizeof(..) first to promote other values to size_t.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf.c2
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c6
-rw-r--r--source/blender/blenkernel/intern/colortools.c4
-rw-r--r--source/blender/blenkernel/intern/constraint.c2
-rw-r--r--source/blender/blenkernel/intern/curve.c2
-rw-r--r--source/blender/blenkernel/intern/curve_bevel.c4
-rw-r--r--source/blender/blenkernel/intern/customdata.c34
-rw-r--r--source/blender/blenkernel/intern/displist.c24
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c4
-rw-r--r--source/blender/blenkernel/intern/fluid.c16
-rw-r--r--source/blender/blenkernel/intern/gpencil_curve.c2
-rw-r--r--source/blender/blenkernel/intern/gpencil_geom.c6
-rw-r--r--source/blender/blenkernel/intern/idprop.c8
-rw-r--r--source/blender/blenkernel/intern/image_gpu.c4
-rw-r--r--source/blender/blenkernel/intern/key.c2
-rw-r--r--source/blender/blenkernel/intern/lattice_deform.c2
-rw-r--r--source/blender/blenkernel/intern/mask_evaluate.c8
-rw-r--r--source/blender/blenkernel/intern/mask_rasterize.c4
-rw-r--r--source/blender/blenkernel/intern/mball.c2
-rw-r--r--source/blender/blenkernel/intern/mball_tessellate.c4
-rw-r--r--source/blender/blenkernel/intern/mesh_convert.c14
-rw-r--r--source/blender/blenkernel/intern/mesh_mirror.c2
-rw-r--r--source/blender/blenkernel/intern/multires.c14
-rw-r--r--source/blender/blenkernel/intern/multires_reshape_apply_base.c4
-rw-r--r--source/blender/blenkernel/intern/multires_reshape_ccg.c2
-rw-r--r--source/blender/blenkernel/intern/multires_reshape_util.c2
-rw-r--r--source/blender/blenkernel/intern/multires_unsubdivide.c6
-rw-r--r--source/blender/blenkernel/intern/node.c4
-rw-r--r--source/blender/blenkernel/intern/particle.c4
-rw-r--r--source/blender/blenkernel/intern/particle_distribute.c4
-rw-r--r--source/blender/blenkernel/intern/pbvh.c2
-rw-r--r--source/blender/blenkernel/intern/pointcache.c50
-rw-r--r--source/blender/blenkernel/intern/seqeffects.c26
-rw-r--r--source/blender/blenkernel/intern/sequencer.c2
-rw-r--r--source/blender/blenkernel/intern/softbody.c4
-rw-r--r--source/blender/blenkernel/intern/sound.c2
-rw-r--r--source/blender/blenkernel/intern/studiolight.c2
-rw-r--r--source/blender/blenkernel/intern/subdiv_ccg.c6
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c2
-rw-r--r--source/blender/blenkernel/intern/tracking.c2
40 files changed, 147 insertions, 147 deletions
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c
index 396c7d4fbcc..c572b1dacf0 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf.c
@@ -1543,7 +1543,7 @@ void CCG_key(CCGKey *key, const CCGSubSurf *ss, int level)
/* if normals are present, always the last three floats of an
* element */
if (key->has_normals) {
- key->normal_offset = key->elem_size - sizeof(float) * 3;
+ key->normal_offset = key->elem_size - sizeof(float[3]);
}
else {
key->normal_offset = -1;
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index af4829691c2..63e7933dd56 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -669,7 +669,7 @@ static float (*get_editbmesh_orco_verts(BMEditMesh *em))[3]
/* these may not really be the orco's, but it's only for preview.
* could be solver better once, but isn't simple */
- orco = MEM_malloc_arrayN(em->bm->totvert, sizeof(float) * 3, "BMEditMesh Orco");
+ orco = MEM_malloc_arrayN(em->bm->totvert, sizeof(float[3]), "BMEditMesh Orco");
BM_ITER_MESH_INDEX (eve, &iter, em->bm, BM_VERTS_OF_MESH, i) {
copy_v3_v3(orco[i], eve->co);
@@ -772,7 +772,7 @@ static void add_orco_mesh(Object *ob, BMEditMesh *em, Mesh *mesh, Mesh *mesh_orc
layerorco = CustomData_get_layer(&mesh->vdata, layer);
}
- memcpy(layerorco, orco, sizeof(float) * 3 * totvert);
+ memcpy(layerorco, orco, sizeof(float[3]) * totvert);
if (free) {
MEM_freeN(orco);
}
@@ -1371,7 +1371,7 @@ float (*editbmesh_vert_coords_alloc(BMEditMesh *em, int *r_vert_len))[3]
*r_vert_len = em->bm->totvert;
- cos = MEM_malloc_arrayN(em->bm->totvert, 3 * sizeof(float), "vertexcos");
+ cos = MEM_malloc_arrayN(em->bm->totvert, sizeof(float[3]), "vertexcos");
BM_ITER_MESH_INDEX (eve, &iter, em->bm, BM_VERTS_OF_MESH, i) {
copy_v3_v3(cos[i], eve->co);
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
index 11928dada2b..116d8b1a82f 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -724,14 +724,14 @@ static void curvemap_make_table(const CurveMapping *cumap, CurveMap *cuma)
bezt[a + 1].vec[1][0],
point,
CM_RESOL - 1,
- 2 * sizeof(float));
+ sizeof(float[2]));
BKE_curve_forward_diff_bezier(bezt[a].vec[1][1],
bezt[a].vec[2][1],
bezt[a + 1].vec[0][1],
bezt[a + 1].vec[1][1],
point + 1,
CM_RESOL - 1,
- 2 * sizeof(float));
+ sizeof(float[2]));
}
/* store first and last handle for extrapolation, unit length */
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 87d1b2561a9..01ce95d9d70 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -537,7 +537,7 @@ static void contarget_get_lattice_mat(Object *ob, const char *substring, float m
MDeformWeight *dw = BKE_defvert_find_index(dv, defgroup);
if (dw && dw->weight > 0.0f) {
/* copy coordinates of point to temporary vector, then add to find average */
- memcpy(tvec, co ? co : bp->vec, 3 * sizeof(float));
+ memcpy(tvec, co ? co : bp->vec, sizeof(float[3]));
add_v3_v3(vec, tvec);
grouped++;
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index 8e03f61d601..45ca89ac47e 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -725,7 +725,7 @@ float BKE_nurb_calc_length(const Nurb *nu, int resolution)
bezt->vec[1][j],
points + j,
resolu,
- 3 * sizeof(float));
+ sizeof(float[3]));
}
prevpntsit = pntsit = points;
diff --git a/source/blender/blenkernel/intern/curve_bevel.c b/source/blender/blenkernel/intern/curve_bevel.c
index 7f23f0215cc..edf5b82f822 100644
--- a/source/blender/blenkernel/intern/curve_bevel.c
+++ b/source/blender/blenkernel/intern/curve_bevel.c
@@ -216,8 +216,8 @@ static void curve_bevel_make_from_object(Curve *cu, ListBase *disp)
if (ELEM(dl->type, DL_POLY, DL_SEGM)) {
DispList *dlnew = MEM_mallocN(sizeof(DispList), __func__);
*dlnew = *dl;
- dlnew->verts = MEM_malloc_arrayN(dl->parts * dl->nr, 3 * sizeof(float), __func__);
- memcpy(dlnew->verts, dl->verts, 3 * sizeof(float) * dl->parts * dl->nr);
+ dlnew->verts = MEM_malloc_arrayN(dl->parts * dl->nr, sizeof(float[3]), __func__);
+ memcpy(dlnew->verts, dl->verts, sizeof(float[3]) * dl->parts * dl->nr);
if (dlnew->type == DL_SEGM) {
dlnew->flag |= (DL_FRONT_CURVE | DL_BACK_CURVE);
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index 0c1717ea184..f728436a759 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -597,14 +597,14 @@ static void layerSwap_mdisps(void *data, const int *ci)
MEM_freeN(s->disps);
s->totdisp = (s->totdisp / corners) * nverts;
- s->disps = MEM_calloc_arrayN(s->totdisp, sizeof(float) * 3, "mdisp swap");
+ s->disps = MEM_calloc_arrayN(s->totdisp, sizeof(float[3]), "mdisp swap");
return;
}
- d = MEM_calloc_arrayN(s->totdisp, 3 * sizeof(float), "mdisps swap");
+ d = MEM_calloc_arrayN(s->totdisp, sizeof(float[3]), "mdisps swap");
for (S = 0; S < corners; S++) {
- memcpy(d + cornersize * S, s->disps + cornersize * ci[S], cornersize * 3 * sizeof(float));
+ memcpy(d + cornersize * S, s->disps + cornersize * ci[S], sizeof(float[3]) * cornersize);
}
MEM_freeN(s->disps);
@@ -660,10 +660,10 @@ static int layerRead_mdisps(CDataFile *cdf, void *data, int count)
for (i = 0; i < count; i++) {
if (!d[i].disps) {
- d[i].disps = MEM_calloc_arrayN(d[i].totdisp, 3 * sizeof(float), "mdisps read");
+ d[i].disps = MEM_calloc_arrayN(d[i].totdisp, sizeof(float[3]), "mdisps read");
}
- if (!cdf_read_data(cdf, d[i].totdisp * 3 * sizeof(float), d[i].disps)) {
+ if (!cdf_read_data(cdf, sizeof(float[3]) * d[i].totdisp, d[i].disps)) {
CLOG_ERROR(&LOG, "failed to read multires displacement %d/%d %d", i, count, d[i].totdisp);
return 0;
}
@@ -678,7 +678,7 @@ static int layerWrite_mdisps(CDataFile *cdf, const void *data, int count)
int i;
for (i = 0; i < count; i++) {
- if (!cdf_write_data(cdf, d[i].totdisp * 3 * sizeof(float), d[i].disps)) {
+ if (!cdf_write_data(cdf, sizeof(float[3]) * d[i].totdisp, d[i].disps)) {
CLOG_ERROR(&LOG, "failed to write multires displacement %d/%d %d", i, count, d[i].totdisp);
return 0;
}
@@ -694,7 +694,7 @@ static size_t layerFilesize_mdisps(CDataFile *UNUSED(cdf), const void *data, int
int i;
for (i = 0; i < count; i++) {
- size += d[i].totdisp * 3 * sizeof(float);
+ size += sizeof(float[3]) * d[i].totdisp;
}
return size;
@@ -1564,7 +1564,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
/* 0: CD_MVERT */
{sizeof(MVert), "MVert", 1, NULL, NULL, NULL, NULL, NULL, NULL},
/* 1: CD_MSTICKY */ /* DEPRECATED */
- {sizeof(float) * 2, "", 1, NULL, NULL, NULL, NULL, NULL, NULL},
+ {sizeof(float[2]), "", 1, NULL, NULL, NULL, NULL, NULL, NULL},
/* 2: CD_MDEFORMVERT */
{sizeof(MDeformVert),
"MDeformVert",
@@ -1602,7 +1602,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
layerMaxNum_tface},
/* 6: CD_MCOL */
/* 4 MCol structs per face */
- {sizeof(MCol) * 4,
+ {sizeof(MCol[4]),
"MCol",
4,
N_("Col"),
@@ -1626,7 +1626,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
{sizeof(int), "", 0, NULL, NULL, NULL, NULL, NULL, layerDefault_origindex},
/* 8: CD_NORMAL */
/* 3 floats per normal vector */
- {sizeof(float) * 3,
+ {sizeof(float[3]),
"vec3f",
1,
NULL,
@@ -1677,7 +1677,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
layerSwap_origspace_face,
layerDefault_origspace_face},
/* 14: CD_ORCO */
- {sizeof(float) * 3, "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
+ {sizeof(float[3]), "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
/* 15: CD_MTEXPOLY */ /* DEPRECATED */
/* note, when we expose the UV Map / TexFace split to the user,
* change this back to face Texture. */
@@ -1725,7 +1725,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
NULL,
layerMaxNum_mloopcol},
/* 18: CD_TANGENT */
- {sizeof(float) * 4 * 4, "", 0, N_("Tangent"), NULL, NULL, NULL, NULL, NULL},
+ {sizeof(float[4][4]), "", 0, N_("Tangent"), NULL, NULL, NULL, NULL, NULL},
/* 19: CD_MDISPS */
{sizeof(MDisps),
"MDisps",
@@ -1747,7 +1747,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
layerWrite_mdisps,
layerFilesize_mdisps},
/* 20: CD_PREVIEW_MCOL */
- {sizeof(MCol) * 4,
+ {sizeof(MCol[4]),
"MCol",
4,
N_("PreviewCol"),
@@ -1757,9 +1757,9 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
layerSwap_mcol,
layerDefault_mcol},
/* 21: CD_ID_MCOL */ /* DEPRECATED */
- {sizeof(MCol) * 4, "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
+ {sizeof(MCol[4]), "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
/* 22: CD_TEXTURE_MCOL */
- {sizeof(MCol) * 4,
+ {sizeof(MCol[4]),
"MCol",
4,
N_("TexturedCol"),
@@ -1769,7 +1769,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
layerSwap_mcol,
layerDefault_mcol},
/* 23: CD_CLOTH_ORCO */
- {sizeof(float) * 3, "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
+ {sizeof(float[3]), "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
/* 24: CD_RECAST */
{sizeof(MRecast), "MRecast", 1, N_("Recast"), NULL, NULL, NULL, NULL},
@@ -1781,7 +1781,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
/* 27: CD_SHAPE_KEYINDEX */
{sizeof(int), "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
/* 28: CD_SHAPEKEY */
- {sizeof(float) * 3, "", 0, N_("ShapeKey"), NULL, NULL, layerInterp_shapekey},
+ {sizeof(float[3]), "", 0, N_("ShapeKey"), NULL, NULL, layerInterp_shapekey},
/* 29: CD_BWEIGHT */
{sizeof(float), "", 0, N_("BevelWeight"), NULL, NULL, layerInterp_bweight},
/* 30: CD_CREASE */
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index a3e1eeb89c7..5c162486c85 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -172,7 +172,7 @@ void BKE_displist_normals_add(ListBase *lb)
while (dl) {
if (dl->type == DL_INDEX3) {
if (dl->nors == NULL) {
- dl->nors = MEM_callocN(sizeof(float) * 3, "dlnors");
+ dl->nors = MEM_callocN(sizeof(float[3]), "dlnors");
if (dl->flag & DL_BACK_CURVE) {
dl->nors[2] = -1.0f;
@@ -184,7 +184,7 @@ void BKE_displist_normals_add(ListBase *lb)
}
else if (dl->type == DL_SURF) {
if (dl->nors == NULL) {
- dl->nors = MEM_callocN(sizeof(float) * 3 * dl->nr * dl->parts, "dlnors");
+ dl->nors = MEM_callocN(sizeof(float[3]) * dl->nr * dl->parts, "dlnors");
vdata = dl->verts;
ndata = dl->nors;
@@ -411,7 +411,7 @@ static void curve_to_displist(Curve *cu,
bezt->vec[1][j],
data + j,
resolu,
- 3 * sizeof(float));
+ sizeof(float[3]));
}
data += 3 * resolu;
@@ -444,7 +444,7 @@ static void curve_to_displist(Curve *cu,
else {
dl->type = DL_SEGM;
}
- BKE_nurb_makeCurve(nu, data, NULL, NULL, NULL, resolu, 3 * sizeof(float));
+ BKE_nurb_makeCurve(nu, data, NULL, NULL, NULL, resolu, sizeof(float[3]));
}
else if (nu->type == CU_POLY) {
len = nu->pntsu;
@@ -571,8 +571,8 @@ void BKE_displist_fill(ListBase *dispbase,
dlnew->nr = totvert;
dlnew->parts = tot;
- dlnew->index = MEM_mallocN(tot * 3 * sizeof(int), "dlindex");
- dlnew->verts = MEM_mallocN(totvert * 3 * sizeof(float), "dlverts");
+ dlnew->index = MEM_mallocN(sizeof(int[3]) * tot, "dlindex");
+ dlnew->verts = MEM_mallocN(sizeof(float[3]) * totvert, "dlverts");
/* vert data */
f1 = dlnew->verts;
@@ -641,7 +641,7 @@ static void bevels_to_filledpoly(Curve *cu, ListBase *dispbase)
if ((cu->flag & CU_BACK) && (dl->flag & DL_BACK_CURVE)) {
dlnew = MEM_callocN(sizeof(DispList), "filldisp");
BLI_addtail(&front, dlnew);
- dlnew->verts = fp1 = MEM_mallocN(sizeof(float) * 3 * dl->parts, "filldisp1");
+ dlnew->verts = fp1 = MEM_mallocN(sizeof(float[3]) * dl->parts, "filldisp1");
dlnew->nr = dl->parts;
dlnew->parts = 1;
dlnew->type = DL_POLY;
@@ -662,7 +662,7 @@ static void bevels_to_filledpoly(Curve *cu, ListBase *dispbase)
if ((cu->flag & CU_FRONT) && (dl->flag & DL_FRONT_CURVE)) {
dlnew = MEM_callocN(sizeof(DispList), "filldisp");
BLI_addtail(&back, dlnew);
- dlnew->verts = fp1 = MEM_mallocN(sizeof(float) * 3 * dl->parts, "filldisp1");
+ dlnew->verts = fp1 = MEM_mallocN(sizeof(float[3]) * dl->parts, "filldisp1");
dlnew->nr = dl->parts;
dlnew->parts = 1;
dlnew->type = DL_POLY;
@@ -948,7 +948,7 @@ static float (*displist_vert_coords_alloc(ListBase *dispbase, int *r_vert_len))[
*r_vert_len += (dl->type == DL_INDEX3) ? dl->nr : dl->parts * dl->nr;
}
- allverts = MEM_mallocN((*r_vert_len) * sizeof(float) * 3, "displist_vert_coords_alloc allverts");
+ allverts = MEM_mallocN(sizeof(float[3]) * (*r_vert_len), "displist_vert_coords_alloc allverts");
fp = (float *)allverts;
for (dl = dispbase->first; dl; dl = dl->next) {
int offs = 3 * ((dl->type == DL_INDEX3) ? dl->nr : dl->parts * dl->nr);
@@ -1185,7 +1185,7 @@ static void displist_surf_indices(DispList *dl)
dl->totindex = 0;
- index = dl->index = MEM_mallocN(4 * sizeof(int) * (dl->parts + 1) * (dl->nr + 1),
+ index = dl->index = MEM_mallocN(sizeof(int[4]) * (dl->parts + 1) * (dl->nr + 1),
"index array nurbs");
for (a = 0; a < dl->parts; a++) {
@@ -1274,7 +1274,7 @@ void BKE_displist_make_surf(Depsgraph *depsgraph,
dl->type = DL_SEGM;
}
- BKE_nurb_makeCurve(nu, data, NULL, NULL, NULL, resolu, 3 * sizeof(float));
+ BKE_nurb_makeCurve(nu, data, NULL, NULL, NULL, resolu, sizeof(float[3]));
}
else {
len = (nu->pntsu * resolu) * (nu->pntsv * resolv);
@@ -1388,7 +1388,7 @@ static void fillBevelCap(Nurb *nu, DispList *dlb, float *prev_fp, ListBase *disp
dl = MEM_callocN(sizeof(DispList), "makeDispListbev2");
dl->verts = MEM_mallocN(sizeof(float[3]) * dlb->nr, "dlverts");
- memcpy(dl->verts, prev_fp, 3 * sizeof(float) * dlb->nr);
+ memcpy(dl->verts, prev_fp, sizeof(float[3]) * dlb->nr);
dl->type = DL_POLY;
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index a39f2ccb6d8..1c61afe5e5a 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -5166,7 +5166,7 @@ static int dynamicPaint_prepareEffectStep(struct Depsgraph *depsgraph,
ListBase *effectors = BKE_effectors_create(depsgraph, ob, NULL, surface->effector_weights);
/* allocate memory for force data (dir vector + strength) */
- *force = MEM_mallocN(sData->total_points * 4 * sizeof(float), "PaintEffectForces");
+ *force = MEM_mallocN(sizeof(float[4]) * sData->total_points, "PaintEffectForces");
if (*force) {
DynamicPaintEffectData data = {
@@ -6260,7 +6260,7 @@ static int dynamicPaint_doStep(Depsgraph *depsgraph,
/* calculate brush speed vectors if required */
if (surface->type == MOD_DPAINT_SURFACE_T_PAINT && brush->flags & MOD_DPAINT_DO_SMUDGE) {
- bData->brush_velocity = MEM_callocN(sData->total_points * sizeof(float) * 4,
+ bData->brush_velocity = MEM_callocN(sizeof(float[4]) * sData->total_points,
"Dynamic Paint brush velocity");
/* init adjacency data if not already */
if (!sData->adj_data) {
diff --git a/source/blender/blenkernel/intern/fluid.c b/source/blender/blenkernel/intern/fluid.c
index b37d940195e..eb22c2a1462 100644
--- a/source/blender/blenkernel/intern/fluid.c
+++ b/source/blender/blenkernel/intern/fluid.c
@@ -695,7 +695,7 @@ static void bb_allocateData(FluidObjectBB *bb, bool use_velocity, bool use_influ
bb->influence = MEM_calloc_arrayN(bb->total_cells, sizeof(float), "fluid_bb_influence");
}
if (use_velocity) {
- bb->velocity = MEM_calloc_arrayN(bb->total_cells * 3, sizeof(float), "fluid_bb_velocity");
+ bb->velocity = MEM_calloc_arrayN(bb->total_cells, sizeof(float[3]), "fluid_bb_velocity");
}
bb->distances = MEM_malloc_arrayN(bb->total_cells, sizeof(float), "fluid_bb_distances");
@@ -1021,14 +1021,14 @@ static void obstacles_from_mesh(Object *coll_ob,
/* TODO (sebbas): Make initialization of vertex velocities optional? */
{
- vert_vel = MEM_callocN(sizeof(float) * numverts * 3, "manta_obs_velocity");
+ vert_vel = MEM_callocN(sizeof(float[3]) * numverts, "manta_obs_velocity");
if (fes->numverts != numverts || !fes->verts_old) {
if (fes->verts_old) {
MEM_freeN(fes->verts_old);
}
- fes->verts_old = MEM_callocN(sizeof(float) * numverts * 3, "manta_obs_verts_old");
+ fes->verts_old = MEM_callocN(sizeof(float[3]) * numverts, "manta_obs_verts_old");
fes->numverts = numverts;
}
else {
@@ -1578,9 +1578,9 @@ static void emit_from_particles(Object *flow_ob,
totchild = psys->totchild * psys->part->disp / 100;
}
- particle_pos = MEM_callocN(sizeof(float) * (totpart + totchild) * 3,
+ particle_pos = MEM_callocN(sizeof(float[3]) * (totpart + totchild),
"manta_flow_particles_pos");
- particle_vel = MEM_callocN(sizeof(float) * (totpart + totchild) * 3,
+ particle_vel = MEM_callocN(sizeof(float[3]) * (totpart + totchild),
"manta_flow_particles_vel");
/* setup particle radius emission if enabled */
@@ -2101,13 +2101,13 @@ static void emit_from_mesh(
mloopuv = CustomData_get_layer_named(&me->ldata, CD_MLOOPUV, ffs->uvlayer_name);
if (ffs->flags & FLUID_FLOW_INITVELOCITY) {
- vert_vel = MEM_callocN(sizeof(float) * numverts * 3, "manta_flow_velocity");
+ vert_vel = MEM_callocN(sizeof(float[3]) * numverts, "manta_flow_velocity");
if (ffs->numverts != numverts || !ffs->verts_old) {
if (ffs->verts_old) {
MEM_freeN(ffs->verts_old);
}
- ffs->verts_old = MEM_callocN(sizeof(float) * numverts * 3, "manta_flow_verts_old");
+ ffs->verts_old = MEM_callocN(sizeof(float[3]) * numverts, "manta_flow_verts_old");
ffs->numverts = numverts;
}
else {
@@ -3331,7 +3331,7 @@ static Mesh *create_liquid_geometry(FluidDomainSettings *fds, Mesh *orgmesh, Obj
co_offset[2] = (fds->p0[2] + fds->p1[2]) / 2.0f;
/* Normals. */
- normals = MEM_callocN(sizeof(short) * num_normals * 3, "Fluidmesh_tmp_normals");
+ normals = MEM_callocN(sizeof(short[3]) * num_normals, "Fluidmesh_tmp_normals");
/* Loop for vertices and normals. */
for (i = 0, no_s = normals; i < num_verts && i < num_normals; i++, mverts++, no_s += 3) {
diff --git a/source/blender/blenkernel/intern/gpencil_curve.c b/source/blender/blenkernel/intern/gpencil_curve.c
index 3e568bd5e1e..e64369d74cb 100644
--- a/source/blender/blenkernel/intern/gpencil_curve.c
+++ b/source/blender/blenkernel/intern/gpencil_curve.c
@@ -329,7 +329,7 @@ static void gpencil_convert_spline(Main *bmain,
bezt->vec[1][j],
coord_array + j,
resolu - 1,
- 3 * sizeof(float));
+ sizeof(float[3]));
}
/* Save first point coordinates. */
if (s == 0) {
diff --git a/source/blender/blenkernel/intern/gpencil_geom.c b/source/blender/blenkernel/intern/gpencil_geom.c
index 672d65f1585..65ce117431b 100644
--- a/source/blender/blenkernel/intern/gpencil_geom.c
+++ b/source/blender/blenkernel/intern/gpencil_geom.c
@@ -237,7 +237,7 @@ static int stroke_march_next_point(const bGPDstroke *gps,
copy_v3_v3(result, &pt->x);
*pressure = gps->points[next_point_index].pressure;
*strength = gps->points[next_point_index].strength;
- memcpy(vert_color, gps->points[next_point_index].vert_color, sizeof(float) * 4);
+ memcpy(vert_color, gps->points[next_point_index].vert_color, sizeof(float[4]));
*index_from = next_point_index - 1;
*index_to = next_point_index;
@@ -445,7 +445,7 @@ bool BKE_gpencil_stroke_sample(bGPDstroke *gps, const float dist, const bool sel
copy_v3_v3(&pt2->x, last_coord);
new_pt[i].pressure = pt[0].pressure;
new_pt[i].strength = pt[0].strength;
- memcpy(new_pt[i].vert_color, pt[0].vert_color, sizeof(float) * 4);
+ memcpy(new_pt[i].vert_color, pt[0].vert_color, sizeof(float[4]));
if (select) {
new_pt[i].flag |= GP_SPOINT_SELECT;
}
@@ -471,7 +471,7 @@ bool BKE_gpencil_stroke_sample(bGPDstroke *gps, const float dist, const bool sel
copy_v3_v3(&pt2->x, last_coord);
new_pt[i].pressure = pressure;
new_pt[i].strength = strength;
- memcpy(new_pt[i].vert_color, vert_color, sizeof(float) * 4);
+ memcpy(new_pt[i].vert_color, vert_color, sizeof(float[4]));
if (select) {
new_pt[i].flag |= GP_SPOINT_SELECT;
}
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index e394242001c..529ae227df9 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -55,10 +55,10 @@ static size_t idp_size_table[] = {
1, /*strings*/
sizeof(int),
sizeof(float),
- sizeof(float) * 3, /*Vector type, deprecated*/
- sizeof(float) * 16, /*Matrix type, deprecated*/
- 0, /*arrays don't have a fixed size*/
- sizeof(ListBase), /*Group type*/
+ sizeof(float[3]), /*Vector type, deprecated*/
+ sizeof(float[16]), /*Matrix type, deprecated*/
+ 0, /*arrays don't have a fixed size*/
+ sizeof(ListBase), /*Group type*/
sizeof(void *),
sizeof(double),
};
diff --git a/source/blender/blenkernel/intern/image_gpu.c b/source/blender/blenkernel/intern/image_gpu.c
index 22fb6dfd02a..78a705ae145 100644
--- a/source/blender/blenkernel/intern/image_gpu.c
+++ b/source/blender/blenkernel/intern/image_gpu.c
@@ -633,7 +633,7 @@ static void gpu_texture_update_from_ibuf(
const bool compress_as_srgb = !IMB_colormanagement_space_is_scene_linear(
ibuf->rect_colorspace);
- rect = (uchar *)MEM_mallocN(sizeof(uchar) * 4 * w * h, __func__);
+ rect = (uchar *)MEM_mallocN(sizeof(uchar[4]) * w * h, __func__);
if (rect == NULL) {
return;
}
@@ -653,7 +653,7 @@ static void gpu_texture_update_from_ibuf(
const bool store_premultiplied = (ima->alpha_mode != IMA_ALPHA_STRAIGHT);
if (ibuf->channels != 4 || scaled || !store_premultiplied) {
- rect_float = (float *)MEM_mallocN(sizeof(float) * 4 * w * h, __func__);
+ rect_float = (float *)MEM_mallocN(sizeof(float[4]) * w * h, __func__);
if (rect_float == NULL) {
return;
}
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index a71b9cc2a1d..0108befa710 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -569,7 +569,7 @@ static char *key_block_get_data(Key *key, KeyBlock *actkb, KeyBlock *kb, char **
if (me->edit_mesh && me->edit_mesh->bm->totvert == kb->totelem) {
a = 0;
- co = MEM_mallocN(sizeof(float) * 3 * me->edit_mesh->bm->totvert, "key_block_get_data");
+ co = MEM_mallocN(sizeof(float[3]) * me->edit_mesh->bm->totvert, "key_block_get_data");
BM_ITER_MESH (eve, &iter, me->edit_mesh->bm, BM_VERTS_OF_MESH) {
copy_v3_v3(co[a], eve->co);
diff --git a/source/blender/blenkernel/intern/lattice_deform.c b/source/blender/blenkernel/intern/lattice_deform.c
index 674ee9ed2c5..33f7d9851db 100644
--- a/source/blender/blenkernel/intern/lattice_deform.c
+++ b/source/blender/blenkernel/intern/lattice_deform.c
@@ -80,7 +80,7 @@ LatticeDeformData *BKE_lattice_deform_data_create(const Object *oblatt, const Ob
}
bp = lt->def;
- fp = latticedata = MEM_mallocN(sizeof(float) * 3 * lt->pntsu * lt->pntsv * lt->pntsw,
+ fp = latticedata = MEM_mallocN(sizeof(float[3]) * lt->pntsu * lt->pntsv * lt->pntsw,
"latticedata");
/* for example with a particle system: (ob == NULL) */
diff --git a/source/blender/blenkernel/intern/mask_evaluate.c b/source/blender/blenkernel/intern/mask_evaluate.c
index d0f80bf92b9..2fbf5f8648d 100644
--- a/source/blender/blenkernel/intern/mask_evaluate.c
+++ b/source/blender/blenkernel/intern/mask_evaluate.c
@@ -178,7 +178,7 @@ float (*BKE_mask_spline_differentiate_with_resolution(MaskSpline *spline,
bezt_curr->vec[1][j],
&(*fp)[j],
resol,
- 2 * sizeof(float));
+ sizeof(float[2]));
}
fp += resol;
@@ -687,7 +687,7 @@ static float (*mask_spline_feather_differentiated_points_with_resolution__double
bezt_curr->vec[1][j],
&(*fp)[j],
resol,
- 2 * sizeof(float));
+ sizeof(float[2]));
}
/* scale by the uw's */
@@ -845,7 +845,7 @@ float *BKE_mask_point_segment_diff(MaskSpline *spline,
/* resol+1 because of 'forward_diff_bezier' function */
*tot_diff_point = resol + 1;
- diff_points = fp = MEM_callocN((resol + 1) * 2 * sizeof(float), "mask segment vets");
+ diff_points = fp = MEM_callocN(sizeof(float[2]) * (resol + 1), "mask segment vets");
for (j = 0; j < 2; j++) {
BKE_curve_forward_diff_bezier(bezt->vec[1][j],
@@ -854,7 +854,7 @@ float *BKE_mask_point_segment_diff(MaskSpline *spline,
bezt_next->vec[1][j],
fp + j,
resol,
- 2 * sizeof(float));
+ sizeof(float[2]));
}
copy_v2_v2(fp + 2 * resol, bezt_next->vec[1]);
diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c
index b28cd9c6c8e..92885535f57 100644
--- a/source/blender/blenkernel/intern/mask_rasterize.c
+++ b/source/blender/blenkernel/intern/mask_rasterize.c
@@ -786,7 +786,7 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
co_feather[2] = 1.0f;
if (spline->flag & MASK_SPLINE_NOINTERSECT) {
- diff_feather_points_flip = MEM_mallocN(sizeof(float) * 2 * tot_diff_feather_points,
+ diff_feather_points_flip = MEM_mallocN(sizeof(float[2]) * tot_diff_feather_points,
"diff_feather_points_flip");
for (j = 0; j < tot_diff_point; j++) {
@@ -939,7 +939,7 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle,
ListBase isect_remedgebase = {NULL, NULL};
/* now we have all the splines */
- face_coords = MEM_mallocN((sizeof(float) * 3) * sf_vert_tot, "maskrast_face_coords");
+ face_coords = MEM_mallocN((sizeof(float[3])) * sf_vert_tot, "maskrast_face_coords");
/* init bounds */
BLI_rctf_init_minmax(&bounds);
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index 3a514608c77..de07c96e3f0 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -281,7 +281,7 @@ float *BKE_mball_make_orco(Object *ob, ListBase *dispbase)
size[2] = bb->vec[1][2] - loc[2];
dl = dispbase->first;
- orcodata = MEM_mallocN(sizeof(float) * 3 * dl->nr, "MballOrco");
+ orcodata = MEM_mallocN(sizeof(float[3]) * dl->nr, "MballOrco");
data = dl->verts;
orco = orcodata;
diff --git a/source/blender/blenkernel/intern/mball_tessellate.c b/source/blender/blenkernel/intern/mball_tessellate.c
index 72b99bea0f4..92e16be878f 100644
--- a/source/blender/blenkernel/intern/mball_tessellate.c
+++ b/source/blender/blenkernel/intern/mball_tessellate.c
@@ -1276,8 +1276,8 @@ static void init_meta(Depsgraph *depsgraph, PROCESS *process, Scene *scene, Obje
new_ml = BLI_memarena_alloc(process->pgn_elements, sizeof(MetaElem));
*(new_ml) = *ml;
new_ml->bb = BLI_memarena_alloc(process->pgn_elements, sizeof(BoundBox));
- new_ml->mat = BLI_memarena_alloc(process->pgn_elements, 4 * 4 * sizeof(float));
- new_ml->imat = BLI_memarena_alloc(process->pgn_elements, 4 * 4 * sizeof(float));
+ new_ml->mat = BLI_memarena_alloc(process->pgn_elements, sizeof(float[4][4]));
+ new_ml->imat = BLI_memarena_alloc(process->pgn_elements, sizeof(float[4][4]));
/* too big stiffness seems only ugly due to linear interpolation
* no need to have possibility for too big stiffness */
diff --git a/source/blender/blenkernel/intern/mesh_convert.c b/source/blender/blenkernel/intern/mesh_convert.c
index a0f3bc9e74d..76a6d23bc8f 100644
--- a/source/blender/blenkernel/intern/mesh_convert.c
+++ b/source/blender/blenkernel/intern/mesh_convert.c
@@ -314,11 +314,11 @@ int BKE_mesh_nurbs_displist_to_mdata(Object *ob,
*r_allvert = mvert = MEM_calloc_arrayN(totvert, sizeof(MVert), "nurbs_init mvert");
*r_alledge = medge = MEM_calloc_arrayN(totedge, sizeof(MEdge), "nurbs_init medge");
*r_allloop = mloop = MEM_calloc_arrayN(
- totpoly, 4 * sizeof(MLoop), "nurbs_init mloop"); // totloop
+ totpoly, sizeof(MLoop[4]), "nurbs_init mloop"); // totloop
*r_allpoly = mpoly = MEM_calloc_arrayN(totpoly, sizeof(MPoly), "nurbs_init mloop");
if (r_alluv) {
- *r_alluv = mloopuv = MEM_calloc_arrayN(totpoly, 4 * sizeof(MLoopUV), "nurbs_init mloopuv");
+ *r_alluv = mloopuv = MEM_calloc_arrayN(totpoly, sizeof(MLoopUV[4]), "nurbs_init mloopuv");
}
/* verts and faces */
@@ -1298,11 +1298,11 @@ static void add_shapekey_layers(Mesh *mesh_dest, Mesh *mesh_src)
mesh_src->totvert,
kb->name,
kb->totelem);
- array = MEM_calloc_arrayN((size_t)mesh_src->totvert, 3 * sizeof(float), __func__);
+ array = MEM_calloc_arrayN((size_t)mesh_src->totvert, sizeof(float[3]), __func__);
}
else {
- array = MEM_malloc_arrayN((size_t)mesh_src->totvert, 3 * sizeof(float), __func__);
- memcpy(array, kb->data, (size_t)mesh_src->totvert * 3 * sizeof(float));
+ array = MEM_malloc_arrayN((size_t)mesh_src->totvert, sizeof(float[3]), __func__);
+ memcpy(array, kb->data, sizeof(float[3]) * (size_t)mesh_src->totvert);
}
CustomData_add_layer_named(
@@ -1405,7 +1405,7 @@ static void shapekey_layers_to_keyblocks(Mesh *mesh_src, Mesh *mesh_dst, int act
cos = CustomData_get_layer_n(&mesh_src->vdata, CD_SHAPEKEY, i);
kb->totelem = mesh_src->totvert;
- kb->data = kbcos = MEM_malloc_arrayN(kb->totelem, 3 * sizeof(float), __func__);
+ kb->data = kbcos = MEM_malloc_arrayN(kb->totelem, sizeof(float[3]), __func__);
if (kb->uid == actshape_uid) {
MVert *mvert = mesh_src->mvert;
@@ -1427,7 +1427,7 @@ static void shapekey_layers_to_keyblocks(Mesh *mesh_src, Mesh *mesh_dst, int act
}
kb->totelem = mesh_src->totvert;
- kb->data = MEM_calloc_arrayN(kb->totelem, 3 * sizeof(float), __func__);
+ kb->data = MEM_calloc_arrayN(kb->totelem, sizeof(float[3]), __func__);
CLOG_ERROR(&LOG, "lost a shapekey layer: '%s'! (bmesh internal error)", kb->name);
}
}
diff --git a/source/blender/blenkernel/intern/mesh_mirror.c b/source/blender/blenkernel/intern/mesh_mirror.c
index d9be9a99b2b..46764a56e60 100644
--- a/source/blender/blenkernel/intern/mesh_mirror.c
+++ b/source/blender/blenkernel/intern/mesh_mirror.c
@@ -197,7 +197,7 @@ Mesh *BKE_mesh_mirror_apply_mirror_on_axis(MirrorModifierData *mmd,
if (do_vtargetmap) {
/* second half is filled with -1 */
- vtargetmap = MEM_malloc_arrayN(maxVerts, 2 * sizeof(int), "MOD_mirror tarmap");
+ vtargetmap = MEM_malloc_arrayN(maxVerts, sizeof(int[2]), "MOD_mirror tarmap");
vtmap_a = vtargetmap;
vtmap_b = vtargetmap + maxVerts;
diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c
index 392f95af917..6e1168d8a16 100644
--- a/source/blender/blenkernel/intern/multires.c
+++ b/source/blender/blenkernel/intern/multires.c
@@ -608,7 +608,7 @@ static void multires_reallocate_mdisps(int totloop, MDisps *mdisps, int lvl)
/* reallocate displacements to be filled in */
for (i = 0; i < totloop; i++) {
int totdisp = multires_grid_tot[lvl];
- float(*disps)[3] = MEM_calloc_arrayN(totdisp, 3 * sizeof(float), "multires disps");
+ float(*disps)[3] = MEM_calloc_arrayN(totdisp, sizeof(float[3]), "multires disps");
if (mdisps[i].disps) {
MEM_freeN(mdisps[i].disps);
@@ -726,7 +726,7 @@ static void multires_del_higher(MultiresModifierData *mmd, Object *ob, int lvl)
float(*disps)[3], (*ndisps)[3], (*hdisps)[3];
int totdisp = multires_grid_tot[lvl];
- disps = MEM_calloc_arrayN(totdisp, 3 * sizeof(float), "multires disps");
+ disps = MEM_calloc_arrayN(totdisp, sizeof(float[3]), "multires disps");
if (mdisp->disps != NULL) {
ndisps = disps;
@@ -1540,7 +1540,7 @@ static void old_mdisps_convert(MFace *mface, MDisps *mdisp)
int x, y, S;
float(*disps)[3], (*out)[3], u = 0.0f, v = 0.0f; /* Quite gcc barking. */
- disps = MEM_calloc_arrayN(newtotdisp, 3 * sizeof(float), "multires disps");
+ disps = MEM_calloc_arrayN(newtotdisp, sizeof(float[3]), "multires disps");
out = disps;
for (S = 0; S < nvert; S++) {
@@ -1600,7 +1600,7 @@ void multires_load_old_250(Mesh *me)
for (j = 0; j < nvert; j++, k++) {
mdisps2[k].disps = MEM_calloc_arrayN(
- totdisp, 3 * sizeof(float), "multires disp in conversion");
+ totdisp, sizeof(float[3]), "multires disp in conversion");
mdisps2[k].totdisp = totdisp;
mdisps2[k].level = mdisps[i].level;
memcpy(mdisps2[k].disps, mdisps[i].disps + totdisp * j, totdisp);
@@ -1672,7 +1672,7 @@ static void create_old_vert_face_map(ListBase **map,
IndexNode *node = NULL;
(*map) = MEM_calloc_arrayN(totvert, sizeof(ListBase), "vert face map");
- (*mem) = MEM_calloc_arrayN(totface, 4 * sizeof(IndexNode), "vert face map mem");
+ (*mem) = MEM_calloc_arrayN(totface, sizeof(IndexNode[4]), "vert face map mem");
node = *mem;
/* Find the users */
@@ -1694,7 +1694,7 @@ static void create_old_vert_edge_map(ListBase **map,
IndexNode *node = NULL;
(*map) = MEM_calloc_arrayN(totvert, sizeof(ListBase), "vert edge map");
- (*mem) = MEM_calloc_arrayN(totedge, 2 * sizeof(IndexNode), "vert edge map mem");
+ (*mem) = MEM_calloc_arrayN(totedge, sizeof(IndexNode[2]), "vert edge map mem");
node = *mem;
/* Find the users */
@@ -2376,7 +2376,7 @@ void multires_topology_changed(Mesh *me)
if (!mdisp->totdisp || !mdisp->disps) {
if (grid) {
mdisp->totdisp = grid;
- mdisp->disps = MEM_calloc_arrayN(3 * sizeof(float), mdisp->totdisp, "mdisp topology");
+ mdisp->disps = MEM_calloc_arrayN(sizeof(float[3]), mdisp->totdisp, "mdisp topology");
}
continue;
diff --git a/source/blender/blenkernel/intern/multires_reshape_apply_base.c b/source/blender/blenkernel/intern/multires_reshape_apply_base.c
index 10a43a4c9b8..6e7e2b90c05 100644
--- a/source/blender/blenkernel/intern/multires_reshape_apply_base.c
+++ b/source/blender/blenkernel/intern/multires_reshape_apply_base.c
@@ -99,7 +99,7 @@ void multires_reshape_apply_base_refit_base_mesh(MultiresReshapeContext *reshape
base_mesh->totloop);
float(*origco)[3] = MEM_calloc_arrayN(
- base_mesh->totvert, 3 * sizeof(float), "multires apply base origco");
+ base_mesh->totvert, sizeof(float[3]), "multires apply base origco");
for (int i = 0; i < base_mesh->totvert; i++) {
copy_v3_v3(origco[i], base_mesh->mvert[i].co);
}
@@ -140,7 +140,7 @@ void multires_reshape_apply_base_refit_base_mesh(MultiresReshapeContext *reshape
fake_poly.totloop = p->totloop;
fake_poly.loopstart = 0;
fake_loops = MEM_malloc_arrayN(p->totloop, sizeof(MLoop), "fake_loops");
- fake_co = MEM_malloc_arrayN(p->totloop, 3 * sizeof(float), "fake_co");
+ fake_co = MEM_malloc_arrayN(p->totloop, sizeof(float[3]), "fake_co");
for (int k = 0; k < p->totloop; k++) {
const int vndx = base_mesh->mloop[p->loopstart + k].v;
diff --git a/source/blender/blenkernel/intern/multires_reshape_ccg.c b/source/blender/blenkernel/intern/multires_reshape_ccg.c
index 8273845e820..55f7766c878 100644
--- a/source/blender/blenkernel/intern/multires_reshape_ccg.c
+++ b/source/blender/blenkernel/intern/multires_reshape_ccg.c
@@ -58,7 +58,7 @@ bool multires_reshape_assign_final_coords_from_ccg(const MultiresReshapeContext
BLI_assert(grid_element.displacement != NULL);
memcpy(grid_element.displacement,
CCG_grid_elem_co(&reshape_level_key, ccg_grid, x, y),
- sizeof(float) * 3);
+ sizeof(float[3]));
if (reshape_level_key.has_mask) {
BLI_assert(grid_element.mask != NULL);
diff --git a/source/blender/blenkernel/intern/multires_reshape_util.c b/source/blender/blenkernel/intern/multires_reshape_util.c
index e9a779dafeb..c8179dd8a2d 100644
--- a/source/blender/blenkernel/intern/multires_reshape_util.c
+++ b/source/blender/blenkernel/intern/multires_reshape_util.c
@@ -522,7 +522,7 @@ static void allocate_displacement_grid(MDisps *displacement_grid, const int leve
{
const int grid_size = BKE_subdiv_grid_size_from_level(level);
const int grid_area = grid_size * grid_size;
- float(*disps)[3] = MEM_calloc_arrayN(grid_area, 3 * sizeof(float), "multires disps");
+ float(*disps)[3] = MEM_calloc_arrayN(grid_area, sizeof(float[3]), "multires disps");
if (displacement_grid->disps != NULL) {
MEM_freeN(displacement_grid->disps);
}
diff --git a/source/blender/blenkernel/intern/multires_unsubdivide.c b/source/blender/blenkernel/intern/multires_unsubdivide.c
index c9bb9518230..e3d670f7c39 100644
--- a/source/blender/blenkernel/intern/multires_unsubdivide.c
+++ b/source/blender/blenkernel/intern/multires_unsubdivide.c
@@ -677,7 +677,7 @@ static void store_grid_data(MultiresUnsubdivideContext *context,
const int grid_size = BKE_ccg_gridsize(context->num_original_levels);
const int face_grid_size = BKE_ccg_gridsize(context->num_original_levels + 1);
const int face_grid_area = face_grid_size * face_grid_size;
- float(*face_grid)[3] = MEM_calloc_arrayN(face_grid_area, 3 * sizeof(float), "face_grid");
+ float(*face_grid)[3] = MEM_calloc_arrayN(face_grid_area, sizeof(float[3]), "face_grid");
for (int i = 0; i < poly->totloop; i++) {
const int loop_index = poly->loopstart + i;
@@ -731,7 +731,7 @@ static void multires_unsubdivide_extract_single_grid_from_face_edge(
const int unsubdiv_grid_size = grid->grid_size = BKE_ccg_gridsize(context->num_total_levels);
grid->grid_size = unsubdiv_grid_size;
grid->grid_co = MEM_calloc_arrayN(
- unsubdiv_grid_size * unsubdiv_grid_size, 3 * sizeof(float), "grids coordinates");
+ unsubdiv_grid_size * unsubdiv_grid_size, sizeof(float[3]), "grids coordinates");
/* Get the vertex on the corner of the grid. This vertex was tagged previously as it also exist
* on the base mesh. */
@@ -1198,7 +1198,7 @@ static void multires_create_grids_in_unsubdivided_base_mesh(MultiresUnsubdivideC
/* Allocate the MDISPS grids and copy the extracted data from context. */
for (int i = 0; i < totloop; i++) {
- float(*disps)[3] = MEM_calloc_arrayN(totdisp, 3 * sizeof(float), "multires disps");
+ float(*disps)[3] = MEM_calloc_arrayN(totdisp, sizeof(float[3]), "multires disps");
if (mdisps[i].disps) {
MEM_freeN(mdisps[i].disps);
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index d77e7cf862d..a89285a28c1 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -1917,7 +1917,7 @@ bNodePreview *BKE_node_preview_verify(
}
if (preview->rect == NULL) {
- preview->rect = MEM_callocN(4 * xsize + xsize * ysize * sizeof(char) * 4, "node preview rect");
+ preview->rect = MEM_callocN(4 * xsize + xsize * ysize * sizeof(char[4]), "node preview rect");
preview->xsize = xsize;
preview->ysize = ysize;
}
@@ -2055,7 +2055,7 @@ static void node_preview_sync(bNodePreview *to, bNodePreview *from)
if (to->rect && from->rect) {
int xsize = to->xsize;
int ysize = to->ysize;
- memcpy(to->rect, from->rect, xsize * ysize * sizeof(char) * 4);
+ memcpy(to->rect, from->rect, xsize * ysize * sizeof(char[4]));
}
}
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 363706ca969..b3da6c53b34 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -3480,7 +3480,7 @@ static void triatomat(float *v1, float *v2, float *v3, float (*uv)[2], float mat
{
float det, w1, w2, d1[2], d2[2];
- memset(mat, 0, sizeof(float) * 4 * 4);
+ memset(mat, 0, sizeof(float[4][4]));
mat[3][3] = 1.0f;
/* first axis is the normal */
@@ -4385,7 +4385,7 @@ void psys_get_particle_on_path(ParticleSimulationData *sim,
short cpa_from;
/* initialize keys to zero */
- memset(keys, 0, 4 * sizeof(ParticleKey));
+ memset(keys, 0, sizeof(ParticleKey[4]));
t = state->time;
CLAMP(t, 0.0f, 1.0f);
diff --git a/source/blender/blenkernel/intern/particle_distribute.c b/source/blender/blenkernel/intern/particle_distribute.c
index dc6d5e974ed..fad93245a04 100644
--- a/source/blender/blenkernel/intern/particle_distribute.c
+++ b/source/blender/blenkernel/intern/particle_distribute.c
@@ -382,7 +382,7 @@ static void init_mv_jit(float *jit, int num, int seed2, float amount)
x -= (float)floor(x);
}
- jit2 = MEM_mallocN(12 + 2 * sizeof(float) * num, "initjit");
+ jit2 = MEM_mallocN(12 + sizeof(float[2]) * num, "initjit");
for (i = 0; i < 4; i++) {
BLI_jitterate1((float(*)[2])jit, (float(*)[2])jit2, num, rad1);
@@ -1280,7 +1280,7 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx,
hammersley_create(jit, jitlevel + 1, psys->seed, part->jitfac);
}
BLI_array_randomize(
- jit, 2 * sizeof(float), jitlevel, psys->seed); /* for custom jit or even distribution */
+ jit, sizeof(float[2]), jitlevel, psys->seed); /* for custom jit or even distribution */
}
/* Setup things for threaded distribution */
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c
index 1dd22a0a28d..1e4ea19adb6 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -2912,7 +2912,7 @@ PBVHColorBufferNode *BKE_pbvh_node_color_buffer_get(PBVHNode *node)
{
if (!node->color_buffer.color) {
- node->color_buffer.color = MEM_callocN(node->uniq_verts * sizeof(float) * 4, "Color buffer");
+ node->color_buffer.color = MEM_callocN(sizeof(float[4]) * node->uniq_verts, "Color buffer");
}
return &node->color_buffer;
}
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index ae18f3289e4..64e642462af 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -126,19 +126,19 @@ static CLG_LogRef LOG = {"bke.pointcache"};
static int ptcache_data_size[] = {
sizeof(unsigned int), // BPHYS_DATA_INDEX
- 3 * sizeof(float), // BPHYS_DATA_LOCATION
- 3 * sizeof(float), // BPHYS_DATA_VELOCITY
- 4 * sizeof(float), // BPHYS_DATA_ROTATION
- 3 * sizeof(float), // BPHYS_DATA_AVELOCITY / BPHYS_DATA_XCONST
+ sizeof(float[3]), // BPHYS_DATA_LOCATION
+ sizeof(float[3]), // BPHYS_DATA_VELOCITY
+ sizeof(float[4]), // BPHYS_DATA_ROTATION
+ sizeof(float[3]), // BPHYS_DATA_AVELOCITY / BPHYS_DATA_XCONST
sizeof(float), // BPHYS_DATA_SIZE
- 3 * sizeof(float), // BPHYS_DATA_TIMES
+ sizeof(float[3]), // BPHYS_DATA_TIMES
sizeof(BoidData), // case BPHYS_DATA_BOIDS
};
static int ptcache_extra_datasize[] = {
0,
sizeof(ParticleSpring),
- sizeof(float) * 3,
+ sizeof(float[3]),
};
/* forward declarations */
@@ -212,8 +212,8 @@ static void ptcache_softbody_read(
BodyPoint *bp = soft->bpoint + index;
if (old_data) {
- memcpy(bp->pos, data, 3 * sizeof(float));
- memcpy(bp->vec, data + 3, 3 * sizeof(float));
+ memcpy(bp->pos, data, sizeof(float[3]));
+ memcpy(bp->vec, data + 3, sizeof(float[3]));
}
else {
PTCACHE_DATA_TO(data, BPHYS_DATA_LOCATION, 0, bp->pos);
@@ -241,8 +241,8 @@ static void ptcache_softbody_interpolate(int index,
copy_v3_v3(keys[1].vel, bp->vec);
if (old_data) {
- memcpy(keys[2].co, old_data, 3 * sizeof(float));
- memcpy(keys[2].vel, old_data + 3, 3 * sizeof(float));
+ memcpy(keys[2].co, old_data, sizeof(float[3]));
+ memcpy(keys[2].vel, old_data + 3, sizeof(float[3]));
}
else {
BKE_ptcache_make_particle_key(keys + 2, 0, data, cfra2);
@@ -545,9 +545,9 @@ static void ptcache_cloth_read(
ClothVertex *vert = cloth->verts + index;
if (old_data) {
- memcpy(vert->x, data, 3 * sizeof(float));
- memcpy(vert->xconst, data + 3, 3 * sizeof(float));
- memcpy(vert->v, data + 6, 3 * sizeof(float));
+ memcpy(vert->x, data, sizeof(float[3]));
+ memcpy(vert->xconst, data + 3, sizeof(float[3]));
+ memcpy(vert->v, data + 6, sizeof(float[3]));
}
else {
PTCACHE_DATA_TO(data, BPHYS_DATA_LOCATION, 0, vert->x);
@@ -577,8 +577,8 @@ static void ptcache_cloth_interpolate(int index,
copy_v3_v3(keys[1].vel, vert->v);
if (old_data) {
- memcpy(keys[2].co, old_data, 3 * sizeof(float));
- memcpy(keys[2].vel, old_data + 6, 3 * sizeof(float));
+ memcpy(keys[2].co, old_data, sizeof(float[3]));
+ memcpy(keys[2].vel, old_data + 6, sizeof(float[3]));
}
else {
BKE_ptcache_make_particle_key(keys + 2, 0, data, cfra2);
@@ -1421,7 +1421,7 @@ static int ptcache_dynamicpaint_write(PTCacheFile *pf, void *dp_v)
int cache_compress = 1;
/* version header */
- ptcache_file_write(pf, DPAINT_CACHE_VERSION, 1, sizeof(char) * 4);
+ ptcache_file_write(pf, DPAINT_CACHE_VERSION, 1, sizeof(char[4]));
if (surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ && surface->data) {
int total_points = surface->data->total_points;
@@ -1459,7 +1459,7 @@ static int ptcache_dynamicpaint_read(PTCacheFile *pf, void *dp_v)
char version[4];
/* version header */
- ptcache_file_read(pf, version, 1, sizeof(char) * 4);
+ ptcache_file_read(pf, version, 1, sizeof(char[4]));
if (!STREQLEN(version, DPAINT_CACHE_VERSION, 4)) {
CLOG_ERROR(&LOG, "Dynamic Paint: Invalid cache version: '%c%c%c%c'!", UNPACK4(version));
return 0;
@@ -1538,8 +1538,8 @@ static void ptcache_rigidbody_read(
if (rbo->type == RBO_TYPE_ACTIVE) {
if (old_data) {
- memcpy(rbo->pos, data, 3 * sizeof(float));
- memcpy(rbo->orn, data + 3, 4 * sizeof(float));
+ memcpy(rbo->pos, data, sizeof(float[3]));
+ memcpy(rbo->orn, data + 3, sizeof(float[4]));
}
else {
PTCACHE_DATA_TO(data, BPHYS_DATA_LOCATION, 0, rbo->pos);
@@ -1577,8 +1577,8 @@ static void ptcache_rigidbody_interpolate(int index,
copy_qt_qt(keys[1].rot, rbo->orn);
if (old_data) {
- memcpy(keys[2].co, data, 3 * sizeof(float));
- memcpy(keys[2].rot, data + 3, 4 * sizeof(float));
+ memcpy(keys[2].co, data, sizeof(float[3]));
+ memcpy(keys[2].rot, data + 3, sizeof(float[4]));
}
else {
BKE_ptcache_make_particle_key(&keys[2], 0, data, cfra2);
@@ -2276,7 +2276,7 @@ static int ptcache_file_compressed_read(PTCacheFile *pf, unsigned char *result,
size_t out_len = len;
#endif
unsigned char *in;
- unsigned char *props = MEM_callocN(16 * sizeof(char), "tmp");
+ unsigned char *props = MEM_callocN(sizeof(char[16]), "tmp");
ptcache_file_read(pf, &compressed, 1, sizeof(unsigned char));
if (compressed) {
@@ -2322,7 +2322,7 @@ static int ptcache_file_compressed_write(
int r = 0;
unsigned char compressed = 0;
size_t out_len = 0;
- unsigned char *props = MEM_callocN(16 * sizeof(char), "tmp");
+ unsigned char *props = MEM_callocN(sizeof(char[16]), "tmp");
size_t sizeOfIt = 5;
(void)mode; /* unused when building w/o compression */
@@ -2623,13 +2623,13 @@ static void ptcache_mem_clear(PTCacheMem *pm)
static int ptcache_old_elemsize(PTCacheID *pid)
{
if (pid->type == PTCACHE_TYPE_SOFTBODY) {
- return 6 * sizeof(float);
+ return sizeof(float[6]);
}
if (pid->type == PTCACHE_TYPE_PARTICLES) {
return sizeof(ParticleKey);
}
if (pid->type == PTCACHE_TYPE_CLOTH) {
- return 9 * sizeof(float);
+ return sizeof(float[9]);
}
return 0;
diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c
index 55de375ce1e..afec9b835a5 100644
--- a/source/blender/blenkernel/intern/seqeffects.c
+++ b/source/blender/blenkernel/intern/seqeffects.c
@@ -303,10 +303,10 @@ static void do_alphaover_effect_float(
mfac = 1.0f - (fac2 * rt1[3]);
if (fac <= 0.0f) {
- memcpy(rt, rt2, 4 * sizeof(float));
+ memcpy(rt, rt2, sizeof(float[4]));
}
else if (mfac <= 0) {
- memcpy(rt, rt1, 4 * sizeof(float));
+ memcpy(rt, rt1, sizeof(float[4]));
}
else {
rt[0] = fac * rt1[0] + mfac * rt2[0];
@@ -330,10 +330,10 @@ static void do_alphaover_effect_float(
mfac = 1.0f - (fac4 * rt1[3]);
if (fac <= 0.0f) {
- memcpy(rt, rt2, 4 * sizeof(float));
+ memcpy(rt, rt2, sizeof(float[4]));
}
else if (mfac <= 0.0f) {
- memcpy(rt, rt1, 4 * sizeof(float));
+ memcpy(rt, rt1, sizeof(float[4]));
}
else {
rt[0] = fac * rt1[0] + mfac * rt2[0];
@@ -499,16 +499,16 @@ static void do_alphaunder_effect_float(
* 'skybuf' can be crossed in
*/
if (rt2[3] <= 0 && fac2 >= 1.0f) {
- memcpy(rt, rt1, 4 * sizeof(float));
+ memcpy(rt, rt1, sizeof(float[4]));
}
else if (rt2[3] >= 1.0f) {
- memcpy(rt, rt2, 4 * sizeof(float));
+ memcpy(rt, rt2, sizeof(float[4]));
}
else {
fac = fac2 * (1.0f - rt2[3]);
if (fac == 0) {
- memcpy(rt, rt2, 4 * sizeof(float));
+ memcpy(rt, rt2, sizeof(float[4]));
}
else {
rt[0] = fac * rt1[0] + rt2[0];
@@ -530,16 +530,16 @@ static void do_alphaunder_effect_float(
x = xo;
while (x--) {
if (rt2[3] <= 0 && fac4 >= 1.0f) {
- memcpy(rt, rt1, 4 * sizeof(float));
+ memcpy(rt, rt1, sizeof(float[4]));
}
else if (rt2[3] >= 1.0f) {
- memcpy(rt, rt2, 4 * sizeof(float));
+ memcpy(rt, rt2, sizeof(float[4]));
}
else {
fac = fac4 * (1.0f - rt2[3]);
if (fac == 0) {
- memcpy(rt, rt2, 4 * sizeof(float));
+ memcpy(rt, rt2, sizeof(float[4]));
}
else {
rt[0] = fac * rt1[0] + rt2[0];
@@ -2522,7 +2522,7 @@ static void RVBlurBitmap2_float(float *map, int width, int height, float blur, i
}
/* Allocate memory for the tempmap and the blur filter matrix */
- temp = MEM_mallocN((width * height * 4 * sizeof(float)), "blurbitmaptemp");
+ temp = MEM_mallocN(sizeof(float[4]) * width * height, "blurbitmaptemp");
if (!temp) {
return;
}
@@ -2746,8 +2746,8 @@ static void do_glow_effect_byte(Sequence *seq,
float *outbuf, *inbuf;
GlowVars *glow = (GlowVars *)seq->effectdata;
- inbuf = MEM_mallocN(4 * sizeof(float) * x * y, "glow effect input");
- outbuf = MEM_mallocN(4 * sizeof(float) * x * y, "glow effect output");
+ inbuf = MEM_mallocN(sizeof(float[4]) * x * y, "glow effect input");
+ outbuf = MEM_mallocN(sizeof(float[4]) * x * y, "glow effect output");
IMB_buffer_float_from_byte(inbuf, rect1, IB_PROFILE_SRGB, IB_PROFILE_SRGB, false, x, y, x, x);
IMB_buffer_float_premultiply(inbuf, x, y);
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 6cdebcab904..dbcb83b8402 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -3622,7 +3622,7 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context,
ibufs_arr[view_id] = IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rectfloat);
memcpy(ibufs_arr[view_id]->rect_float,
rres.rectf,
- 4 * sizeof(float) * rres.rectx * rres.recty);
+ sizeof(float[4]) * rres.rectx * rres.recty);
if (rres.rectz) {
addzbuffloatImBuf(ibufs_arr[view_id]);
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index d38b70a33c8..1ab9766a7ec 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -3280,8 +3280,8 @@ void SB_estimate_transform(Object *ob, float lloc[3], float lrot[3][3], float ls
if (!sb || !sb->bpoint) {
return;
}
- opos = MEM_callocN((sb->totpoint) * 3 * sizeof(float), "SB_OPOS");
- rpos = MEM_callocN((sb->totpoint) * 3 * sizeof(float), "SB_RPOS");
+ opos = MEM_callocN(sizeof(float[3]) * sb->totpoint, "SB_OPOS");
+ rpos = MEM_callocN(sizeof(float[3]) * sb->totpoint, "SB_RPOS");
/* might filter vertex selection with a vertex group */
for (a = 0, bp = sb->bpoint, rp = sb->scratch->Ref.ivert; a < sb->totpoint; a++, bp++, rp++) {
copy_v3_v3(rpos[a], rp->pos);
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index 060174c94a5..b72c5e99b43 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -957,7 +957,7 @@ void BKE_sound_read_waveform(Main *bmain, bSound *sound, short *stop)
if (info.length > 0) {
int length = info.length * SOUND_WAVE_SAMPLES_PER_SECOND;
- waveform->data = MEM_mallocN(length * sizeof(float) * 3, "SoundWaveform.samples");
+ waveform->data = MEM_mallocN(sizeof(float[3]) * length, "SoundWaveform.samples");
waveform->length = AUD_readSound(
sound->playback_handle, waveform->data, length, SOUND_WAVE_SAMPLES_PER_SECOND, stop);
}
diff --git a/source/blender/blenkernel/intern/studiolight.c b/source/blender/blenkernel/intern/studiolight.c
index 68626bdc8dd..10830a3d4ba 100644
--- a/source/blender/blenkernel/intern/studiolight.c
+++ b/source/blender/blenkernel/intern/studiolight.c
@@ -693,7 +693,7 @@ static void studiolight_calculate_cubemap_vector_weight(
static void studiolight_spherical_harmonics_calculate_coefficients(StudioLight *sl, float (*sh)[3])
{
float weight_accum = 0.0f;
- memset(sh, 0, sizeof(float) * 3 * STUDIOLIGHT_SH_COEFS_LEN);
+ memset(sh, 0, sizeof(float[3]) * STUDIOLIGHT_SH_COEFS_LEN);
for (int face = 0; face < 6; face++) {
ITER_PIXELS (float,
diff --git a/source/blender/blenkernel/intern/subdiv_ccg.c b/source/blender/blenkernel/intern/subdiv_ccg.c
index c992990e0a0..86c57491393 100644
--- a/source/blender/blenkernel/intern/subdiv_ccg.c
+++ b/source/blender/blenkernel/intern/subdiv_ccg.c
@@ -85,7 +85,7 @@ static int element_size_bytes_get(const SubdivCCG *subdiv_ccg)
static void subdiv_ccg_init_layers(SubdivCCG *subdiv_ccg, const SubdivToCCGSettings *settings)
{
/* CCG always contains coordinates. Rest of layers are coming after them. */
- int layer_offset = sizeof(float) * 3;
+ int layer_offset = sizeof(float[3]);
/* Mask. */
if (settings->need_mask) {
subdiv_ccg->has_mask = true;
@@ -103,7 +103,7 @@ static void subdiv_ccg_init_layers(SubdivCCG *subdiv_ccg, const SubdivToCCGSetti
if (settings->need_normal) {
subdiv_ccg->has_normal = true;
subdiv_ccg->normal_offset = layer_offset;
- layer_offset += sizeof(float) * 3;
+ layer_offset += sizeof(float[3]);
}
else {
subdiv_ccg->has_normal = false;
@@ -709,7 +709,7 @@ static void subdiv_ccg_recalc_inner_face_normals(SubdivCCG *subdiv_ccg,
CCGElem *grid = subdiv_ccg->grids[grid_index];
if (tls->face_normals == NULL) {
tls->face_normals = MEM_malloc_arrayN(
- grid_size_1 * grid_size_1, 3 * sizeof(float), "CCG TLS normals");
+ grid_size_1 * grid_size_1, sizeof(float[3]), "CCG TLS normals");
}
for (int y = 0; y < grid_size - 1; y++) {
for (int x = 0; x < grid_size - 1; x++) {
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index 98386a3356a..45dca79342e 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -150,7 +150,7 @@ static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels, int numLaye
ifc.vertDataSize = sizeof(float) * numLayers;
normalOffset += sizeof(float) * numLayers;
if (flags & CCG_CALC_NORMALS) {
- ifc.vertDataSize += sizeof(float) * 3;
+ ifc.vertDataSize += sizeof(float[3]);
}
if (flags & CCG_ALLOC_MASK) {
ifc.vertDataSize += sizeof(float);
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c
index 8a1ebaf722b..7c34562e119 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -2823,7 +2823,7 @@ static void tracking_dopesheet_channels_segments_calc(MovieTrackingDopesheetChan
return;
}
- channel->segments = MEM_callocN(2 * sizeof(int) * channel->tot_segment,
+ channel->segments = MEM_callocN(sizeof(int[2]) * channel->tot_segment,
"tracking channel segments");
/* create segments */