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/sculpt_paint
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/sculpt_paint')
-rw-r--r--source/blender/editors/sculpt_paint/paint_cursor.c1
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c8
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_cloth.c12
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_filter_mesh.c4
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_mask_expand.c2
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_paint_color.c2
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_smooth.c2
7 files changed, 15 insertions, 16 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index ba32b53a9e0..b8af33fb7cc 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -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)
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index d16c66848b8..db7de01bee5 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -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;
diff --git a/source/blender/editors/sculpt_paint/sculpt_cloth.c b/source/blender/editors/sculpt_paint/sculpt_cloth.c
index 21fba6479e8..7d318760476 100644
--- a/source/blender/editors/sculpt_paint/sculpt_cloth.c
+++ b/source/blender/editors/sculpt_paint/sculpt_cloth.c
@@ -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;
diff --git a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
index e39cdc2db23..ebf511c7fd3 100644
--- a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
+++ b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
@@ -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);
}
diff --git a/source/blender/editors/sculpt_paint/sculpt_mask_expand.c b/source/blender/editors/sculpt_paint/sculpt_mask_expand.c
index bc493a036f0..aaa61ee9ed3 100644
--- a/source/blender/editors/sculpt_paint/sculpt_mask_expand.c
+++ b/source/blender/editors/sculpt_paint/sculpt_mask_expand.c
@@ -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);
diff --git a/source/blender/editors/sculpt_paint/sculpt_paint_color.c b/source/blender/editors/sculpt_paint/sculpt_paint_color.c
index 00a59949130..ed33542967b 100644
--- a/source/blender/editors/sculpt_paint/sculpt_paint_color.c
+++ b/source/blender/editors/sculpt_paint/sculpt_paint_color.c
@@ -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));
}
diff --git a/source/blender/editors/sculpt_paint/sculpt_smooth.c b/source/blender/editors/sculpt_paint/sculpt_smooth.c
index 7fbbcd1c896..9a64830cc20 100644
--- a/source/blender/editors/sculpt_paint/sculpt_smooth.c
+++ b/source/blender/editors/sculpt_paint/sculpt_smooth.c
@@ -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. */