From: Matthew Fernandez Date: Sun, 7 Nov 2021 20:12:53 +0000 (-0800) Subject: mkSurface: fix mismatch of calling convention in 'addFace' X-Git-Tag: 2.50.0~41^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=76cd3a9b5e86bc91d25f3ec9233e18d089483c4e;p=graphviz mkSurface: fix mismatch of calling convention in 'addFace' 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. --- 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;