From fe31a2500c3a0f583060a7822e0fb21c41850ac1 Mon Sep 17 00:00:00 2001 From: Nicklas Larsson Date: Mon, 28 Sep 2026 14:55:07 +0200 Subject: [PATCH 1/2] lib/vector/dgl: use fixed width integer types for dglInt[32|64]_t The types dglInt32_t and dglInt64_t were originally intended to be fixed-width integers, as indicated by the original commit from 2002 [1]. At the time, C99 (and ) was new and not yet widely supported, hence the use of long and long long. Today, long is 64 bits on platforms using the LP64 data model, including 64-bit Linux and macOS, while it remains 32 bits on Windows. This update restores the intended 32-bit width of dglInt32_t and uses an explicit 64-bit integer type for dglInt64_t. [1] https://github.com/OSGeo/grass-legacy/commit/0f9fd9f5ea0b18017c42a090c84f3c78856348a8#diff-311056b41101fbbecd4477b59c9dee3ddf50f64f38926d242790c78489e306ac --- lib/vector/dglib/type.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/vector/dglib/type.h b/lib/vector/dglib/type.h index 0374fb86799..27c5f745a99 100644 --- a/lib/vector/dglib/type.h +++ b/lib/vector/dglib/type.h @@ -20,8 +20,10 @@ #define G_NDR 1 #endif +#include + typedef unsigned char dglByte_t; -typedef long dglInt32_t; -typedef long long dglInt64_t; +typedef int32_t dglInt32_t; +typedef int64_t dglInt64_t; #endif From 04867c18874a83eb0b7d1d5835277bc9147b96c6 Mon Sep 17 00:00:00 2001 From: Nicklas Larsson Date: Mon, 28 Sep 2026 20:22:07 +0200 Subject: [PATCH 2/2] address warnings --- lib/vector/Vlib/graph.c | 2 +- lib/vector/Vlib/net_analyze.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/vector/Vlib/graph.c b/lib/vector/Vlib/graph.c index f708e190747..9230443f084 100644 --- a/lib/vector/Vlib/graph.c +++ b/lib/vector/Vlib/graph.c @@ -226,7 +226,7 @@ int Vect_graph_shortest_path(dglGraph_s *graph, int from, int to, if (List != NULL) { for (i = 0; i < pSPReport->cArc; i++) { line = dglEdgeGet_Id(graph, pSPReport->pArc[i].pnEdge); - G_debug(2, "From %ld to %ld - cost %ld user %d distance %ld", + G_debug(2, "From %d to %d - cost %d user %d distance %d", pSPReport->pArc[i].nFrom, pSPReport->pArc[i].nTo, /* this is the cost from clip() */ dglEdgeGet_Cost(graph, pSPReport->pArc[i].pnEdge) / 1000, diff --git a/lib/vector/Vlib/net_analyze.c b/lib/vector/Vlib/net_analyze.c index 9ad477484e3..f538835e326 100644 --- a/lib/vector/Vlib/net_analyze.c +++ b/lib/vector/Vlib/net_analyze.c @@ -71,7 +71,7 @@ static int convert_dgl_shortest_path_result(struct Map_info *Map, for (i = 0; i < pSPReport->cArc; i++) { line = dglEdgeGet_Id(&(Map->dgraph.graph_s), pSPReport->pArc[i].pnEdge); G_debug( - 2, "From %ld to %ld - cost %ld user %d distance %ld", + 2, "From %d to %d - cost %d user %d distance %d", pSPReport->pArc[i].nFrom, pSPReport->pArc[i].nTo, dglEdgeGet_Cost(&(Map->dgraph.graph_s), pSPReport->pArc[i].pnEdge) / Map->dgraph.cost_multip, /* this is the cost from clip() */ @@ -121,7 +121,7 @@ static int ttb_convert_dgl_shortest_path_result(struct Map_info *Map, line_id *= -1; G_debug( - 2, "From %ld to %ld - cost %ld user %d distance %ld", + 2, "From %d to %d - cost %d user %d distance %d", pSPReport->pArc[i].nFrom, pSPReport->pArc[i].nTo, dglEdgeGet_Cost(&(Map->dgraph.graph_s), pSPReport->pArc[i].pnEdge) / Map->dgraph.cost_multip, /* this is the cost from clip() */