refs #937 Resolved clazy warnings: unnecessary detaching of containers.

This commit is contained in:
Mathew Sutcliffe
2017-04-15 01:19:26 +01:00
parent ce1730b453
commit fce1513dae
25 changed files with 108 additions and 63 deletions

View File

@@ -163,6 +163,6 @@ const QDBusArgument &operator >>(const QDBusArgument &arg, BlackCore::Context::C
{
QList<CLogSubscriptionPair> listOfPairs;
arg >> listOfPairs;
for (const auto &pair : listOfPairs) { hash.insert(pair.first, pair.second); }
for (const auto &pair : as_const(listOfPairs)) { hash.insert(pair.first, pair.second); }
return arg;
}

View File

@@ -552,7 +552,7 @@ namespace BlackCore
QSharedPointer<IVoiceChannel> CContextAudio::getVoiceChannelBy(const CVoiceRoom &voiceRoom)
{
QSharedPointer<IVoiceChannel> voiceChannel;
for (const auto &channel : m_voiceChannelMapping.values())
for (const auto &channel : as_const(m_voiceChannelMapping))
{
if (channel->getVoiceRoom().getVoiceRoomUrl() == voiceRoom.getVoiceRoomUrl()) voiceChannel = channel;
}

View File

@@ -16,6 +16,8 @@
#include <limits.h>
#include <QtGlobal>
// clazy:excludeall=detaching-member
using namespace BlackInput;
using namespace BlackMisc;
using namespace BlackMisc::Input;
@@ -107,7 +109,7 @@ namespace BlackCore
if (action.isEmpty()) { return; }
if (m_actionRelayingEnabled) emit remoteActionFromLocal(action, isKeyDown);
for (const auto &boundAction : m_boundActions)
for (const auto &boundAction : as_const(m_boundActions))
{
if (boundAction.m_action == action)
{

View File

@@ -97,10 +97,10 @@ namespace BlackCore
void CWeatherManager::fetchNextWeatherData()
{
const WeatherRequest weatherRequest = m_pendingRequests.first();
const WeatherRequest weatherRequest = m_pendingRequests.constFirst();
PhysicalQuantities::CLength maxDistance(100.0, CLengthUnit::km());
for (IWeatherData *plugin : m_weatherDataPlugins)
for (IWeatherData *plugin : as_const(m_weatherDataPlugins))
{
plugin->fetchWeatherData(weatherRequest.weatherGrid, maxDistance);
}
@@ -114,7 +114,7 @@ namespace BlackCore
Q_ASSERT(weatherDataPlugin);
auto fetchedWeatherGrid = weatherDataPlugin->getWeatherData();
const WeatherRequest weatherRequest = m_pendingRequests.first();
const WeatherRequest weatherRequest = m_pendingRequests.constFirst();
CWeatherGrid requestedWeatherGrid = weatherRequest.weatherGrid;
// Interpolation. So far it just picks the closest point without interpolation.