Fix cppcheck and compiler warnings

This commit is contained in:
Mat Sutcliffe
2020-06-18 23:48:58 +01:00
parent 9309beefc4
commit 670b1a1986
61 changed files with 131 additions and 153 deletions

View File

@@ -204,7 +204,7 @@ namespace BlackCore
// restart timer, normally it should be started already, paranoia
// as I run in "my thread" starting timer should be OK
{
QMutexLocker lock(&m_mutex);
QMutexLocker lock2(&m_mutex);
if (m_voiceServerTimer) { m_voiceServerTimer->start(PositionUpdatesMs); }
}
m_retryConnectAttempt = 0;
@@ -498,21 +498,21 @@ namespace BlackCore
quint32 roundedFrequencyHz = static_cast<quint32>(qRound(frequencyHz / 1000.0)) * 1000;
roundedFrequencyHz = this->getAliasFrequencyHz(roundedFrequencyHz);
bool updateTransceivers = false;
bool update = false;
{
QMutexLocker lockTransceivers(&m_mutexTransceivers);
if (m_transceivers.size() >= id + 1)
{
if (m_transceivers[id].frequencyHz != roundedFrequencyHz)
{
updateTransceivers = true;
update = true;
m_transceivers[id].frequencyHz = roundedFrequencyHz;
}
}
}
// outside lock to avoid deadlock
if (updateTransceivers)
if (update)
{
this->updateTransceivers(false); // no frequency update
}

View File

@@ -71,7 +71,7 @@ namespace BlackCore
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
// posted in QAM thread, reply is nullptr if called from another thread
QNetworkReply *reply = sApp->postToNetwork(request, CApplication::NoLogRequestId, QJsonDocument(obj).toJson(),
sApp->postToNetwork(request, CApplication::NoLogRequestId, QJsonDocument(obj).toJson(),
{
this, [ = ](QNetworkReply * nwReply)
{
@@ -125,7 +125,6 @@ namespace BlackCore
callback(m_isAuthenticated);
}
});
Q_UNUSED(reply)
}
PostCallsignResponseDto CApiServerConnection::addCallsign(const QString &callsign)
@@ -176,7 +175,7 @@ namespace BlackCore
QByteArray receivedData;
// posted in QAM thread, reply is nullptr if called from another thread
QNetworkReply *reply = sApp->getFromNetwork(request,
sApp->getFromNetwork(request,
{
this, [ =, &receivedData ](QNetworkReply * nwReply)
{
@@ -198,7 +197,6 @@ namespace BlackCore
if (loop) { loop->exit(); }
}
});
Q_UNUSED(reply)
if (loop) { loop->exec(); }
return receivedData;
@@ -212,7 +210,7 @@ namespace BlackCore
QByteArray receivedData;
// posted in QAM thread, reply is nullptr if called from another thread
QNetworkReply *reply = sApp->postToNetwork(request, CApplication::NoLogRequestId, data,
sApp->postToNetwork(request, CApplication::NoLogRequestId, data,
{
this, [ =, &receivedData ](QNetworkReply * nwReply)
{
@@ -234,7 +232,6 @@ namespace BlackCore
if (loop) { loop->exit(); }
}
});
Q_UNUSED(reply)
if (loop) { loop->exec(); }
return receivedData;

View File

@@ -61,15 +61,15 @@ namespace BlackCore
if (authenticated)
{
const QString callsign = m_connection.getCallsign();
m_connection.setTokens(m_apiServerConnection->addCallsign(callsign));
const QString cs = m_connection.getCallsign();
m_connection.setTokens(m_apiServerConnection->addCallsign(cs));
m_connection.setTsAuthenticatedToNow();
m_connection.createCryptoChannels();
m_connection.setTsHeartbeatToNow();
this->connectToVoiceServer();
// taskServerConnectionCheck.Start();
CLogMessage(this).info(u"Connected: '%1' to voice server, socket open: %2") << callsign << boolToYesNo(m_udpSocket->isOpen());
CLogMessage(this).info(u"Connected: '%1' to voice server, socket open: %2") << cs << boolToYesNo(m_udpSocket->isOpen());
}
else
{

View File

@@ -52,7 +52,6 @@ namespace BlackCore
headerBuffer.close();
const quint16 headerLength = static_cast<quint16>(headerBuffer.buffer().size());
const QByteArray dtoNameBuffer = T::getDtoName();
const QByteArray dtoShortName = T::getShortDtoName();
const quint16 dtoNameLength = static_cast<quint16>(dtoShortName.size());