The compiler said about this code:
delaunay.c:518:34: warning: cast between incompatible function types from
‘void (*)(GFace *, fstate *)’ {aka ‘void (*)(struct <anonymous> *, struct
<anonymous> *)’} to ‘gint (*)(void *, void *)’ {aka
‘int (*)(void *, void *)’} [-Wcast-function-type]
gts_surface_foreach_face (s, (GtsFunc) addTri, &statf);
^
Similar to the prior commit, this was relying on a coincident return value of 0
from the callback function.
neigh[i] = -1;
}
-static void addTri (GFace* f, fstate* es)
-{
+static gint addTri(void *face, void *state) {
+ GFace *f = face;
+ fstate *es = state;
+
int myid = f->idx;
int* ip = es->faces + 3*myid;
GtsVertex *v1, *v2, *v3;
*ip++ = ((GVertex*)(v1))->idx;
*ip++ = ((GVertex*)(v2))->idx;
*ip++ = ((GVertex*)(v3))->idx;
+
+ return 0;
}
/* mkSurface:
gts_surface_foreach_face(s, cntFace, &nfaces);
statf.faces = N_GNEW(3 * nfaces, int);
- gts_surface_foreach_face (s, (GtsFunc) addTri, &statf);
+ gts_surface_foreach_face(s, addTri, &statf);
gts_object_destroy (GTS_OBJECT (s));