#3564: Inconsistent results from qsort callback in g.mkfontcap ----------------------+---------------------------- Reporter: yugr | Owner: grass-dev@… Type: defect | Status: new Priority: normal | Milestone: 7.6.0 Component: Default | Version: 7.4.0 Resolution: | Keywords: qsort callback CPU: All | Platform: All ----------------------+----------------------------
Comment (by yugr): Hi Markus, > If you already have a list of these many other problems, can you provide such a list? That would be very helpful. I wasn't sure you'd be interested in these potential overflows (e.g. some may be highly unlikely due to small subtracted values) so didn't report them in first comment. There you go (found by manual analysis of source code): ./lib/vector/neta/spanningtree.c static int cmp_edge(const void *pa, const void *pb) { return ((edge_cost_pair *) pa)->cost - ((edge_cost_pair *) pb)->cost; } ./lib/vector/Vlib/break_lines.c static int cmp(const void *a, const void *b) { int ai = *(int *)a; int bi = *(int *)b; return (ai - bi); } ./raster/r.distance/edges.c static int cmp(const void *aa, const void *bb) { const struct CatEdgeList *a = aa, *b = bb; return (int)(a->cat - b->cat); } ./raster/r.kappa/prt_mat.c static int longcomp(const void *aa, const void *bb) { const long *a = aa; const long *b = bb; return (*a - *b); } ./raster/r.stats/stats.c static int node_compare(const void *pp, const void *qq) { struct Node *const *p = pp, *const *q = qq; register int i, x; register const CELL *a, *b; a = (*p)->values; b = (*q)->values; for (i = nfiles; --i >= 0;) if (x = (*a++ - *b++), x) return x; return 0; } ./raster/r.what/main.c static int by_row(const void *ii, const void *jj) { const struct order *i = ii, *j = jj; return i->row - j->row; } ./vector/v.generalize/misc.c static int cmp(const void *a, const void *b) { int ai = *(int *)a; int bi = *(int *)b; return (ai - bi); } ./vector/v.overlay/area_area.c static int cmp_int(const void *a, const void *b) { return (*(int *)a - *(int *)b); } ./vector/v.to.rast/support.c static int cmp_labels_i(const void *a, const void *b) { struct My_labels_rule *al = (struct My_labels_rule *) a; struct My_labels_rule *bl = (struct My_labels_rule *) b; return (al->i - bl->i); } ./vector/v.vect.stats/main.c static int cmp_area(const void *pa, const void *pb) { AREA_CAT *p1 = (AREA_CAT *) pa; AREA_CAT *p2 = (AREA_CAT *) pb; return (p1->area_cat - p2->area_cat); } ./vector/v.what.rast/search.c ./vector/v.what.rast3/search.c /* for qsort, order list by row */ int by_row(const void *ii, const void *jj) { const struct order *i = ii, *j = jj; return i->row - j->row; } /* for qsort, order list by cat */ int by_cat(const void *ii, const void *jj) { const struct order *i = ii, *j = jj; return i->cat - j->cat; } -- Ticket URL: <https://trac.osgeo.org/grass/ticket/3564#comment:2> GRASS GIS <https://grass.osgeo.org>
_______________________________________________ grass-dev mailing list grass-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/grass-dev