Skip to content

Commit

Permalink
(C++) fix warning on C++13.2
Browse files Browse the repository at this point in the history
  • Loading branch information
cvvergara committed Oct 21, 2024
1 parent 73a2abb commit 38bd74a
Show file tree
Hide file tree
Showing 21 changed files with 39 additions and 45 deletions.
2 changes: 0 additions & 2 deletions include/chinese/chinesePostman.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ PgrDirectedChPPGraph::PgrDirectedChPPGraph(const std::vector<Edge_t> &dataEdges)

// calcu deg & build part of edges
std::map<int64_t, int> deg;
size_t i(0);
for (const auto &e : originalEdges) {
pgassert(e.cost > 0);
/* has out going edge */
Expand All @@ -165,7 +164,6 @@ PgrDirectedChPPGraph::PgrDirectedChPPGraph(const std::vector<Edge_t> &dataEdges)
edge.capacity = (std::numeric_limits<int32_t>::max)();
edge.cost = e.cost;
edges.push_back(edge);
++i;
}

superSource = deg.rbegin()->first + 1;
Expand Down
2 changes: 1 addition & 1 deletion src/astar/astar.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/bdAstar/bdAstar.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/bdDijkstra/bdDijkstra.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/bellman_ford/bellman_ford.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/bellman_ford/bellman_ford_neg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/bellman_ford/edwardMoore.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/breadthFirstSearch/binaryBreadthFirstSearch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions src/common/basePath_SSEC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<double>::max)()) < 1?
Expand All @@ -243,7 +242,6 @@ void Path::generate_postgres_data(
std::numeric_limits<double>::infinity() : e.cost;

(*postgres_data)[sequence] = {start_id(), end_id(), e.node, e.edge, cost, agg_cost};
++i;
++sequence;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/dagShortestPath/dagShortestPath.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/dijkstra/dijkstra.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/driving_distance/driving_distance.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/driving_distance/driving_distance_withPoints.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/ksp/ksp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/ksp/turnRestrictedPath.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/ksp/withPoints_ksp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions src/trsp/trsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/trsp/trsp_withPoints.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions src/tsp/tsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>(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);
Expand Down Expand Up @@ -299,8 +299,8 @@ TSP::TSP(std::vector<IID_t_rt> &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));
Expand Down Expand Up @@ -384,7 +384,7 @@ TSP::TSP(const std::vector<Coordinate_t> &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));
Expand Down
4 changes: 2 additions & 2 deletions src/withPoints/withPoints.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions src/withPoints/withPoints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 38bd74a

Please sign in to comment.