Hi all,
Probably I found bug in nodes cost in vector network analysis (tested in G7, probably it affects all branches). Problem is in lib/vector/Vlib/net.c: int cost; ... (* dglInt32_t)(dglInt32_t) & cost int cost is cast into dglInt32_t pointer. DGLib dglInt32_t is long. I am relatively new to C so I do not understand the way it is casted and I can miss something. I am reading it as cast address of cost int to dglInt32_t and then to pointer to dglInt32_t. It does not make sense to me but it compiles :-) The problem is when you have on your system different size of long and int, it is probably also the reason why it was not noticed so far (on 32 bit usually sizeof(int) == sizeof(long)). Because it seems that during this cast there are added bytes to be same size as long. However these bytes have random values and therefore results costs do not make sense. If this change is made everything seems ok: dglInt32_t dgl_cost; ... dgl_cost = cost; dglNodeSet_Attr(gr, dglGetNode(gr, (dglInt32_t) cat), & dgl_cost); Now there is: dglNodeSet_Attr(gr, dglGetNode(gr, (dglInt32_t) cat), (* dglInt32_t)(dglInt32_t) & cost); I have attached also patch. Best Stepan
nodes_costs.diff
Description: Binary data
_______________________________________________ grass-dev mailing list grass-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-dev