From 76cd3a9b5e86bc91d25f3ec9233e18d089483c4e Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sun, 7 Nov 2021 12:12:53 -0800 Subject: [PATCH] mkSurface: fix mismatch of calling convention in 'addFace' MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The compiler said about this code: delaunay.c:484:34: warning: cast between incompatible function types from ‘void (*)(GFace *, fstate *)’ {aka ‘void (*)(struct *, struct *)’} to ‘gint (*)(void *, void *)’ {aka ‘int (*)(void *, void *)’} [-Wcast-function-type] gts_surface_foreach_face (s, (GtsFunc) addFace, &statf); ^ Similar to the prior commit, this was relying on a coincident return value of 0 from the callback function. --- lib/neatogen/delaunay.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/neatogen/delaunay.c b/lib/neatogen/delaunay.c index 9444d1f12..804fde479 100644 --- a/lib/neatogen/delaunay.c +++ b/lib/neatogen/delaunay.c @@ -429,8 +429,10 @@ static gint addNeighbor(void *face, void *ni) { return 0; } -static void addFace (GFace* f, fstate* es) -{ +static gint addFace(void *face, void *state) { + GFace *f = face; + fstate *es = state; + int i, myid = f->idx; int* ip = es->faces + 3*myid; int* neigh = es->neigh + 3*myid; @@ -447,6 +449,8 @@ static void addFace (GFace* f, fstate* es) gts_face_foreach_neighbor((GtsFace*)f, 0, addNeighbor, &ni); for (i = ni.nneigh; i < 3; i++) neigh[i] = -1; + + return 0; } static gint addTri(void *face, void *state) { @@ -504,7 +508,7 @@ mkSurface (double *x, double *y, int n, int* segs, int nsegs) statf.faces = faces; statf.neigh = neigh; - gts_surface_foreach_face (s, (GtsFunc) addFace, &statf); + gts_surface_foreach_face(s, addFace, &statf); sf->nedges = nsegs; sf->edges = segs; -- 2.40.0