Cleanup: use array syntax for sizeof with fixed values

Also order sizeof(..) first to promote other values to size_t.
This commit is contained in:
Campbell Barton 2020-08-08 13:29:21 +10:00
parent 4bf3ca2016
commit 171e77c3c2
129 changed files with 344 additions and 348 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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 */

View File

@ -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++;

View File

@ -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;

View File

@ -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);

View File

@ -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 */

View File

@ -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;

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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;
}

View File

@ -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),
};

View File

@ -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;
}

View File

@ -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);

View File

@ -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) */

View File

@ -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]);

View File

@ -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);

View File

@ -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;

View File

@ -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 */

View File

@ -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);
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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);
}

View File

@ -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);

View File

@ -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]));
}
}

View File

@ -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);

View File

@ -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 */

View File

@ -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;
}

View File

@ -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;

View File

@ -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);

View File

@ -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]);

View File

@ -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);

View File

@ -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);
}

View File

@ -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,

View File

@ -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++) {

View File

@ -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);

View File

@ -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 */

View File

@ -55,7 +55,7 @@ uint BLI_ghashutil_ptrhash(const void *key)
/* Note: Unlike Python 'sizeof(uint)' is used instead of 'sizeof(void *)',
* Otherwise casting to 'uint' ignores the upper bits on 64bit platforms. */
return (uint)(y >> 4) | ((uint)y << (8 * sizeof(uint) - 4));
return (uint)(y >> 4) | ((uint)y << (sizeof(uint[8]) - 4));
}
#endif
bool BLI_ghashutil_ptrcmp(const void *a, const void *b)
@ -78,7 +78,7 @@ uint BLI_ghashutil_uinthash_v4(const uint key[4])
uint BLI_ghashutil_uinthash_v4_murmur(const uint key[4])
{
return BLI_hash_mm2((const unsigned char *)key, sizeof(int) * 4 /* sizeof(key) */, 0);
return BLI_hash_mm2((const unsigned char *)key, sizeof(int[4]) /* sizeof(key) */, 0);
}
bool BLI_ghashutil_uinthash_v4_cmp(const void *a, const void *b)

View File

@ -309,8 +309,8 @@ void BLI_box_pack_2d(BoxPack *boxarray, const uint len, float *r_tot_x, float *r
qsort(boxarray, (size_t)len, sizeof(BoxPack), box_areasort);
/* add verts to the boxes, these are only used internally */
vert = MEM_mallocN((size_t)len * 4 * sizeof(BoxVert), "BoxPack Verts");
vertex_pack_indices = MEM_mallocN((size_t)len * 3 * sizeof(int), "BoxPack Indices");
vert = MEM_mallocN(sizeof(BoxVert[4]) * (size_t)len, "BoxPack Verts");
vertex_pack_indices = MEM_mallocN(sizeof(int[3]) * (size_t)len, "BoxPack Indices");
vs_ctx.vertarray = vert;

View File

@ -2234,16 +2234,15 @@ static const CDT_input *modify_input_for_near_edge_ends(const CDT_input *input,
new_input->epsilon = input->epsilon;
new_input->verts_len = input->verts_len;
new_input->vert_coords = (float(*)[2])MEM_malloc_arrayN(
new_input->verts_len, 2 * sizeof(float), __func__);
new_input->verts_len, sizeof(float[2]), __func__);
/* We don't do it now, but may decide to change coords of snapped verts. */
memmove(new_input->vert_coords,
input->vert_coords,
(size_t)new_input->verts_len * sizeof(float) * 2);
sizeof(float[2]) * (size_t)new_input->verts_len);
if (edges_len > 0) {
new_input->edges_len = new_tot_con_edges;
new_input->edges = (int(*)[2])MEM_malloc_arrayN(
new_tot_con_edges, 2 * sizeof(int), __func__);
new_input->edges = (int(*)[2])MEM_malloc_arrayN(new_tot_con_edges, sizeof(int[2]), __func__);
}
if (input->faces_len > 0) {

View File

@ -62,12 +62,12 @@ MINLINE float area_squared_tri_v2(const float v1[2], const float v2[2], const fl
MINLINE void zero_sh(float r[9])
{
memset(r, 0, sizeof(float) * 9);
memset(r, 0, sizeof(float[9]));
}
MINLINE void copy_sh_sh(float r[9], const float a[9])
{
memcpy(r, a, sizeof(float) * 9);
memcpy(r, a, sizeof(float[9]));
}
MINLINE void mul_sh_fl(float r[9], const float f)

View File

@ -183,7 +183,7 @@ size_t BLI_system_memory_max_in_megabytes(void)
/* Maximum addressable bytes on this platform.
*
* NOTE: Due to the shift arithmetic this is a half of the memory. */
const size_t limit_bytes_half = (((size_t)1) << ((sizeof(size_t) * 8) - 1));
const size_t limit_bytes_half = (((size_t)1) << ((sizeof(size_t[8])) - 1));
/* Convert it to megabytes and return. */
return (limit_bytes_half >> 20) * 2;
}

View File

@ -1134,7 +1134,7 @@ static int *read_file_thumbnail(FileData *fd)
const bool do_endian_swap = (fd->flags & FD_FLAGS_SWITCH_ENDIAN) != 0;
int *data = (int *)(bhead + 1);
if (bhead->len < (2 * sizeof(int))) {
if (bhead->len < (sizeof(int[2]))) {
break;
}

View File

@ -3342,7 +3342,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
if (sl->spacetype == SPACE_VIEW3D) {
View3D *v3d = (View3D *)sl;
memcpy(v3d->shading.lookdev_light, v3d->shading.studio_light, sizeof(char) * 256);
memcpy(v3d->shading.lookdev_light, v3d->shading.studio_light, sizeof(char[256]));
}
}
}

View File

