Verified Commit 6f96fab3 authored by Fushan Wen's avatar Fushan Wen 💬
Browse files

Use `std::accumulate` in `ShellCorona::_availableScreenRegion`

Consider using std::accumulate algorithm instead of a raw loop. (CWE-398) in shell/shellcorona.cpp:1051
parent bd7f3bcc
......@@ -1033,14 +1033,13 @@ QRegion ShellCorona::_availableScreenRegion(int id) const
return s ? s->availableGeometry() : QRegion();
}
QRegion r = view->geometry();
for (const PanelView *v : m_panelViews) {
return std::accumulate(m_panelViews.cbegin(), m_panelViews.cend(), QRegion(view->geometry()), [view](const QRegion &a, const PanelView *v) {
if (v->isVisible() && view->screen() == v->screen() && v->visibilityMode() != PanelView::AutoHide) {
// if the panel is being moved around, we still want to calculate it from the edge
r -= v->geometryByDistance(0);
return a - v->geometryByDistance(0);
}
}
return r;
return a;
});
}
QRect ShellCorona::availableScreenRect(int id) const
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment