Cleanup: use array syntax for sizeof, zero before float suffix

This commit is contained in:
Campbell Barton 2022-03-25 12:04:19 +11:00
parent bbd787275f
commit c594cfbe50
7 changed files with 13 additions and 14 deletions

View File

@ -234,7 +234,7 @@ static void calc_node_transforms(const tinygltf::Node &gltf_node,
{(float)dm[4], (float)dm[5], (float)dm[6], (float)dm[7]},
{(float)dm[8], (float)dm[9], (float)dm[10], (float)dm[11]},
{(float)dm[12], (float)dm[13], (float)dm[14], (float)dm[15]}};
memcpy(r_local_transform, m, sizeof(float) * 16);
memcpy(r_local_transform, m, sizeof(float[4][4]));
}
else {
/* No matrix is present, so construct a matrix from the TRS values (each one is optional). */

View File

@ -1292,8 +1292,8 @@ void ANIM_fcurve_equalize_keyframes_loop(FCurve *fcu,
{
uint i;
BezTriple *bezt;
const float flat_direction_left[2] = {-handle_length, 0.f};
const float flat_direction_right[2] = {handle_length, 0.f};
const float flat_direction_left[2] = {-handle_length, 0.0f};
const float flat_direction_right[2] = {handle_length, 0.0f};
/* Loop through an F-Curves keyframes. */
for (bezt = fcu->bezt, i = 0; i < fcu->totvert; bezt++, i++) {

View File

@ -1076,7 +1076,7 @@ static void sculpt_gesture_trim_geometry_generate(SculptGestureContext *sgcontex
const int trim_totpolys = (2 * (tot_screen_points - 2)) + (2 * tot_screen_points);
trim_operation->mesh = BKE_mesh_new_nomain(
trim_totverts, 0, 0, trim_totpolys * 3, trim_totpolys);
trim_operation->true_mesh_co = MEM_malloc_arrayN(trim_totverts, 3 * sizeof(float), "mesh orco");
trim_operation->true_mesh_co = MEM_malloc_arrayN(trim_totverts, sizeof(float[3]), "mesh orco");
float depth_front = trim_operation->depth_front;
float depth_back = trim_operation->depth_back;
@ -1130,7 +1130,7 @@ static void sculpt_gesture_trim_geometry_generate(SculptGestureContext *sgcontex
/* Get the triangulation for the front/back poly. */
const int tot_tris_face = tot_screen_points - 2;
uint(*r_tris)[3] = MEM_malloc_arrayN(tot_tris_face, 3 * sizeof(uint), "tris");
uint(*r_tris)[3] = MEM_malloc_arrayN(tot_tris_face, sizeof(uint[3]), "tris");
BLI_polyfill_calc(screen_points, tot_screen_points, 0, r_tris);
/* Write the front face triangle indices. */

View File

@ -532,9 +532,8 @@ static void sculpt_boundary_bend_data_init(SculptSession *ss, SculptBoundary *bo
{
const int totvert = SCULPT_vertex_count_get(ss);
boundary->bend.pivot_rotation_axis = MEM_calloc_arrayN(
totvert, 3 * sizeof(float), "pivot rotation axis");
boundary->bend.pivot_positions = MEM_calloc_arrayN(
totvert, 3 * sizeof(float), "pivot positions");
totvert, sizeof(float[3]), "pivot rotation axis");
boundary->bend.pivot_positions = MEM_calloc_arrayN(totvert, sizeof(float[3]), "pivot positions");
for (int i = 0; i < totvert; i++) {
if (boundary->edit_info[i].num_propagation_steps != boundary->max_propagation_steps) {
@ -567,7 +566,7 @@ static void sculpt_boundary_bend_data_init(SculptSession *ss, SculptBoundary *bo
static void sculpt_boundary_slide_data_init(SculptSession *ss, SculptBoundary *boundary)
{
const int totvert = SCULPT_vertex_count_get(ss);
boundary->slide.directions = MEM_calloc_arrayN(totvert, 3 * sizeof(float), "slide directions");
boundary->slide.directions = MEM_calloc_arrayN(totvert, sizeof(float[3]), "slide directions");
for (int i = 0; i < totvert; i++) {
if (boundary->edit_info[i].num_propagation_steps != boundary->max_propagation_steps) {
@ -592,7 +591,7 @@ static void sculpt_boundary_twist_data_init(SculptSession *ss, SculptBoundary *b
{
zero_v3(boundary->twist.pivot_position);
float(*poly_verts)[3] = MEM_malloc_arrayN(
boundary->num_vertices, sizeof(float) * 3, "poly verts");
boundary->num_vertices, sizeof(float[3]), "poly verts");
for (int i = 0; i < boundary->num_vertices; i++) {
add_v3_v3(boundary->twist.pivot_position, SCULPT_vertex_co_get(ss, boundary->vertices[i]));
copy_v3_v3(poly_verts[i], SCULPT_vertex_co_get(ss, boundary->vertices[i]));

View File

@ -251,7 +251,7 @@ static void SCULPT_enhance_details_brush(Sculpt *sd,
if (SCULPT_stroke_is_first_brush_step(ss->cache)) {
const int totvert = SCULPT_vertex_count_get(ss);
ss->cache->detail_directions = MEM_malloc_arrayN(
totvert, 3 * sizeof(float), "details directions");
totvert, sizeof(float[3]), "details directions");
for (int i = 0; i < totvert; i++) {
float avg[3];

View File

@ -391,7 +391,7 @@ bool USD_import(struct bContext *C,
else {
/* Fake a job context, so that we don't need NULL pointer checks while importing. */
short stop = 0, do_update = 0;
float progress = 0.f;
float progress = 0.0f;
import_startjob(job, &stop, &do_update, &progress);
import_endjob(job);

View File

@ -331,7 +331,7 @@ class TextureMarginMap {
float destx, desty;
int foundpoly;
float mindist = -1.f;
float mindist = -1.0f;
/* Loop over all adjacent polygons and determine which edge is closest.
* This could be optimized by only inspecting neighbors which are on the edge of an island.
@ -356,7 +356,7 @@ class TextureMarginMap {
}
}
return mindist >= 0.f;
return mindist >= 0.0f;
}
/**