@ -102,7 +102,7 @@ static void vcol_to_fcol(Mesh *me)
return;
}
mcoln = mcolmain = MEM_malloc_arrayN(me->totface, 4 * sizeof(int), "mcoln");
mcoln = mcolmain = MEM_malloc_arrayN(me->totface, sizeof(int[4]), "mcoln");
mcol = (uint *)me->mcol;
mface = me->mface;
for (a = me->totface; a > 0; a--, mface++) {

View File

@ -4603,7 +4603,7 @@ void BLO_write_pointer_array(BlendWriter *writer, int size, const void *data_ptr
void BLO_write_float3_array(BlendWriter *writer, int size, const float *data_ptr)
{
BLO_write_raw(writer, sizeof(float) * 3 * size, data_ptr);
BLO_write_raw(writer, sizeof(float[3]) * size, data_ptr);
}
/**

View File

@ -182,7 +182,7 @@ BMEdge *BM_edge_create(
e->v2 = v2;
e->l = NULL;
memset(&e->v1_disk_link, 0, sizeof(BMDiskLink) * 2);
memset(&e->v1_disk_link, 0, sizeof(BMDiskLink[2]));
/* --- done --- */
bmesh_disk_edge_append(e, e->v1);

View File

@ -535,7 +535,7 @@ void BM_loop_interp_multires_ex(BMesh *UNUSED(bm),
md_dst->totdisp = md_src->totdisp;
md_dst->level = md_src->level;
if (md_dst->totdisp) {
md_dst->disps = MEM_callocN(sizeof(float) * 3 * md_dst->totdisp, __func__);
md_dst->disps = MEM_callocN(sizeof(float[3]) * md_dst->totdisp, __func__);
}
else {
return;

View File

@ -860,7 +860,7 @@ void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, const struct BMeshToMesh
if (act_is_basis) {
const float(*fp)[3] = actkey->data;
ofs = MEM_callocN(sizeof(float) * 3 * bm->totvert, "currkey->data");
ofs = MEM_callocN(sizeof(float[3]) * bm->totvert, "currkey->data");
mvert = me->mvert;
BM_ITER_MESH_INDEX (eve, &iter, bm, BM_VERTS_OF_MESH, i) {
const int keyi = BM_ELEM_CD_GET_INT(eve, cd_shape_keyindex_offset);

View File

@ -55,17 +55,17 @@ BLI_STATIC_ASSERT(ARRAY_SIZE(bmo_error_messages) == BMERR_TOTAL, "message mismat
/* operator slot type information - size of one element of the type given. */
const int BMO_OPSLOT_TYPEINFO[BMO_OP_SLOT_TOTAL_TYPES] = {
0, /* 0: BMO_OP_SLOT_SENTINEL */
sizeof(int), /* 1: BMO_OP_SLOT_BOOL */
sizeof(int), /* 2: BMO_OP_SLOT_INT */
sizeof(float), /* 3: BMO_OP_SLOT_FLT */
sizeof(void *), /* 4: BMO_OP_SLOT_PNT */
sizeof(void *), /* 5: BMO_OP_SLOT_PNT */
0, /* 6: unused */
0, /* 7: unused */
sizeof(float) * 3, /* 8: BMO_OP_SLOT_VEC */
sizeof(void *), /* 9: BMO_OP_SLOT_ELEMENT_BUF */
sizeof(void *), /* 10: BMO_OP_SLOT_MAPPING */
0, /* 0: BMO_OP_SLOT_SENTINEL */
sizeof(int), /* 1: BMO_OP_SLOT_BOOL */
sizeof(int), /* 2: BMO_OP_SLOT_INT */
sizeof(float), /* 3: BMO_OP_SLOT_FLT */
sizeof(void *), /* 4: BMO_OP_SLOT_PNT */
sizeof(void *), /* 5: BMO_OP_SLOT_PNT */
0, /* 6: unused */
0, /* 7: unused */
sizeof(float[3]), /* 8: BMO_OP_SLOT_VEC */
sizeof(void *), /* 9: BMO_OP_SLOT_ELEMENT_BUF */
sizeof(void *), /* 10: BMO_OP_SLOT_MAPPING */
};
/* Dummy slot so there is something to return when slot name lookup fails */
@ -418,7 +418,7 @@ void BMO_slot_mat_set(BMOperator *op,
}
slot->len = 4;
slot->data.p = BLI_memarena_alloc(op->arena, sizeof(float) * 4 * 4);
slot->data.p = BLI_memarena_alloc(op->arena, sizeof(float[4][4]));
if (size == 4) {
copy_m4_m4(slot->data.p, (float(*)[4])mat);

View File

@ -115,7 +115,7 @@ static LaplacianSystem *init_laplacian_system(int a_numEdges, int a_numFaces, in
return NULL;
}
sys->fweights = MEM_callocN(sizeof(float) * 3 * sys->numFaces, "ModLaplSmoothFWeight");
sys->fweights = MEM_callocN(sizeof(float[3]) * sys->numFaces, "ModLaplSmoothFWeight");
if (!sys->fweights) {
delete_laplacian_system(sys);
return NULL;

View File

@ -1968,10 +1968,10 @@ static void calculate_profile(BevelParams *bp, BoundVert *bndv, bool reversed, b
bool need_2 = bp->seg != bp->pro_spacing.seg_2;
if (pro->prof_co == NULL) {
pro->prof_co = (float *)BLI_memarena_alloc(bp->mem_arena, sizeof(float) * 3 * (bp->seg + 1));
pro->prof_co = (float *)BLI_memarena_alloc(bp->mem_arena, sizeof(float[3]) * (bp->seg + 1));
if (need_2) {
pro->prof_co_2 = (float *)BLI_memarena_alloc(
bp->mem_arena, sizeof(float) * 3 * (bp->pro_spacing.seg_2 + 1));
pro->prof_co_2 = (float *)BLI_memarena_alloc(bp->mem_arena,
sizeof(float[3]) * (bp->pro_spacing.seg_2 + 1));
}
else {
pro->prof_co_2 = pro->prof_co;

View File

@ -65,11 +65,11 @@ void CompositorOperation::initExecution()
this->m_depthInput = getInputSocketReader(2);
if (this->getWidth() * this->getHeight() != 0) {
this->m_outputBuffer = (float *)MEM_callocN(
this->getWidth() * this->getHeight() * 4 * sizeof(float), "CompositorOperation");
sizeof(float[4]) * this->getWidth() * this->getHeight(), "CompositorOperation");
}
if (this->m_depthInput != NULL) {
this->m_depthBuffer = (float *)MEM_callocN(
this->getWidth() * this->getHeight() * sizeof(float), "CompositorOperation");
sizeof(float) * this->getWidth() * this->getHeight(), "CompositorOperation");
}
}

View File

@ -105,7 +105,7 @@ void DenoiseOperation::generateDenoise(float *data,
inputTileColor->getWidth(),
inputTileColor->getHeight(),
0,
4 * sizeof(float));
sizeof(float[4]));
if (inputTileNormal && inputTileNormal->getBuffer()) {
filter.setImage("normal",
inputTileNormal->getBuffer(),
@ -113,7 +113,7 @@ void DenoiseOperation::generateDenoise(float *data,
inputTileNormal->getWidth(),
inputTileNormal->getHeight(),
0,
3 * sizeof(float));
sizeof(float[3]));
}
if (inputTileAlbedo && inputTileAlbedo->getBuffer()) {
filter.setImage("albedo",
@ -122,7 +122,7 @@ void DenoiseOperation::generateDenoise(float *data,
inputTileAlbedo->getWidth(),
inputTileAlbedo->getHeight(),
0,
4 * sizeof(float));
sizeof(float[4]));
}
filter.setImage("output",
data,
@ -130,7 +130,7 @@ void DenoiseOperation::generateDenoise(float *data,
inputTileColor->getWidth(),
inputTileColor->getHeight(),
0,
4 * sizeof(float));
sizeof(float[4]));
BLI_assert(settings);
if (settings) {
@ -158,5 +158,5 @@ void DenoiseOperation::generateDenoise(float *data,
UNUSED_VARS(inputTileAlbedo, inputTileNormal, settings);
::memcpy(data,
inputBufferColor,
inputTileColor->getWidth() * inputTileColor->getHeight() * sizeof(float) * 4);
sizeof(float[4]) * inputTileColor->getWidth() * inputTileColor->getHeight());
}

View File

@ -595,7 +595,7 @@ void zbuf_accumulate_vecblur(NodeBlurData *nbd,
float minspeed = (float)nbd->minspeed;
float minspeedsq = minspeed * minspeed;
minvecbufrect = (float *)MEM_callocN(4 * sizeof(float) * xsize * ysize, "minspeed buf");
minvecbufrect = (float *)MEM_callocN(sizeof(float[4]) * xsize * ysize, "minspeed buf");
dvec1 = vecbufrect;
dvec2 = minvecbufrect;
@ -621,7 +621,7 @@ void zbuf_accumulate_vecblur(NodeBlurData *nbd,
}
/* make vertex buffer with averaged speed and zvalues */
rectvz = (float *)MEM_callocN(4 * sizeof(float) * (xsize + 1) * (ysize + 1), "vertices");
rectvz = (float *)MEM_callocN(sizeof(float[4]) * (xsize + 1) * (ysize + 1), "vertices");
dvz = rectvz;
for (y = 0; y <= ysize; y++) {

View File

@ -81,10 +81,10 @@ static void workbench_dof_setup_samples(struct GPUUniformBuffer **ubo,
float bokeh_ratio)
{
if (*data == NULL) {
*data = MEM_callocN(sizeof(float) * 4 * SAMP_LEN, "workbench dof samples");
*data = MEM_callocN(sizeof(float[4]) * SAMP_LEN, "workbench dof samples");
}
if (*ubo == NULL) {
*ubo = DRW_uniformbuffer_create(sizeof(float) * 4 * SAMP_LEN, NULL);
*ubo = DRW_uniformbuffer_create(sizeof(float[4]) * SAMP_LEN, NULL);
}
float *samp = *data;

View File

@ -2426,7 +2426,7 @@ static float x_axis_name[4][2] = {
{-0.9f * S_X, 1.0f * S_Y},
{1.0f * S_X, -1.0f * S_Y},
};
#define X_LEN (sizeof(x_axis_name) / (sizeof(float) * 2))
#define X_LEN (sizeof(x_axis_name) / (sizeof(float[2])))
#undef S_X
#undef S_Y
@ -2440,7 +2440,7 @@ static float y_axis_name[6][2] = {
{0.0f * S_X, -0.1f * S_Y},
{0.0f * S_X, -1.0f * S_Y},
};
#define Y_LEN (sizeof(y_axis_name) / (sizeof(float) * 2))
#define Y_LEN (sizeof(y_axis_name) / (sizeof(float[2])))
#undef S_X
#undef S_Y
@ -2458,7 +2458,7 @@ static float z_axis_name[10][2] = {
{-1.00f * S_X, -1.00f * S_Y},
{1.00f * S_X, -1.00f * S_Y},
};
#define Z_LEN (sizeof(z_axis_name) / (sizeof(float) * 2))
#define Z_LEN (sizeof(z_axis_name) / (sizeof(float[2])))
#undef S_X
#undef S_Y
@ -2485,7 +2485,7 @@ static float axis_marker[8][2] = {
{-S_X, 0.f}
#endif
};
#define MARKER_LEN (sizeof(axis_marker) / (sizeof(float) * 2))
#define MARKER_LEN (sizeof(axis_marker) / (sizeof(float[2])))
#define MARKER_FILL_LAYER 6
#undef S_X
#undef S_Y

View File

@ -444,7 +444,7 @@ static void displist_surf_fnors_ensure(const DispList *dl, float (**fnors)[3])
int u_len = dl->nr - ((dl->flag & DL_CYCL_U) ? 0 : 1);
int v_len = dl->parts - ((dl->flag & DL_CYCL_V) ? 0 : 1);
const float(*verts)[3] = (float(*)[3])dl->verts;
float(*nor_flat)[3] = MEM_mallocN(sizeof(float) * 3 * u_len * v_len, __func__);
float(*nor_flat)[3] = MEM_mallocN(sizeof(float[3]) * u_len * v_len, __func__);
*fnors = nor_flat;
SURFACE_QUAD_ITER_BEGIN (dl) {

View File

@ -106,7 +106,7 @@ static void create_color_ramp(const struct ColorBand *coba, float *data)
static GPUTexture *create_transfer_function(int type, const struct ColorBand *coba)
{
float *data = (float *)MEM_mallocN(sizeof(float) * 4 * TFUNC_WIDTH, __func__);
float *data = (float *)MEM_mallocN(sizeof(float[4]) * TFUNC_WIDTH, __func__);
switch (type) {
case TFUNC_FLAME_SPECTRUM:

View File

@ -330,7 +330,7 @@ void DRW_hair_update(void)
GPU_ATTACHMENT_TEXTURE(tex),
});
float *data = MEM_mallocN(sizeof(float) * 4 * width * height, "tf fallback buffer");
float *data = MEM_mallocN(sizeof(float[4]) * width * height, "tf fallback buffer");
GPU_framebuffer_bind(fb);
while (g_tf_calls != NULL) {
@ -347,8 +347,8 @@ void DRW_hair_update(void)
/* Upload back to VBO. */
GPU_vertbuf_use(pr_call->vbo);
glBufferSubData(GL_ARRAY_BUFFER,
sizeof(float) * 4 * g_tf_id_offset,
sizeof(float) * 4 * max_read_px_len,
sizeof(float[4]) * g_tf_id_offset,
sizeof(float[4]) * max_read_px_len,
data);
g_tf_id_offset += max_read_px_len;

View File

@ -1866,7 +1866,7 @@ void DRW_view_clip_planes_set(DRWView *view, float (*planes)[4], int plane_len)
BLI_assert(plane_len <= MAX_CLIP_PLANES);
view->clip_planes_len = plane_len;
if (plane_len > 0) {
memcpy(view->storage.clipplanes, planes, sizeof(float) * 4 * plane_len);
memcpy(view->storage.clipplanes, planes, sizeof(float[4]) * plane_len);
}
}

View File

@ -592,7 +592,7 @@ void DRW_culling_frustum_corners_get(const DRWView *view, BoundBox *corners)
void DRW_culling_frustum_planes_get(const DRWView *view, float planes[6][4])
{
view = view ? view : DST.view_default;
memcpy(planes, view->frustum_planes, sizeof(float) * 6 * 4);
memcpy(planes, view->frustum_planes, sizeof(float[6][4]));
}
static void draw_compute_culling(DRWView *view)

View File

@ -398,9 +398,9 @@ static float normalization_factor_get(Scene *scene, FCurve *fcu, short flag, flo
correct_bezpart(v1, v2, v3, v4);
BKE_curve_forward_diff_bezier(
v1[0], v2[0], v3[0], v4[0], data, resol, sizeof(float) * 3);
v1[0], v2[0], v3[0], v4[0], data, resol, sizeof(float[3]));
BKE_curve_forward_diff_bezier(
v1[1], v2[1], v3[1], v4[1], data + 1, resol, sizeof(float) * 3);
v1[1], v2[1], v3[1], v4[1], data + 1, resol, sizeof(float[3]));
for (int j = 0; j <= resol; ++j) {
const float *fp = &data[j * 3];

View File

@ -342,9 +342,9 @@ static void add_verts_to_dgroups(ReportList *reports,
/* create an array of root and tip positions transformed into
* global coords */
root = MEM_callocN(numbones * sizeof(float) * 3, "root");
tip = MEM_callocN(numbones * sizeof(float) * 3, "tip");
selected = MEM_callocN(numbones * sizeof(int), "selected");
root = MEM_callocN(sizeof(float[3]) * numbones, "root");
tip = MEM_callocN(sizeof(float[3]) * numbones, "tip");
selected = MEM_callocN(sizeof(int) * numbones, "selected");
for (j = 0; j < numbones; j++) {
bone = bonelist[j];

View File

@ -223,7 +223,7 @@ static LaplacianSystem *laplacian_system_construct_begin(int totvert, int totfac
sys->verts = MEM_callocN(sizeof(float *) * totvert, "LaplacianSystemVerts");
sys->vpinned = MEM_callocN(sizeof(char) * totvert, "LaplacianSystemVpinned");
sys->faces = MEM_callocN(sizeof(int) * 3 * totface, "LaplacianSystemFaces");
sys->faces = MEM_callocN(sizeof(int[3]) * totface, "LaplacianSystemFaces");
sys->totvert = 0;
sys->totface = 0;
@ -296,7 +296,7 @@ static void laplacian_system_construct_end(LaplacianSystem *sys)
}
if (sys->storeweights) {
sys->fweights = MEM_callocN(sizeof(float) * 3 * totface, "LaplacianFWeight");
sys->fweights = MEM_callocN(sizeof(float[3]) * totface, "LaplacianFWeight");
}
for (a = 0, face = sys->faces; a < totface; a++, face++) {
@ -568,7 +568,7 @@ static void heat_calc_vnormals(LaplacianSystem *sys)
float fnor[3];
int a, v1, v2, v3, (*face)[3];
sys->heat.vnors = MEM_callocN(sizeof(float) * 3 * sys->totvert, "HeatVNors");
sys->heat.vnors = MEM_callocN(sizeof(float[3]) * sys->totvert, "HeatVNors");
for (a = 0, face = sys->faces; a < sys->totface; a++, face++) {
v1 = (*face)[0];
@ -1762,7 +1762,7 @@ void ED_mesh_deform_bind_callback(MeshDeformModifierData *mmd,
memset(&mdb, 0, sizeof(MeshDeformBind));
/* get mesh and cage mesh */
mdb.vertexcos = MEM_callocN(sizeof(float) * 3 * totvert, "MeshDeformCos");
mdb.vertexcos = MEM_callocN(sizeof(float[3]) * totvert, "MeshDeformCos");
mdb.totvert = totvert;
mdb.cagemesh = cagemesh;

View File

@ -569,14 +569,14 @@ GHash *ED_curve_keyindex_hash_duplicate(GHash *keyindex)
static void key_to_bezt(float *key, BezTriple *basebezt, BezTriple *bezt)
{
memcpy(bezt, basebezt, sizeof(BezTriple));
memcpy(bezt->vec, key, sizeof(float) * 9);
memcpy(bezt->vec, key, sizeof(float[9]));
bezt->tilt = key[9];
bezt->radius = key[10];
}
static void bezt_to_key(BezTriple *bezt, float *key)
{
memcpy(key, bezt->vec, sizeof(float) * 9);
memcpy(key, bezt->vec, sizeof(float[9]));
key[9] = bezt->tilt;
key[10] = bezt->radius;
}
@ -691,7 +691,7 @@ static void calc_shapeKeys(Object *obedit, ListBase *newnurbs)
nu = nu->next;
}
ofs = MEM_callocN(sizeof(float) * 3 * totvec, "currkey->data");
ofs = MEM_callocN(sizeof(float[3]) * totvec, "currkey->data");
nu = editnurb->nurbs.first;
i = 0;
while (nu) {
@ -3498,7 +3498,7 @@ static void subdividenurb(Object *obedit, View3D *v3d, int number_cuts)
BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, nextbezt)) {
float prevvec[3][3];
memcpy(prevvec, bezt->vec, sizeof(float) * 9);
memcpy(prevvec, bezt->vec, sizeof(float[9]));
for (i = 0; i < number_cuts; i++) {
factor = 1.0f / (number_cuts + 1 - i);
@ -3530,7 +3530,7 @@ static void subdividenurb(Object *obedit, View3D *v3d, int number_cuts)
beztn->radius = (bezt->radius + nextbezt->radius) / 2;
beztn->weight = (bezt->weight + nextbezt->weight) / 2;
memcpy(prevvec, beztn->vec, sizeof(float) * 9);
memcpy(prevvec, beztn->vec, sizeof(float[9]));
beztn++;
}
}

View File

@ -153,7 +153,7 @@ Nurb *ED_curve_add_nurbs_primitive(
nu->resolu = cu->resolu;
if (cutype == CU_BEZIER) {
nu->pntsu = 2;
nu->bezt = (BezTriple *)MEM_callocN(2 * sizeof(BezTriple), "addNurbprim1");
nu->bezt = (BezTriple *)MEM_callocN(sizeof(BezTriple) * nu->pntsu, "addNurbprim1");
bezt = nu->bezt;
bezt->h1 = bezt->h2 = HD_ALIGN;
bezt->f1 = bezt->f2 = bezt->f3 = SELECT;
@ -190,7 +190,7 @@ Nurb *ED_curve_add_nurbs_primitive(
nu->pntsu = 4;
nu->pntsv = 1;
nu->orderu = 4;
nu->bp = (BPoint *)MEM_callocN(sizeof(BPoint) * 4, "addNurbprim3");
nu->bp = (BPoint *)MEM_callocN(sizeof(BPoint) * nu->pntsu, "addNurbprim3");
bp = nu->bp;
for (a = 0; a < 4; a++, bp++) {
@ -227,7 +227,7 @@ Nurb *ED_curve_add_nurbs_primitive(
nu->orderu = 5;
nu->flagu = CU_NURB_ENDPOINT; /* endpoint */
nu->resolu = cu->resolu;
nu->bp = (BPoint *)MEM_callocN(sizeof(BPoint) * 5, "addNurbprim3");
nu->bp = (BPoint *)MEM_callocN(sizeof(BPoint) * nu->pntsu, "addNurbprim3");
bp = nu->bp;
for (a = 0; a < 5; a++, bp++) {
@ -262,7 +262,7 @@ Nurb *ED_curve_add_nurbs_primitive(
if (cutype == CU_BEZIER) {
nu->pntsu = 4;
nu->bezt = (BezTriple *)MEM_callocN(sizeof(BezTriple) * 4, "addNurbprim1");
nu->bezt = (BezTriple *)MEM_callocN(sizeof(BezTriple) * nu->pntsu, "addNurbprim1");
nu->flagu = CU_NURB_CYCLIC;
bezt = nu->bezt;
@ -307,7 +307,7 @@ Nurb *ED_curve_add_nurbs_primitive(
nu->pntsu = 8;
nu->pntsv = 1;
nu->orderu = 4;
nu->bp = (BPoint *)MEM_callocN(sizeof(BPoint) * 8, "addNurbprim6");
nu->bp = (BPoint *)MEM_callocN(sizeof(BPoint) * nu->pntsu, "addNurbprim6");
nu->flagu = CU_NURB_CYCLIC;
bp = nu->bp;
@ -406,7 +406,7 @@ Nurb *ED_curve_add_nurbs_primitive(
nu->resolu = cu->resolu;
nu->resolv = cu->resolv;
nu->flag = CU_SMOOTH;
nu->bp = (BPoint *)MEM_callocN(sizeof(BPoint) * 5, "addNurbprim6");
nu->bp = (BPoint *)MEM_callocN(sizeof(BPoint) * nu->pntsu, "addNurbprim6");
nu->flagu = 0;
bp = nu->bp;

View File

@ -308,10 +308,10 @@ static void gpencil_add_verts_to_dgroups(
/* create an array of root and tip positions transformed into
* global coords */
root = MEM_callocN(numbones * sizeof(float) * 3, "root");
tip = MEM_callocN(numbones * sizeof(float) * 3, "tip");
selected = MEM_callocN(numbones * sizeof(int), "selected");
radsqr = MEM_callocN(numbones * sizeof(float), "radsqr");
root = MEM_callocN(sizeof(float[3]) * numbones, "root");
tip = MEM_callocN(sizeof(float[3]) * numbones, "tip");
selected = MEM_callocN(sizeof(int) * numbones, "selected");
radsqr = MEM_callocN(sizeof(float) * numbones, "radsqr");
for (j = 0; j < numbones; j++) {
bone = bonelist[j];

View File

@ -2980,7 +2980,7 @@ bool ED_gpencil_stroke_point_is_inside(bGPDstroke *gps,
int(*mcoords)[2] = NULL;
int len = gps->totpoints;
mcoords = MEM_mallocN(sizeof(int) * 2 * len, __func__);
mcoords = MEM_mallocN(sizeof(int[2]) * len, __func__);
/* Convert stroke to 2D array of points. */
bGPDspoint *pt;

View File

@ -182,7 +182,7 @@ static bool gpencil_uv_transform_init(bContext *C, wmOperator *op)
if (i > 0) {
mul_v3_fl(center, 1.0f / i);
/* Create arrays to save all transformations. */
opdata->array_loc = MEM_calloc_arrayN(i, 2 * sizeof(float), __func__);
opdata->array_loc = MEM_calloc_arrayN(i, sizeof(float[2]), __func__);
opdata->array_rot = MEM_calloc_arrayN(i, sizeof(float), __func__);
opdata->array_scale = MEM_calloc_arrayN(i, sizeof(float), __func__);
i = 0;

View File

@ -796,7 +796,7 @@ static void define_primitive_add_properties(wmOperatorType *ot)
static int primitive_circle_add_exec(bContext *C, wmOperator *op)
{
const float points[4][2] = {{0.0f, 0.5f}, {0.5f, 1.0f}, {1.0f, 0.5f}, {0.5f, 0.0f}};
int num_points = sizeof(points) / (2 * sizeof(float));
int num_points = sizeof(points) / (sizeof(float[2]));
create_primitive_from_points(C, op, points, num_points, HD_AUTO);
@ -827,7 +827,7 @@ void MASK_OT_primitive_circle_add(wmOperatorType *ot)
static int primitive_square_add_exec(bContext *C, wmOperator *op)
{
const float points[4][2] = {{0.0f, 0.0f}, {0.0f, 1.0f}, {1.0f, 1.0f}, {1.0f, 0.0f}};
int num_points = sizeof(points) / (2 * sizeof(float));
int num_points = sizeof(points) / (sizeof(float[2]));
create_primitive_from_points(C, op, points, num_points, HD_VECT);

View File

@ -327,7 +327,7 @@ static int mask_shape_key_rekey_exec(bContext *C, wmOperator *op)
if (MASKPOINT_ISSEL_ANY(point)) {
if (do_location) {
memcpy(shape_ele_dst->value, shape_ele_src->value, sizeof(float) * 6);
memcpy(shape_ele_dst->value, shape_ele_src->value, sizeof(float[6]));
}
if (do_feather) {
shape_ele_dst->value[6] = shape_ele_src->value[6];

View File

@ -4034,7 +4034,7 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op)
/* the floating point coordinates of verts in screen space will be
* stored in a hash table according to the vertices pointer */
screen_vert_coords = sco = MEM_mallocN(bm->totvert * sizeof(float) * 2, __func__);
screen_vert_coords = sco = MEM_mallocN(sizeof(float[2]) * bm->totvert, __func__);
BM_ITER_MESH_INDEX (bv, &iter, bm, BM_VERTS_OF_MESH, i) {
if (ED_view3d_project_float_object(region, bv->co, *sco, V3D_PROJ_TEST_CLIP_NEAR) !=

View File

@ -452,7 +452,7 @@ int ED_mesh_join_objects_exec(bContext *C, wmOperator *op)
if (kb->data) {
MEM_freeN(kb->data);
}
kb->data = MEM_callocN(sizeof(float) * 3 * totvert, "join_shapekey");
kb->data = MEM_callocN(sizeof(float[3]) * totvert, "join_shapekey");
kb->totelem = totvert;
}
}
@ -550,7 +550,7 @@ int ED_mesh_join_objects_exec(bContext *C, wmOperator *op)
BKE_keyblock_copy_settings(kbn, kb);
/* adjust settings to fit (allocate a new data-array) */
kbn->data = MEM_callocN(sizeof(float) * 3 * totvert, "joined_shapekey");
kbn->data = MEM_callocN(sizeof(float[3]) * totvert, "joined_shapekey");
kbn->totelem = totvert;
}
@ -1154,7 +1154,7 @@ int *mesh_get_x_mirror_faces(Object *ob, BMEditMesh *em, Mesh *me_eval)
int a;
mirrorverts = MEM_callocN(sizeof(int) * totvert, "MirrorVerts");
mirrorfaces = MEM_callocN(sizeof(int) * 2 * totface, "MirrorFaces");
mirrorfaces = MEM_callocN(sizeof(int[2]) * totface, "MirrorFaces");
mvert = me_eval ? me_eval->mvert : me->mvert;
mface = me_eval ? me_eval->mface : me->mface;

View File

@ -1175,7 +1175,7 @@ static int parent_noinv_set_exec(bContext *C, wmOperator *op)
else {
/* clear inverse matrix and also the object location */
unit_m4(ob->parentinv);
memset(ob->loc, 0, 3 * sizeof(float));
memset(ob->loc, 0, sizeof(float[3]));
/* set recalc flags */
DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);

View File

@ -1386,7 +1386,7 @@ void recalc_emitter_field(Depsgraph *UNUSED(depsgraph), Object *UNUSED(ob), Part
totface = mesh->totface;
/*totvert=dm->getNumVerts(dm);*/ /*UNUSED*/
edit->emitter_cosnos = MEM_callocN(totface * 6 * sizeof(float), "emitter cosnos");
edit->emitter_cosnos = MEM_callocN(sizeof(float[6]) * totface, "emitter cosnos");
edit->emitter_field = BLI_kdtree_3d_new(totface);

View File

@ -349,7 +349,7 @@ static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, R
ED_annotation_draw_ex(scene, gpd, sizex, sizey, scene->r.cfra, SPACE_SEQ);
G.f &= ~G_FLAG_RENDER_VIEWPORT;
gp_rect = MEM_mallocN(sizex * sizey * sizeof(uchar) * 4, "offscreen rect");
gp_rect = MEM_mallocN(sizeof(uchar[4]) * sizex * sizey, "offscreen rect");
GPU_offscreen_read_pixels(oglrender->ofs, GPU_DATA_UNSIGNED_BYTE, gp_rect);
for (i = 0; i < sizex * sizey * 4; i += 4) {

View File

@ -764,7 +764,7 @@ static void shader_preview_texture(ShaderPreview *sp, Tex *tex, Scene *sce, Rend
/* Create buffer in empty RenderView created in the init step. */
RenderResult *rr = RE_AcquireResultWrite(re);
RenderView *rv = (RenderView *)rr->views.first;
rv->rectf = MEM_callocN(sizeof(float) * 4 * width * height, "texture render result");
rv->rectf = MEM_callocN(sizeof(float[4]) * width * height, "texture render result");
RE_ReleaseResult(re);
/* Get texture image pool (if any) */

View File

@ -566,7 +566,7 @@ int ED_draw_imbuf_method(ImBuf *ibuf)
if (U.image_draw_method == IMAGE_DRAW_METHOD_AUTO) {
/* Use faster GLSL when CPU to GPU transfer is unlikely to be a bottleneck,
* otherwise do color management on CPU side. */
const size_t threshold = 2048 * 2048 * 4 * sizeof(float);
const size_t threshold = sizeof(float[4]) * 2048 * 2048;
const size_t data_size = (ibuf->rect_float) ? sizeof(float) : sizeof(uchar);
const size_t size = ibuf->x * ibuf->y * ibuf->channels * data_size;

View File

@ -1412,7 +1412,6 @@ static void paint_draw_2D_view_brush_cursor(PaintCursorContext *pcontext)
pcontext->translation[1],
pcontext->final_radius,
40);
}
static void paint_draw_legacy_3D_view_brush_cursor(PaintCursorContext *pcontext)

View File

@ -1383,7 +1383,7 @@ static void insert_seam_vert_array(const ProjPaintState *ps,
const int fidx[2] = {fidx1, ((fidx1 + 1) % 3)};
float vec[2];
VertSeam *vseam = BLI_memarena_alloc(arena, sizeof(VertSeam) * 2);
VertSeam *vseam = BLI_memarena_alloc(arena, sizeof(VertSeam[2]));
vseam->prev = NULL;
vseam->next = NULL;
@ -2785,10 +2785,10 @@ static void project_bucket_clip_face(const bool is_ortho,
}
if (flip) {
qsort(isectVCosSS, *tot, sizeof(float) * 3, float_z_sort_flip);
qsort(isectVCosSS, *tot, sizeof(float[3]), float_z_sort_flip);
}
else {
qsort(isectVCosSS, *tot, sizeof(float) * 3, float_z_sort);
qsort(isectVCosSS, *tot, sizeof(float[3]), float_z_sort);
}
doubles = true;
@ -3872,7 +3872,7 @@ static void proj_paint_state_cavity_init(ProjPaintState *ps)
if (ps->do_mask_cavity) {
int *counter = MEM_callocN(sizeof(int) * ps->totvert_eval, "counter");
float(*edges)[3] = MEM_callocN(sizeof(float) * 3 * ps->totvert_eval, "edges");
float(*edges)[3] = MEM_callocN(sizeof(float[3]) * ps->totvert_eval, "edges");
ps->cavities = MEM_mallocN(sizeof(float) * ps->totvert_eval, "ProjectPaint Cavities");
cavities = ps->cavities;

View File

@ -522,12 +522,12 @@ static SculptClothSimulation *cloth_brush_simulation_create(SculptSession *ss,
cloth_sim->capacity_length_constraints = CLOTH_LENGTH_CONSTRAINTS_BLOCK;
cloth_sim->acceleration = MEM_calloc_arrayN(
totverts, 3 * sizeof(float), "cloth sim acceleration");
cloth_sim->pos = MEM_calloc_arrayN(totverts, 3 * sizeof(float), "cloth sim pos");
cloth_sim->prev_pos = MEM_calloc_arrayN(totverts, 3 * sizeof(float), "cloth sim prev pos");
totverts, sizeof(float[3]), "cloth sim acceleration");
cloth_sim->pos = MEM_calloc_arrayN(totverts, sizeof(float[3]), "cloth sim pos");
cloth_sim->prev_pos = MEM_calloc_arrayN(totverts, sizeof(float[3]), "cloth sim prev pos");
cloth_sim->last_iteration_pos = MEM_calloc_arrayN(
totverts, sizeof(float) * 3, "cloth sim last iteration pos");
cloth_sim->init_pos = MEM_calloc_arrayN(totverts, 3 * sizeof(float), "cloth sim init pos");
totverts, sizeof(float[3]), "cloth sim last iteration pos");
cloth_sim->init_pos = MEM_calloc_arrayN(totverts, sizeof(float[3]), "cloth sim init pos");
cloth_sim->length_constraint_tweak = MEM_calloc_arrayN(
totverts, sizeof(float), "cloth sim length tweak");
@ -535,7 +535,7 @@ static SculptClothSimulation *cloth_brush_simulation_create(SculptSession *ss,
* positions. */
if (brush && SCULPT_is_cloth_deform_brush(brush)) {
cloth_sim->deformation_pos = MEM_calloc_arrayN(
totverts, 3 * sizeof(float), "cloth sim deformation positions");
totverts, sizeof(float[3]), "cloth sim deformation positions");
}
cloth_sim->mass = cloth_mass;

View File

@ -595,7 +595,7 @@ static int sculpt_mesh_filter_invoke(bContext *C, wmOperator *op, const wmEvent
}
if (RNA_enum_get(op->ptr, "type") == MESH_FILTER_SURFACE_SMOOTH) {
ss->filter_cache->surface_smooth_laplacian_disp = MEM_mallocN(3 * sizeof(float) * totvert,
ss->filter_cache->surface_smooth_laplacian_disp = MEM_mallocN(sizeof(float[3]) * totvert,
"surface smooth disp");
ss->filter_cache->surface_smooth_shape_preservation = RNA_float_get(
op->ptr, "surface_smooth_shape_preservation");
@ -612,7 +612,7 @@ static int sculpt_mesh_filter_invoke(bContext *C, wmOperator *op, const wmEvent
ss->filter_cache->sharpen_factor = MEM_mallocN(sizeof(float) * totvert, "sharpen factor");
ss->filter_cache->sharpen_detail_directions = MEM_malloc_arrayN(
totvert, 3 * sizeof(float), "sharpen detail direction");
totvert, sizeof(float[3]), "sharpen detail direction");
mesh_filter_sharpen_init_factors(ss);
}

View File

@ -359,7 +359,7 @@ static int sculpt_mask_expand_invoke(bContext *C, wmOperator *op, const wmEvent
SCULPT_vertex_random_access_init(ss);
op->customdata = MEM_mallocN(2 * sizeof(float), "initial mouse position");
op->customdata = MEM_mallocN(sizeof(float[2]), "initial mouse position");
copy_v2_v2(op->customdata, mouse);
SCULPT_cursor_geometry_info_update(C, &sgi, mouse, false);

View File

@ -461,7 +461,7 @@ void SCULPT_do_smear_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
if (SCULPT_stroke_is_first_brush_step(ss->cache)) {
if (!ss->cache->prev_colors) {
ss->cache->prev_colors = MEM_callocN(sizeof(float) * 4 * totvert, "prev colors");
ss->cache->prev_colors = MEM_callocN(sizeof(float[4]) * totvert, "prev colors");
for (int i = 0; i < totvert; i++) {
copy_v4_v4(ss->cache->prev_colors[i], SCULPT_vertex_color_get(ss, i));
}

View File

@ -443,7 +443,7 @@ void SCULPT_do_surface_smooth_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, in
if (SCULPT_stroke_is_first_brush_step(ss->cache)) {
BLI_assert(ss->cache->surface_smooth_laplacian_disp == NULL);
ss->cache->surface_smooth_laplacian_disp = MEM_callocN(
SCULPT_vertex_count_get(ss) * 3 * sizeof(float), "HC smooth laplacian b");
sizeof(float[3]) * SCULPT_vertex_count_get(ss), "HC smooth laplacian b");
}
/* Threaded loop over nodes. */

View File

@ -1515,7 +1515,7 @@ static void draw_tracking_tracks(SpaceClip *sc,
/* undistort */
if (count) {
marker_pos = MEM_callocN(2 * sizeof(float) * count, "draw_tracking_tracks marker_pos");
marker_pos = MEM_callocN(sizeof(float[2]) * count, "draw_tracking_tracks marker_pos");
track = tracksbase->first;
fp = marker_pos;

View File

@ -810,9 +810,9 @@ static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2
correct_bezpart(v1, v2, v3, v4);
BKE_curve_forward_diff_bezier(v1[0], v2[0], v3[0], v4[0], data, resol, sizeof(float) * 3);
BKE_curve_forward_diff_bezier(v1[0], v2[0], v3[0], v4[0], data, resol, sizeof(float[3]));
BKE_curve_forward_diff_bezier(
v1[1], v2[1], v3[1], v4[1], data + 1, resol, sizeof(float) * 3);
v1[1], v2[1], v3[1], v4[1], data + 1, resol, sizeof(float[3]));
for (fp = data; resol; resol--, fp += 3) {
immVertex2fv(pos, fp);

View File

@ -3851,9 +3851,9 @@ bool node_link_bezier_points(
if (node_link_bezier_handles(v2d, snode, link, vec)) {
/* always do all three, to prevent data hanging around */
BKE_curve_forward_diff_bezier(
vec[0][0], vec[1][0], vec[2][0], vec[3][0], coord_array[0] + 0, resol, sizeof(float) * 2);
vec[0][0], vec[1][0], vec[2][0], vec[3][0], coord_array[0] + 0, resol, sizeof(float[2]));
BKE_curve_forward_diff_bezier(
vec[0][1], vec[1][1], vec[2][1], vec[3][1], coord_array[0] + 1, resol, sizeof(float) * 2);
vec[0][1], vec[1][1], vec[2][1], vec[3][1], coord_array[0] + 1, resol, sizeof(float[2]));
return 1;
}

View File

@ -1187,7 +1187,7 @@ static TreeElement *outliner_add_element(SpaceOutliner *space_outliner,
c = RNA_property_array_item_char(prop, index);
te->name = MEM_callocN(sizeof(char) * 20, "OutlinerRNAArrayName");
te->name = MEM_callocN(sizeof(char[20]), "OutlinerRNAArrayName");
if (c) {
sprintf((char *)te->name, " %c", c);
}

View File

@ -730,7 +730,7 @@ static ImBuf *make_vectorscope_view_from_ibuf_float(ImBuf *ibuf)
const float *src1 = src + 4 * (ibuf->x * y + x);
const char *p;
memcpy(rgb, src1, 3 * sizeof(float));
memcpy(rgb, src1, sizeof(float[3]));
clamp_v3(rgb, 0.0f, 1.0f);

View File

@ -267,7 +267,7 @@ void setCustomPoints(TransInfo *UNUSED(t),
{
int *data;
mi->data = MEM_reallocN(mi->data, sizeof(int) * 4);
mi->data = MEM_reallocN(mi->data, sizeof(int[4]));
data = mi->data;

View File

@ -1498,10 +1498,10 @@ static void p_polygon_kernel_center(float (*points)[2], int npoints, float *cent
float(*oldpoints)[2], (*newpoints)[2], *p1, *p2;
size = npoints * 3;
oldpoints = MEM_mallocN(sizeof(float) * 2 * size, "PPolygonOldPoints");
newpoints = MEM_mallocN(sizeof(float) * 2 * size, "PPolygonNewPoints");
oldpoints = MEM_mallocN(sizeof(float[2]) * size, "PPolygonOldPoints");
newpoints = MEM_mallocN(sizeof(float[2]) * size, "PPolygonNewPoints");
memcpy(oldpoints, points, sizeof(float) * 2 * npoints);
memcpy(oldpoints, points, sizeof(float[2]) * npoints);
for (i = 0; i < npoints; i++) {
p1 = points[i];
@ -1510,7 +1510,7 @@ static void p_polygon_kernel_center(float (*points)[2], int npoints, float *cent
if (nnewpoints == 0) {
/* degenerate case, use center of original polygon */
memcpy(oldpoints, points, sizeof(float) * 2 * npoints);
memcpy(oldpoints, points, sizeof(float[2]) * npoints);
nnewpoints = npoints;
break;
}
@ -1528,10 +1528,10 @@ static void p_polygon_kernel_center(float (*points)[2], int npoints, float *cent
if (nnewpoints * 2 > size) {
size *= 2;
MEM_freeN(oldpoints);
oldpoints = MEM_mallocN(sizeof(float) * 2 * size, "oldpoints");
memcpy(oldpoints, newpoints, sizeof(float) * 2 * nnewpoints);
oldpoints = MEM_mallocN(sizeof(float[2]) * size, "oldpoints");
memcpy(oldpoints, newpoints, sizeof(float[2]) * nnewpoints);
MEM_freeN(newpoints);
newpoints = MEM_mallocN(sizeof(float) * 2 * size, "newpoints");
newpoints = MEM_mallocN(sizeof(float[2]) * size, "newpoints");
}
else {
float(*sw_points)[2] = oldpoints;
@ -1687,7 +1687,7 @@ static void p_vert_harmonic_insert(PVert *v)
npoints++;
}
points = MEM_mallocN(sizeof(float) * 2 * npoints, "PHarmonicPoints");
points = MEM_mallocN(sizeof(float[2]) * npoints, "PHarmonicPoints");
e = v->edge;
i = 0;
@ -2427,7 +2427,7 @@ static void p_abf_setup_system(PAbfSystem *sys)
sys->bAlpha = (float *)MEM_mallocN(sizeof(float) * sys->nangles, "ABFbalpha");
sys->bTriangle = (float *)MEM_mallocN(sizeof(float) * sys->nfaces, "ABFbtriangle");
sys->bInterior = (float *)MEM_mallocN(sizeof(float) * 2 * sys->ninterior, "ABFbinterior");
sys->bInterior = (float *)MEM_mallocN(sizeof(float[2]) * sys->ninterior, "ABFbinterior");
sys->lambdaTriangle = (float *)MEM_callocN(sizeof(float) * sys->nfaces, "ABFlambdatri");
sys->lambdaPlanar = (float *)MEM_callocN(sizeof(float) * sys->ninterior, "ABFlamdaplane");

View File

@ -1225,14 +1225,14 @@ static int stitch_process_data(StitchStateContainer *ssc,
uint buffer_index = 0;
/* initialize the preview buffers */
preview->preview_polys = MEM_mallocN(preview->preview_uvs * sizeof(float) * 2,
preview->preview_polys = MEM_mallocN(sizeof(float[2]) * preview->preview_uvs,
"tri_uv_stitch_prev");
preview->uvs_per_polygon = MEM_mallocN(preview->num_polys * sizeof(*preview->uvs_per_polygon),
preview->uvs_per_polygon = MEM_mallocN(sizeof(*preview->uvs_per_polygon) * preview->num_polys,
"tri_uv_stitch_prev");
preview->static_tris = MEM_mallocN(state->tris_per_island[ssc->static_island] * sizeof(float) *
6,
"static_island_preview_tris");
preview->static_tris = MEM_mallocN(
(sizeof(float[6]) * state->tris_per_island[ssc->static_island]),
"static_island_preview_tris");
preview->num_static_tris = state->tris_per_island[ssc->static_island];
/* will cause cancel and freeing of all data structures so OK */
@ -1271,9 +1271,9 @@ static int stitch_process_data(StitchStateContainer *ssc,
&bm->ldata, lnext->next->head.data, CD_MLOOPUV);
luv = CustomData_bmesh_get(&bm->ldata, lnext->head.data, CD_MLOOPUV);
memcpy(preview->static_tris + buffer_index, fuv->uv, 2 * sizeof(float));
memcpy(preview->static_tris + buffer_index + 2, luv->uv, 2 * sizeof(float));
memcpy(preview->static_tris + buffer_index + 4, luvnext->uv, 2 * sizeof(float));
memcpy(preview->static_tris + buffer_index, fuv->uv, sizeof(float[2]));
memcpy(preview->static_tris + buffer_index + 2, luv->uv, sizeof(float[2]));
memcpy(preview->static_tris + buffer_index + 4, luvnext->uv, sizeof(float[2]));
buffer_index += 6;
}
else {

View File

@ -122,7 +122,7 @@ void AppCanvas::Erase()
void AppCanvas::readColorPixels(int x, int y, int w, int h, RGBImage &oImage) const
{
float *rgb = new float[3 * w * h];
memset(rgb, 0, sizeof(float) * 3 * w * h);
memset(rgb, 0, sizeof(float[3]) * w * h);
int xsch = width();
int ysch = height();
if (_pass_diffuse.buf) {
@ -161,8 +161,7 @@ void AppCanvas::readColorPixels(int x, int y, int w, int h, RGBImage &oImage) co
if (ii < 0 || ii >= rectx) {
continue;
}
memcpy(
rgb + (w * j + i) * 3, _pass_diffuse.buf + (rectx * jj + ii) * 3, sizeof(float) * 3);
memcpy(rgb + (w * j + i) * 3, _pass_diffuse.buf + (rectx * jj + ii) * 3, sizeof(float[3]));
}
}
}

View File

@ -52,8 +52,8 @@ NodeCamera::NodeCamera(CameraType camera_type) : camera_type_(camera_type)
#if 0 /* UNUSED, gives warning in gcc */
NodeCamera::NodeCamera(const NodeCamera &iBrother) : camera_type_(iBrother.camera_type_)
{
memcpy(modelview_matrix_, iBrother.modelview_matrix_, 16 * sizeof(double));
memcpy(projection_matrix_, iBrother.projection_matrix_, 16 * sizeof(double));
memcpy(modelview_matrix_, iBrother.modelview_matrix_, sizeof(double[16]));
memcpy(projection_matrix_, iBrother.projection_matrix_, sizeof(double[16]));
}
#endif
@ -64,12 +64,12 @@ void NodeCamera::accept(SceneVisitor &v)
void NodeCamera::setModelViewMatrix(double modelview_matrix[16])
{
memcpy(modelview_matrix_, modelview_matrix, 16 * sizeof(double));
memcpy(modelview_matrix_, modelview_matrix, sizeof(double[16]));
}
void NodeCamera::setProjectionMatrix(double projection_matrix[16])
{
memcpy(projection_matrix_, projection_matrix, 16 * sizeof(double));
memcpy(projection_matrix_, projection_matrix, sizeof(double[16]));
}
NodeOrthographicCamera::NodeOrthographicCamera()

View File

@ -124,7 +124,7 @@ void SilhouetteGeomEngine::setFrustum(real iZNear, real iZFar)
void SilhouetteGeomEngine::retrieveViewport(int viewport[4])
{
memcpy(viewport, _viewport, 4 * sizeof(int));
memcpy(viewport, _viewport, sizeof(int[4]));
}
void SilhouetteGeomEngine::ProjectSilhouette(vector<SVertex *> &ioVertices)

Some files were not shown because too many files have changed in this diff Show More