summaryrefslogtreecommitdiff
path: root/src/linkgraph/mcf.cpp
diff options
context:
space:
mode:
authorRubidium <rubidium@openttd.org>2021-05-10 23:43:52 +0200
committerrubidium42 <rubidium42@users.noreply.github.com>2021-05-15 10:16:10 +0200
commitbb9121dbd4690405b54e7e6ed6e711ead16435ac (patch)
treeefb930ab320c6be74d4ca8e4d5d674e3d1e7812d /src/linkgraph/mcf.cpp
parent031e91de6e06e6b0d12603d78170f92f5def1d00 (diff)
downloadopenttd-bb9121dbd4690405b54e7e6ed6e711ead16435ac.tar.xz
Fix: comparison of narrow type to wide type in loop (potential for infinite loops)
Diffstat (limited to 'src/linkgraph/mcf.cpp')
-rw-r--r--src/linkgraph/mcf.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/linkgraph/mcf.cpp b/src/linkgraph/mcf.cpp
index 003412850..f24a8e028 100644
--- a/src/linkgraph/mcf.cpp
+++ b/src/linkgraph/mcf.cpp
@@ -260,7 +260,7 @@ void MultiCommodityFlow::Dijkstra(NodeID source_node, PathVector &paths)
{
typedef std::set<Tannotation *, typename Tannotation::Comparator> AnnoSet;
Tedge_iterator iter(this->job);
- uint size = this->job.Size();
+ uint16 size = this->job.Size();
AnnoSet annos;
paths.resize(size, nullptr);
for (NodeID node = 0; node < size; ++node) {
@@ -473,7 +473,7 @@ bool MCF1stPass::EliminateCycles(PathVector &path, NodeID origin_id, NodeID next
bool MCF1stPass::EliminateCycles()
{
bool cycles_found = false;
- uint size = this->job.Size();
+ uint16 size = this->job.Size();
PathVector path(size, nullptr);
for (NodeID node = 0; node < size; ++node) {
/* Starting at each node in the graph find all cycles involving this
@@ -491,7 +491,7 @@ bool MCF1stPass::EliminateCycles()
MCF1stPass::MCF1stPass(LinkGraphJob &job) : MultiCommodityFlow(job)
{
PathVector paths;
- uint size = job.Size();
+ uint16 size = job.Size();
uint accuracy = job.Settings().accuracy;
bool more_loops;
std::vector<bool> finished_sources(size);
@@ -540,7 +540,7 @@ MCF2ndPass::MCF2ndPass(LinkGraphJob &job) : MultiCommodityFlow(job)
{
this->max_saturation = UINT_MAX; // disable artificial cap on saturation
PathVector paths;
- uint size = job.Size();
+ uint16 size = job.Size();
uint accuracy = job.Settings().accuracy;
bool demand_left = true;
std::vector<bool> finished_sources(size);