From: Matthew Fernandez Date: Sun, 7 Nov 2021 20:01:23 +0000 (-0800) Subject: mkSurface/get_triangles: fix mismatch of calling convention in 'cntFace' X-Git-Tag: 2.50.0~41^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cbcd11bb087dc19b3d3d4d208e395f3b934cb1c6;p=graphviz mkSurface/get_triangles: fix mismatch of calling convention in 'cntFace' The compiler said about this code: delaunay.c:477:34: warning: cast between incompatible function types from ‘void (*)(GFace *, int *)’ {aka ‘void (*)(struct *, int *)’} to ‘gint (*)(void *, void *)’ {aka ‘int (*)(void *, void *)’} [-Wcast-function-type] gts_surface_foreach_face (s, (GtsFunc) cntFace, &nfaces); ^ 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 f68819e03..08805abdc 100644 --- a/lib/neatogen/delaunay.c +++ b/lib/neatogen/delaunay.c @@ -398,10 +398,14 @@ int *delaunay_tri(double *x, double *y, int n, int* pnedges) return edges; } -static void cntFace (GFace* fp, int* ip) -{ +static gint cntFace(void *face, void *data) { + GFace *fp = face; + int *ip = data; + fp->idx = *ip; *ip += 1; + + return 0; } typedef struct { @@ -489,7 +493,7 @@ mkSurface (double *x, double *y, int n, int* segs, int nsegs) state.edges = segs; gts_surface_foreach_edge(s, addEdge, &state); - gts_surface_foreach_face (s, (GtsFunc) cntFace, &nfaces); + gts_surface_foreach_face(s, cntFace, &nfaces); faces = N_GNEW(3 * nfaces, int); neigh = N_GNEW(3 * nfaces, int); @@ -528,7 +532,7 @@ get_triangles (double *x, int n, int* tris) s = tri(x, NULL, n, NULL, 0, 0); if (!s) return NULL; - gts_surface_foreach_face (s, (GtsFunc) cntFace, &nfaces); + gts_surface_foreach_face(s, cntFace, &nfaces); statf.faces = N_GNEW(3 * nfaces, int); gts_surface_foreach_face (s, (GtsFunc) addTri, &statf);