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/editors/uvedit
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/editors/uvedit')
-rw-r--r--source/blender/editors/uvedit/uvedit_parametrizer.c18
-rw-r--r--source/blender/editors/uvedit/uvedit_smart_stitch.c16
2 files changed, 17 insertions, 17 deletions
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 8e079dcac94..dd422f2443a 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -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");
diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c
index f3ea7456c38..6332a6ab48f 100644
--- a/source/blender/editors/uvedit/uvedit_smart_stitch.c
+++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c
@@ -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 {