diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2018-10-14 12:00:03 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-14 17:30:32 +0200 |
commit | 19be86249dcc5b13b3c95f5469600fa2bc1b749b (patch) | |
tree | e1468590650eea60e3897a8cb8b7c36bb9ab996b /vcl/source/window/layout.cxx | |
parent | 7758115d15ded2afd81946df0865ecc831b179aa (diff) |
Simplify containers iterations in vcl
Use range-based loop or replace with STL functions.
Change-Id: Ide2f89194238ae6a1f21e8132e2297710d9e6dcd
Reviewed-on: https://gerrit.libreoffice.org/61756
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source/window/layout.cxx')
-rw-r--r-- | vcl/source/window/layout.cxx | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index 2b4ac9c11b9c..d1a539acea09 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -549,9 +549,8 @@ Size VclButtonBox::addReqGroups(const VclButtonBox::Requisition &rReq) const static long getMaxNonOutlier(const std::vector<long> &rG, long nAvgDimension) { long nMaxDimensionNonOutlier = 0; - for (auto const& elem : rG) + for (auto const& nPrimaryChildDimension : rG) { - long nPrimaryChildDimension = elem; if (nPrimaryChildDimension < nAvgDimension * 1.5) { nMaxDimensionNonOutlier = std::max(nPrimaryChildDimension, @@ -569,13 +568,13 @@ static std::vector<long> setButtonSizes(const std::vector<long> &rG, //set everything < 1.5 times the average to the same width, leave the //outliers un-touched std::vector<bool>::const_iterator aJ = rNonHomogeneous.begin(); - for (auto const& elem : rG) + auto nNonOutlierWidth = std::max(nMaxNonOutlier, nMinWidth); + for (auto const& nPrimaryChildDimension : rG) { - long nPrimaryChildDimension = elem; bool bNonHomogeneous = *aJ; if (!bNonHomogeneous && nPrimaryChildDimension < nAvgDimension * 1.5) { - aVec.push_back(std::max(nMaxNonOutlier, nMinWidth)); + aVec.push_back(nNonOutlierWidth); } else { |