From 58347a5dc583f49e56aacd1b83f5491c338ba716 Mon Sep 17 00:00:00 2001 From: Dimitris Panokostas Date: Sun, 10 Nov 2024 15:01:44 +0100 Subject: [PATCH] Use for range loop, fix compiler warnings - Use for range loop - Fix warnings about type mismatch (int vs unsigned int) --- src/widgets/container.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/widgets/container.cpp b/src/widgets/container.cpp index d97991f..9b5e9b5 100644 --- a/src/widgets/container.cpp +++ b/src/widgets/container.cpp @@ -167,26 +167,25 @@ namespace gcn graphics->pushClipArea(getChildrenArea()); std::list children = getChildren(); - std::list::iterator iter; - for (iter = children.begin(); iter != children.end(); ++iter) + for (const auto& iter : children) { - if ((*iter)->isVisible()) + if (iter->isVisible()) { // If the widget has a frame, // draw it before drawing the widget - if ((*iter)->getFrameSize() > 0) + if (iter->getFrameSize() > 0) { - Rectangle rec = (*iter)->getDimension(); - rec.x -= (*iter)->getFrameSize(); - rec.y -= (*iter)->getFrameSize(); - rec.width += 2 * (*iter)->getFrameSize(); - rec.height += 2 * (*iter)->getFrameSize(); + Rectangle rec = iter->getDimension(); + rec.x -= static_cast(iter->getFrameSize()); + rec.y -= static_cast(iter->getFrameSize()); + rec.width += static_cast(2 * iter->getFrameSize()); + rec.height += static_cast(2 * iter->getFrameSize()); graphics->pushClipArea(rec); - (*iter)->drawFrame(graphics); + iter->drawFrame(graphics); graphics->popClipArea(); } - graphics->pushClipArea((*iter)->getDimension()); - (*iter)->draw(graphics); + graphics->pushClipArea(iter->getDimension()); + iter->draw(graphics); graphics->popClipArea(); } }