Skip to content

Commit

Permalink
clazy: Fix a couple of range-loop warnings.
Browse files Browse the repository at this point in the history
From the clazy docs: Finds places where you're using C++11 range-loops
with non-const Qt containers (potential detach).
  • Loading branch information
linuxdude42 committed Nov 1, 2020
1 parent b4aea72 commit e71ca12
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion mythtv/libs/libmythmetadata/imagemanager.cpp
Expand Up @@ -313,7 +313,8 @@ ImageAdapterBase::ImageAdapterBase() :
{
// Generate glob list from supported extensions
QStringList glob;
for (const auto& ext : (m_imageFileExt + m_videoFileExt))
QStringList allExt = m_imageFileExt + m_videoFileExt;
for (const auto& ext : qAsConst(allExt))
glob << "*." + ext;

// Apply filters to only detect image files
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/overlays/mythnavigationoverlay.cpp
Expand Up @@ -61,7 +61,7 @@ bool MythNavigationOverlay::Create()
if (i != m_visibleGroup)
group->SetVisible(false);
QList<MythUIType *> * children = group->GetAllChildren();
for (auto * child : *children)
for (auto * child : qAsConst(*children))
{
if (child != more)
{
Expand Down
6 changes: 3 additions & 3 deletions mythtv/libs/libmythui/platforms/mythscreensaverdbus.cpp
Expand Up @@ -138,19 +138,19 @@ MythScreenSaverDBus::MythScreenSaverDBus(QObject *Parent)
MythScreenSaverDBus::~MythScreenSaverDBus()
{
MythScreenSaverDBus::Restore();
for (auto * interface : m_dbusPrivateInterfaces)
for (auto * interface : qAsConst(m_dbusPrivateInterfaces))
delete interface;
}

void MythScreenSaverDBus::Disable()
{
for (auto * interface : m_dbusPrivateInterfaces)
for (auto * interface : qAsConst(m_dbusPrivateInterfaces))
interface->Inhibit();
}

void MythScreenSaverDBus::Restore()
{
for (auto * interface : m_dbusPrivateInterfaces)
for (auto * interface : qAsConst(m_dbusPrivateInterfaces))
interface->UnInhibit();
}

Expand Down
2 changes: 1 addition & 1 deletion mythtv/programs/mythfrontend/gallerythumbview.cpp
Expand Up @@ -938,7 +938,7 @@ void GalleryThumbView::UpdateScanProgress(const QString &scanner,
// Aggregate all running scans
int currentAgg = 0;
int totalAgg = 0;
for (IntPair scan : m_scanProgress)
for (IntPair scan : qAsConst(m_scanProgress))
{
currentAgg += scan.first;
totalAgg += scan.second;
Expand Down

0 comments on commit e71ca12

Please sign in to comment.