From 4bab7afaa4943bb627c25ec4e55e383c39dd14bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Sun, 9 Oct 2016 20:25:55 +0200 Subject: prevent range overflow whenever dealing with unsigned, there's better no "-" in the line ... --- src/FbTk/Container.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FbTk/Container.cc b/src/FbTk/Container.cc index 0ddc421..6270c6a 100644 --- a/src/FbTk/Container.cc +++ b/src/FbTk/Container.cc @@ -404,7 +404,7 @@ void Container::repositionItems() { for (int i = 0; i < buttonDemands.size(); ++i) { if (buttonDemands.at(i) > thresh) { int d = buttonDemands.at(i)*overhead/greed; - if (buttonDemands.at(i) - d > mean) { + if (buttonDemands.at(i) > mean + d) { buttonDemands.at(i) -= d; } else { // do not shrink below mean or a huge item number would super-punish larger ones d = buttonDemands.at(i) - mean; -- cgit v0.11.2