star-cpr

Clip 2D meshes with 2D polygons
git clone git://git.meso-star.fr/star-cpr.git
Log | Files | Refs | README | LICENSE

commit 24be3c14d987dcca661ac8a2316d874ed88e1f3d
parent 613437de751871cea32546395357380b1c20d314
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Tue, 19 Oct 2021 14:51:20 +0200

Fix warnings detected by gcc 11

Diffstat:
Msrc/test_scpr_clip.c | 10+++++-----
Msrc/test_scpr_mesh.c | 4++--
2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/test_scpr_clip.c b/src/test_scpr_clip.c @@ -73,7 +73,7 @@ test_triangle(struct scpr_mesh* mesh) (mesh, ctx.ntris, get_ids, 3, get_pos, &ctx) == RES_OK); poly.get_position = get_clip_pos; - poly.nvertices = sizeof(clip_pos)/sizeof(double[2]); + poly.nvertices = sizeof(clip_pos)/(2*sizeof(double)); poly.context = (void*)clip_pos; CHK(scpr_mesh_clip(NULL, SCPR_OPERATIONS_COUNT__, NULL) == RES_BAD_ARG); CHK(scpr_mesh_clip(mesh, SCPR_OPERATIONS_COUNT__, NULL) == RES_BAD_ARG); @@ -100,14 +100,14 @@ test_quad(struct scpr_mesh* mesh) struct mesh_context ctx; ctx.coords = quad_pos; - ctx.nverts = sizeof(quad_pos)/sizeof(double[2]); + ctx.nverts = sizeof(quad_pos)/(2*sizeof(double)); ctx.indices = quad_ids; - ctx.ntris = sizeof(quad_ids)/sizeof(size_t[3]); + ctx.ntris = sizeof(quad_ids)/(3*sizeof(size_t)); CHK(scpr_mesh_setup_indexed_vertices (mesh, ctx.ntris, get_ids, ctx.nverts, get_pos, &ctx) == RES_OK); poly.get_position = get_clip_pos; - poly.nvertices = sizeof(clip_pos)/sizeof(double[2]); + poly.nvertices = sizeof(clip_pos)/(2*sizeof(double)); poly.context = (void*)clip_pos; CHK(scpr_mesh_clip(mesh, SCPR_AND, &poly) == RES_OK); @@ -180,7 +180,7 @@ test_disk(struct scpr_mesh* mesh) (mesh, ctx.ntris, get_ids, ctx.nverts, get_pos, &ctx) == RES_OK); poly.get_position = get_clip_pos; - poly.nvertices = sizeof(clip)/sizeof(double[2]); + poly.nvertices = sizeof(clip)/(2*sizeof(double)); poly.context = (void*)clip; CHK(scpr_mesh_clip(mesh, SCPR_SUB, &poly) == RES_OK); diff --git a/src/test_scpr_mesh.c b/src/test_scpr_mesh.c @@ -30,7 +30,7 @@ main(int argc, char** argv) 1.0, 0.5, 1.0, 1.0 }; - const size_t nverts = sizeof(coords)/sizeof(double[2]); + const size_t nverts = sizeof(coords)/(2*sizeof(double)); const size_t indices[] = { 0, 1, 3, 3, 1, 4, @@ -41,7 +41,7 @@ main(int argc, char** argv) 4, 5, 7, 7, 5, 8 }; - const size_t ntris = sizeof(indices)/sizeof(size_t[3]); + const size_t ntris = sizeof(indices)/(3*sizeof(size_t)); const size_t indices_bad[] = { 7, 5, 9 }; size_t ids[3]; double pos[2];