diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-08-08 06:29:21 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-08-08 06:38:00 +0300 |
commit | 171e77c3c25a1224fc5f7db40ec6f8879f8dbbb0 (patch) | |
tree | ea51f4fa508a39807e6f6d333b2d53af8a2b9fc1 /source/blender/editors/uvedit/uvedit_smart_stitch.c | |
parent | 4bf3ca20165959f98c7c830a138ba2901d3dd851 (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/uvedit_smart_stitch.c')
-rw-r--r-- | source/blender/editors/uvedit/uvedit_smart_stitch.c | 16 |
1 files changed, 8 insertions, 8 deletions
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 { |