diff --git a/include/chinese/chinesePostman.hpp b/include/chinese/chinesePostman.hpp index fe4d529a1e..501769a111 100644 --- a/include/chinese/chinesePostman.hpp +++ b/include/chinese/chinesePostman.hpp @@ -139,7 +139,6 @@ PgrDirectedChPPGraph::PgrDirectedChPPGraph(const std::vector &dataEdges) // calcu deg & build part of edges std::map deg; - size_t i(0); for (const auto &e : originalEdges) { pgassert(e.cost > 0); /* has out going edge */ @@ -165,7 +164,6 @@ PgrDirectedChPPGraph::PgrDirectedChPPGraph(const std::vector &dataEdges) edge.capacity = (std::numeric_limits::max)(); edge.cost = e.cost; edges.push_back(edge); - ++i; } superSource = deg.rbegin()->first + 1; diff --git a/src/astar/astar.c b/src/astar/astar.c index 444a29b754..1bf9284269 100644 --- a/src/astar/astar.c +++ b/src/astar/astar.c @@ -184,7 +184,7 @@ _pgr_astar(PG_FUNCTION_ARGS) { int64_t seq = call_cntr == 0? 1 : result_tuples[call_cntr - 1].start_id; values[0] = Int32GetDatum((int32_t)call_cntr + 1); - values[1] = Int32GetDatum(seq); + values[1] = Int32GetDatum((int32_t)seq); values[2] = Int64GetDatum(result_tuples[call_cntr].start_id); values[3] = Int64GetDatum(result_tuples[call_cntr].end_id); values[4] = Int64GetDatum(result_tuples[call_cntr].node); diff --git a/src/bdAstar/bdAstar.c b/src/bdAstar/bdAstar.c index 06f2404c0a..64359b91dd 100644 --- a/src/bdAstar/bdAstar.c +++ b/src/bdAstar/bdAstar.c @@ -179,8 +179,8 @@ _pgr_bdastar(PG_FUNCTION_ARGS) { int64_t seq = call_cntr == 0? 1 : result_tuples[call_cntr - 1].start_id; - values[0] = Int32GetDatum(call_cntr + 1); - values[1] = Int32GetDatum(seq); + values[0] = Int32GetDatum((int32_t)call_cntr + 1); + values[1] = Int32GetDatum((int32_t)seq); values[2] = Int64GetDatum(result_tuples[call_cntr].start_id); values[3] = Int64GetDatum(result_tuples[call_cntr].end_id); values[4] = Int64GetDatum(result_tuples[call_cntr].node); diff --git a/src/bdDijkstra/bdDijkstra.c b/src/bdDijkstra/bdDijkstra.c index ec75c82317..843efdf289 100644 --- a/src/bdDijkstra/bdDijkstra.c +++ b/src/bdDijkstra/bdDijkstra.c @@ -161,8 +161,8 @@ PGDLLEXPORT Datum _pgr_bddijkstra(PG_FUNCTION_ARGS) { int64_t seq = call_cntr == 0? 1 : result_tuples[call_cntr - 1].start_id; - values[0] = Int32GetDatum(call_cntr + 1); - values[1] = Int32GetDatum(seq); + values[0] = Int32GetDatum((int32_t)call_cntr + 1); + values[1] = Int32GetDatum((int32_t)seq); values[2] = Int64GetDatum(result_tuples[call_cntr].start_id); values[3] = Int64GetDatum(result_tuples[call_cntr].end_id); values[4] = Int64GetDatum(result_tuples[call_cntr].node); diff --git a/src/bellman_ford/bellman_ford.c b/src/bellman_ford/bellman_ford.c index a26e0e6303..60962c06de 100644 --- a/src/bellman_ford/bellman_ford.c +++ b/src/bellman_ford/bellman_ford.c @@ -165,8 +165,8 @@ _pgr_bellmanford(PG_FUNCTION_ARGS) { int64_t seq = funcctx->call_cntr == 0? 1 : result_tuples[funcctx->call_cntr - 1].start_id; - values[0] = Int32GetDatum(funcctx->call_cntr + 1); - values[1] = Int32GetDatum(seq); + values[0] = Int32GetDatum((int32_t)funcctx->call_cntr + 1); + values[1] = Int32GetDatum((int32_t)seq); values[2] = Int64GetDatum(result_tuples[funcctx->call_cntr].start_id); values[3] = Int64GetDatum(result_tuples[funcctx->call_cntr].end_id); values[4] = Int64GetDatum(result_tuples[funcctx->call_cntr].node); diff --git a/src/bellman_ford/bellman_ford_neg.c b/src/bellman_ford/bellman_ford_neg.c index c922f781a5..d5c9f1fe4b 100644 --- a/src/bellman_ford/bellman_ford_neg.c +++ b/src/bellman_ford/bellman_ford_neg.c @@ -169,7 +169,7 @@ _pgr_bellmanfordneg(PG_FUNCTION_ARGS) { int64_t seq = funcctx->call_cntr == 0? 1 : result_tuples[funcctx->call_cntr - 1].start_id; values[0] = Int32GetDatum(funcctx->call_cntr + 1); - values[1] = Int32GetDatum(seq); + values[1] = Int32GetDatum((int32_t)seq); values[2] = Int64GetDatum(result_tuples[funcctx->call_cntr].start_id); values[3] = Int64GetDatum(result_tuples[funcctx->call_cntr].end_id); values[4] = Int64GetDatum(result_tuples[funcctx->call_cntr].node); diff --git a/src/bellman_ford/edwardMoore.c b/src/bellman_ford/edwardMoore.c index 7e14b5dd3a..929dacf36d 100644 --- a/src/bellman_ford/edwardMoore.c +++ b/src/bellman_ford/edwardMoore.c @@ -158,8 +158,8 @@ PGDLLEXPORT Datum _pgr_edwardmoore(PG_FUNCTION_ARGS) { int64_t seq = funcctx->call_cntr == 0? 1 : result_tuples[funcctx->call_cntr - 1].start_id; - values[0] = Int32GetDatum(funcctx->call_cntr + 1); - values[1] = Int32GetDatum(seq); + values[0] = Int32GetDatum((int32_t) funcctx->call_cntr + 1); + values[1] = Int32GetDatum((int32_t)seq); values[2] = Int64GetDatum(result_tuples[funcctx->call_cntr].start_id); values[3] = Int64GetDatum(result_tuples[funcctx->call_cntr].end_id); values[4] = Int64GetDatum(result_tuples[funcctx->call_cntr].node); diff --git a/src/breadthFirstSearch/binaryBreadthFirstSearch.c b/src/breadthFirstSearch/binaryBreadthFirstSearch.c index 423628c0c2..e8a5734a29 100644 --- a/src/breadthFirstSearch/binaryBreadthFirstSearch.c +++ b/src/breadthFirstSearch/binaryBreadthFirstSearch.c @@ -158,8 +158,8 @@ PGDLLEXPORT Datum _pgr_binarybreadthfirstsearch(PG_FUNCTION_ARGS) { int64_t seq = funcctx->call_cntr == 0? 1 : result_tuples[funcctx->call_cntr - 1].start_id; - values[0] = Int32GetDatum(funcctx->call_cntr + 1); - values[1] = Int32GetDatum(seq); + values[0] = Int32GetDatum((int32_t)funcctx->call_cntr + 1); + values[1] = Int32GetDatum((int32_t)seq); values[2] = Int64GetDatum(result_tuples[funcctx->call_cntr].start_id); values[3] = Int64GetDatum(result_tuples[funcctx->call_cntr].end_id); values[4] = Int64GetDatum(result_tuples[funcctx->call_cntr].node); diff --git a/src/common/basePath_SSEC.cpp b/src/common/basePath_SSEC.cpp index d80d0caf42..c2f62c6825 100644 --- a/src/common/basePath_SSEC.cpp +++ b/src/common/basePath_SSEC.cpp @@ -234,7 +234,6 @@ void Path::append(const Path &other) { void Path::generate_postgres_data( Path_rt **postgres_data, size_t &sequence) const { - int i = 1; for (const auto e : path) { auto agg_cost = std::fabs( e.agg_cost - (std::numeric_limits::max)()) < 1? @@ -243,7 +242,6 @@ void Path::generate_postgres_data( std::numeric_limits::infinity() : e.cost; (*postgres_data)[sequence] = {start_id(), end_id(), e.node, e.edge, cost, agg_cost}; - ++i; ++sequence; } } diff --git a/src/dagShortestPath/dagShortestPath.c b/src/dagShortestPath/dagShortestPath.c index 8e50d3fe1e..74295b2a90 100644 --- a/src/dagShortestPath/dagShortestPath.c +++ b/src/dagShortestPath/dagShortestPath.c @@ -165,8 +165,8 @@ PGDLLEXPORT Datum _pgr_dagshortestpath(PG_FUNCTION_ARGS) { int64_t seq = funcctx->call_cntr == 0? 1 : result_tuples[funcctx->call_cntr - 1].start_id; - values[0] = Int32GetDatum(funcctx->call_cntr + 1); - values[1] = Int32GetDatum(seq); + values[0] = Int32GetDatum((int32_t)funcctx->call_cntr + 1); + values[1] = Int32GetDatum((int32_t)seq); values[2] = Int64GetDatum(result_tuples[funcctx->call_cntr].node); values[3] = Int64GetDatum(result_tuples[funcctx->call_cntr].edge); values[4] = Float8GetDatum(result_tuples[funcctx->call_cntr].cost); diff --git a/src/dijkstra/dijkstra.c b/src/dijkstra/dijkstra.c index 2dc6c82993..0e47f3a641 100644 --- a/src/dijkstra/dijkstra.c +++ b/src/dijkstra/dijkstra.c @@ -218,8 +218,8 @@ _pgr_dijkstra(PG_FUNCTION_ARGS) { int64_t seq = call_cntr == 0? 1 : result_tuples[call_cntr - 1].start_id; - values[0] = Int32GetDatum(call_cntr + 1); - values[1] = Int32GetDatum(seq); + values[0] = Int32GetDatum((int32_t)call_cntr + 1); + values[1] = Int32GetDatum((int32_t)seq); values[2] = Int64GetDatum(result_tuples[call_cntr].start_id); values[3] = Int64GetDatum(result_tuples[call_cntr].end_id); values[4] = Int64GetDatum(result_tuples[call_cntr].node); diff --git a/src/driving_distance/driving_distance.c b/src/driving_distance/driving_distance.c index c60255f819..d687beb3da 100644 --- a/src/driving_distance/driving_distance.c +++ b/src/driving_distance/driving_distance.c @@ -142,7 +142,7 @@ _pgr_drivingdistancev4(PG_FUNCTION_ARGS) { for (i = 0; i < numb; ++i) { nulls[i] = false; } - values[0] = Int32GetDatum(funcctx->call_cntr + 1); + values[0] = Int32GetDatum((int32_t)funcctx->call_cntr + 1); values[1] = Int64GetDatum(result_tuples[funcctx->call_cntr].depth); values[2] = Int64GetDatum(result_tuples[funcctx->call_cntr].from_v); values[3] = Int64GetDatum(result_tuples[funcctx->call_cntr].pred); diff --git a/src/driving_distance/driving_distance_withPoints.c b/src/driving_distance/driving_distance_withPoints.c index 130e633f97..236f23546c 100644 --- a/src/driving_distance/driving_distance_withPoints.c +++ b/src/driving_distance/driving_distance_withPoints.c @@ -176,7 +176,7 @@ _pgr_withpointsddv4(PG_FUNCTION_ARGS) { nulls[i] = false; } - values[0] = Int64GetDatum(funcctx->call_cntr + 1); + values[0] = Int64GetDatum((int64_t)funcctx->call_cntr + 1); values[1] = Int64GetDatum(result_tuples[funcctx->call_cntr].depth); values[2] = Int64GetDatum(result_tuples[funcctx->call_cntr].from_v); values[3] = Int64GetDatum(result_tuples[funcctx->call_cntr].pred); diff --git a/src/ksp/ksp.c b/src/ksp/ksp.c index 100b6708a2..5476f588bd 100644 --- a/src/ksp/ksp.c +++ b/src/ksp/ksp.c @@ -197,9 +197,9 @@ _pgr_ksp(PG_FUNCTION_ARGS) { } int64_t seq = funcctx->call_cntr == 0? 1 : path[funcctx->call_cntr - 1].end_id; - values[0] = Int32GetDatum(funcctx->call_cntr + 1); - values[1] = Int32GetDatum(path_id); - values[2] = Int32GetDatum(seq); + values[0] = Int32GetDatum((int32_t)funcctx->call_cntr + 1); + values[1] = Int32GetDatum((int32_t)path_id); + values[2] = Int32GetDatum((int32_t)seq); if (PG_NARGS() != 6) { values[3] = Int64GetDatum(path[funcctx->call_cntr].start_id); values[4] = Int64GetDatum(path[funcctx->call_cntr].end_id); diff --git a/src/ksp/turnRestrictedPath.c b/src/ksp/turnRestrictedPath.c index 34eb7eb90e..e0de7adbf8 100644 --- a/src/ksp/turnRestrictedPath.c +++ b/src/ksp/turnRestrictedPath.c @@ -175,9 +175,9 @@ _pgr_turnrestrictedpath(PG_FUNCTION_ARGS) { int64_t seq = funcctx->call_cntr == 0? 1 : path[funcctx->call_cntr - 1].start_id; - values[0] = Int32GetDatum(funcctx->call_cntr + 1); - values[1] = Int32GetDatum(path[funcctx->call_cntr].start_id + 1); - values[2] = Int32GetDatum(seq); + values[0] = Int32GetDatum((int32_t)funcctx->call_cntr + 1); + values[1] = Int32GetDatum((int32_t)path[funcctx->call_cntr].start_id + 1); + values[2] = Int32GetDatum((int32_t)seq); values[3] = Int64GetDatum(path[funcctx->call_cntr].node); values[4] = Int64GetDatum(path[funcctx->call_cntr].edge); values[5] = Float8GetDatum(path[funcctx->call_cntr].cost); diff --git a/src/ksp/withPoints_ksp.c b/src/ksp/withPoints_ksp.c index 0632ef6854..316bf102b5 100644 --- a/src/ksp/withPoints_ksp.c +++ b/src/ksp/withPoints_ksp.c @@ -249,9 +249,9 @@ PGDLLEXPORT Datum _pgr_withpointsksp(PG_FUNCTION_ARGS) { } int64_t seq = funcctx->call_cntr == 0? 1 : result_tuples[funcctx->call_cntr - 1].end_id; - values[0] = Int32GetDatum(funcctx->call_cntr + 1); - values[1] = Int32GetDatum(path_id); - values[2] = Int32GetDatum(seq); + values[0] = Int32GetDatum((int32_t)funcctx->call_cntr + 1); + values[1] = Int32GetDatum((int32_t)path_id); + values[2] = Int32GetDatum((int32_t)seq); if (PG_NARGS() != 9) { values[3] = Int64GetDatum(result_tuples[funcctx->call_cntr].start_id); values[4] = Int64GetDatum(result_tuples[funcctx->call_cntr].end_id); diff --git a/src/trsp/trsp.c b/src/trsp/trsp.c index fe7a6cd3bc..8a221bd575 100644 --- a/src/trsp/trsp.c +++ b/src/trsp/trsp.c @@ -161,7 +161,7 @@ _pgr_trspv4(PG_FUNCTION_ARGS) { int64_t path_seq = call_cntr == 0? 1 : result_tuples[call_cntr - 1].start_id; values[0] = Int32GetDatum((int32_t)call_cntr + 1); - values[1] = Int32GetDatum(path_seq); + values[1] = Int32GetDatum((int32_t)path_seq); values[2] = Int64GetDatum(result_tuples[call_cntr].start_id); values[3] = Int64GetDatum(result_tuples[call_cntr].end_id); values[4] = Int64GetDatum(result_tuples[call_cntr].node); @@ -257,7 +257,7 @@ _v4trsp(PG_FUNCTION_ARGS) { int64_t path_seq = call_cntr == 0? 1 : result_tuples[call_cntr - 1].start_id; values[0] = Int32GetDatum((int32_t)call_cntr + 1); - values[1] = Int32GetDatum(path_seq); + values[1] = Int32GetDatum((int32_t)path_seq); values[2] = Int64GetDatum(result_tuples[call_cntr].start_id); values[3] = Int64GetDatum(result_tuples[call_cntr].end_id); values[4] = Int64GetDatum(result_tuples[call_cntr].node); @@ -341,8 +341,8 @@ _trsp(PG_FUNCTION_ARGS) { int64_t path_seq = call_cntr == 0? 1 : result_tuples[call_cntr - 1].start_id; - values[0] = Int32GetDatum(call_cntr + 1); - values[1] = Int32GetDatum(path_seq); + values[0] = Int32GetDatum((int32_t)call_cntr + 1); + values[1] = Int32GetDatum((int32_t)path_seq); values[2] = Int64GetDatum(result_tuples[call_cntr].start_id); values[3] = Int64GetDatum(result_tuples[call_cntr].end_id); values[4] = Int64GetDatum(result_tuples[call_cntr].node); diff --git a/src/trsp/trsp_withPoints.c b/src/trsp/trsp_withPoints.c index 5f0f04cee5..87052fd311 100644 --- a/src/trsp/trsp_withPoints.c +++ b/src/trsp/trsp_withPoints.c @@ -206,8 +206,8 @@ _pgr_trsp_withpoints(PG_FUNCTION_ARGS) { } int64_t seq = call_cntr == 0? 1 : result_tuples[call_cntr - 1].start_id; - values[0] = Int32GetDatum(call_cntr + 1); - values[1] = Int32GetDatum(seq); + values[0] = Int32GetDatum((int32_t)call_cntr + 1); + values[1] = Int32GetDatum((int32_t)seq); values[2] = Int64GetDatum(result_tuples[call_cntr].start_id); values[3] = Int64GetDatum(result_tuples[call_cntr].end_id); values[4] = Int64GetDatum(result_tuples[call_cntr].node); diff --git a/src/tsp/tsp.cpp b/src/tsp/tsp.cpp index cfb0a1887a..8023905861 100644 --- a/src/tsp/tsp.cpp +++ b/src/tsp/tsp.cpp @@ -230,7 +230,7 @@ TSP::tsp( auto u = get_boost_vertex(start_vid); auto v = get_boost_vertex(end_vid); - auto dummy_node = add_vertex(num_vertices(graph), graph); + auto dummy_node = add_vertex(static_cast(num_vertices(graph)), graph); id_to_V.insert(std::make_pair(0, dummy_node)); V_to_id.insert(std::make_pair(dummy_node, 0)); boost::add_edge(u, dummy_node, 0, graph); @@ -299,8 +299,8 @@ TSP::TSP(std::vector &distances) { } } - size_t i {0}; - for (const auto id : ids) { + int i {0}; + for (const auto &id : ids) { auto v = add_vertex(i, graph); id_to_V.insert(std::make_pair(id, v)); V_to_id.insert(std::make_pair(v, id)); @@ -384,7 +384,7 @@ TSP::TSP(const std::vector &coordinates) { /* * Inserting vertices */ - size_t i{0}; + int i{0}; for (const auto &id : ids) { auto v = add_vertex(i, graph); id_to_V.insert(std::make_pair(id, v)); diff --git a/src/withPoints/withPoints.c b/src/withPoints/withPoints.c index 4325e8ce30..6a2036bab8 100644 --- a/src/withPoints/withPoints.c +++ b/src/withPoints/withPoints.c @@ -200,8 +200,8 @@ _pgr_withpoints(PG_FUNCTION_ARGS) { int64_t seq = funcctx->call_cntr == 0? 1 : result_tuples[funcctx->call_cntr - 1].start_id; - values[0] = Int32GetDatum(funcctx->call_cntr + 1); - values[1] = Int32GetDatum(seq); + values[0] = Int32GetDatum((int32_t)funcctx->call_cntr + 1); + values[1] = Int32GetDatum((int32_t)seq); values[2] = Int64GetDatum(result_tuples[funcctx->call_cntr].start_id); values[3] = Int64GetDatum(result_tuples[funcctx->call_cntr].end_id); values[4] = Int64GetDatum(result_tuples[funcctx->call_cntr].node); diff --git a/src/withPoints/withPoints.cpp b/src/withPoints/withPoints.cpp index df4c9f6a83..9123fed8de 100644 --- a/src/withPoints/withPoints.cpp +++ b/src/withPoints/withPoints.cpp @@ -341,7 +341,6 @@ Pg_points_graph::create_new_edges() { << point.vertex_id << "\n"; } - int64_t vertex_id = 1; std::vector< Point_on_edge_t > new_points; for (const auto edge : m_edges_of_points) { std::set< Point_on_edge_t, pointCompare> points_on_edge; @@ -400,7 +399,6 @@ Pg_points_graph::create_new_edges() { if (point.fraction > 0 && point.fraction < 1) { log << "vertex_id of the point is " << -point.pid << "\n"; point.vertex_id = -point.pid; - ++vertex_id; } new_points.push_back(point);