Fix clang-tidy and clazy warnings

This commit is contained in:
Mat Sutcliffe
2021-08-27 16:21:41 +01:00
parent 2aeacf49a7
commit eb6b0ff289
122 changed files with 197 additions and 205 deletions

View File

@@ -56,7 +56,7 @@ namespace BlackCore
void CReceiverSampleProvider::setBypassEffects(bool value)
{
for (CCallsignSampleProvider *voiceInput : m_voiceInputs)
for (CCallsignSampleProvider *voiceInput : std::as_const(m_voiceInputs))
{
voiceInput->setBypassEffects(value);
}
@@ -66,7 +66,7 @@ namespace BlackCore
{
if (frequencyHz != m_frequencyHz)
{
for (CCallsignSampleProvider *voiceInput : m_voiceInputs)
for (CCallsignSampleProvider *voiceInput : std::as_const(m_voiceInputs))
{
voiceInput->clear();
}
@@ -88,7 +88,7 @@ namespace BlackCore
m_mute = value;
if (value)
{
for (CCallsignSampleProvider *voiceInput : m_voiceInputs)
for (CCallsignSampleProvider *voiceInput : std::as_const(m_voiceInputs))
{
voiceInput->clear();
}
@@ -120,7 +120,7 @@ namespace BlackCore
if (numberOfInUseInputs != m_lastNumberOfInUseInputs)
{
QStringList receivingCallsigns;
for (const CCallsignSampleProvider *voiceInput : m_voiceInputs)
for (const CCallsignSampleProvider *voiceInput : std::as_const(m_voiceInputs))
{
const QString callsign = voiceInput->callsign();
if (!callsign.isEmpty())
@@ -221,7 +221,7 @@ namespace BlackCore
QString l;
int no = 0;
for (const CCallsignSampleProvider *sp : m_voiceInputs)
for (const CCallsignSampleProvider *sp : std::as_const(m_voiceInputs))
{
if (!sp || !sp->inUse()) { continue; } // only log the ones in use
l += (l.isEmpty() ? QStringLiteral("") : QStringLiteral("\n")) %

View File

@@ -50,7 +50,7 @@ namespace BlackCore
void CSoundcardSampleProvider::setBypassEffects(bool value)
{
for (CReceiverSampleProvider *receiverInput : m_receiverInputs)
for (CReceiverSampleProvider *receiverInput : std::as_const(m_receiverInputs))
{
receiverInput->setBypassEffects(value);
}
@@ -60,7 +60,7 @@ namespace BlackCore
{
if (active)
{
if (txTransceivers.size() > 0)
if (!txTransceivers.isEmpty())
{
QVector<TxTransceiverDto> txTransceiversFiltered = txTransceivers;
@@ -84,7 +84,7 @@ namespace BlackCore
}
else
{
for (CReceiverSampleProvider *receiverInput : m_receiverInputs)
for (CReceiverSampleProvider *receiverInput : std::as_const(m_receiverInputs))
{
receiverInput->setMute(false);
}
@@ -111,7 +111,7 @@ namespace BlackCore
return a.distanceRatio > b.distanceRatio;
});
if (rxTransceiversFilteredAndSorted.size() > 0)
if (!rxTransceiversFilteredAndSorted.isEmpty())
{
bool audioPlayed = false;
QVector<quint16> handledTransceiverIDs;
@@ -171,7 +171,7 @@ namespace BlackCore
}
}
for (CReceiverSampleProvider *receiverInput : m_receiverInputs)
for (CReceiverSampleProvider *receiverInput : std::as_const(m_receiverInputs))
{
const quint16 transceiverID = receiverInput->getId();
const bool contains = std::any_of(radioTransceivers.cbegin(), radioTransceivers.cend(), [ transceiverID ](const auto &tx) { return transceiverID == tx.id; });