mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-13 15:45:42 +08:00
Ref T730, CPP check issues fixed
This commit is contained in:
committed by
Mat Sutcliffe
parent
1d9cd50463
commit
30baa12a86
@@ -187,10 +187,11 @@ namespace BlackCore
|
||||
{
|
||||
if (m_receiver->getFrequencyHz() < 30000000)
|
||||
{
|
||||
/**
|
||||
double crackleFactor = (((qExp(m_distanceRatio) * qPow(m_distanceRatio, -4.0)) / 350.0) - 0.00776652);
|
||||
|
||||
if (crackleFactor < 0.0f) { crackleFactor = 0.00f; }
|
||||
if (crackleFactor > 0.20f) { crackleFactor = 0.20f; }
|
||||
**/
|
||||
|
||||
m_hfWhiteNoise->setGain(m_hfWhiteNoiseGainMin);
|
||||
m_acBusNoise->setGain(m_acBusGainMin + 0.001f);
|
||||
|
||||
@@ -156,14 +156,11 @@ namespace BlackCore
|
||||
samples = convertFromStereoToMono(samples);
|
||||
}
|
||||
|
||||
int value = 0;
|
||||
for (qint16 &sample : samples)
|
||||
{
|
||||
value = qRound(sample * m_volume);
|
||||
if (value > std::numeric_limits<qint16>::max())
|
||||
value = std::numeric_limits<qint16>::max();
|
||||
if (value < std::numeric_limits<qint16>::min())
|
||||
value = std::numeric_limits<qint16>::min();
|
||||
int value = qRound(sample * m_volume);
|
||||
if (value > std::numeric_limits<qint16>::max()) value = std::numeric_limits<qint16>::max();
|
||||
if (value < std::numeric_limits<qint16>::min()) value = std::numeric_limits<qint16>::min();
|
||||
sample = static_cast<qint16>(value);
|
||||
|
||||
qint16 sampleInput = qAbs(sample);
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
*/
|
||||
|
||||
#include "cryptodtochannel.h"
|
||||
#include "blackmisc/verify.h"
|
||||
|
||||
using namespace BlackMisc;
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
@@ -14,26 +17,18 @@ namespace BlackCore
|
||||
{
|
||||
namespace Crypto
|
||||
{
|
||||
CCryptoDtoChannel::CCryptoDtoChannel(QString channelTag, const QByteArray &aeadReceiveKey, const QByteArray &aeadTransmitKey, int receiveSequenceHistorySize)
|
||||
{
|
||||
m_channelTag = channelTag;
|
||||
m_aeadReceiveKey = aeadReceiveKey;
|
||||
m_aeadTransmitKey = aeadTransmitKey;
|
||||
CCryptoDtoChannel::CCryptoDtoChannel(const QString &channelTag, const QByteArray &aeadReceiveKey, const QByteArray &aeadTransmitKey, int receiveSequenceHistorySize):
|
||||
m_aeadTransmitKey(aeadTransmitKey), m_aeadReceiveKey(aeadReceiveKey), m_receiveSequenceSizeMaxSize(receiveSequenceHistorySize), m_channelTag(channelTag)
|
||||
|
||||
m_receiveSequenceSizeMaxSize = receiveSequenceHistorySize;
|
||||
{
|
||||
if (m_receiveSequenceSizeMaxSize < 1) { m_receiveSequenceSizeMaxSize = 1; }
|
||||
m_receiveSequenceHistory.fill(0, m_receiveSequenceSizeMaxSize);
|
||||
m_receiveSequenceHistoryDepth = 0;
|
||||
}
|
||||
|
||||
CCryptoDtoChannel::CCryptoDtoChannel(CryptoDtoChannelConfigDto channelConfig, int receiveSequenceHistorySize)
|
||||
CCryptoDtoChannel::CCryptoDtoChannel(const CryptoDtoChannelConfigDto &channelConfig, int receiveSequenceHistorySize) :
|
||||
m_aeadTransmitKey(channelConfig.aeadTransmitKey), m_aeadReceiveKey(channelConfig.aeadReceiveKey), m_receiveSequenceSizeMaxSize(receiveSequenceHistorySize), m_hmacKey(channelConfig.hmacKey), m_channelTag(channelConfig.channelTag)
|
||||
{
|
||||
m_channelTag = channelConfig.channelTag;
|
||||
m_aeadReceiveKey = channelConfig.aeadReceiveKey;
|
||||
m_aeadTransmitKey = channelConfig.aeadTransmitKey;
|
||||
m_hmacKey = channelConfig.hmacKey;
|
||||
|
||||
m_receiveSequenceSizeMaxSize = receiveSequenceHistorySize;
|
||||
if (m_receiveSequenceSizeMaxSize < 1) { m_receiveSequenceSizeMaxSize = 1; }
|
||||
m_receiveSequenceHistory.fill(0, m_receiveSequenceSizeMaxSize);
|
||||
m_receiveSequenceHistoryDepth = 0;
|
||||
@@ -46,7 +41,8 @@ namespace BlackCore
|
||||
case CryptoDtoMode::AEAD_ChaCha20Poly1305: return m_aeadTransmitKey;
|
||||
case CryptoDtoMode::Undefined:
|
||||
case CryptoDtoMode::None:
|
||||
qFatal("GetTransmitKey called with wrong argument.");
|
||||
BLACK_VERIFY_X(false, Q_FUNC_INFO, "GetTransmitKey called with wrong argument.");
|
||||
break;
|
||||
}
|
||||
|
||||
return {};
|
||||
@@ -63,7 +59,8 @@ namespace BlackCore
|
||||
case CryptoDtoMode::AEAD_ChaCha20Poly1305: return m_aeadTransmitKey;
|
||||
case CryptoDtoMode::Undefined:
|
||||
case CryptoDtoMode::None:
|
||||
qFatal("GetTransmitKey called with wrong argument.");
|
||||
BLACK_VERIFY_X(false, Q_FUNC_INFO, "GetTransmitKey called with wrong argument.");
|
||||
break;
|
||||
}
|
||||
|
||||
return {};
|
||||
@@ -81,7 +78,8 @@ namespace BlackCore
|
||||
case CryptoDtoMode::AEAD_ChaCha20Poly1305: return m_aeadReceiveKey;
|
||||
case CryptoDtoMode::Undefined:
|
||||
case CryptoDtoMode::None:
|
||||
qFatal("getReceiveKey called with wrong argument.");
|
||||
BLACK_VERIFY_X(false, Q_FUNC_INFO, "GetReceiveKey called with wrong argument.");
|
||||
break;
|
||||
}
|
||||
|
||||
return {};
|
||||
|
||||
@@ -31,10 +31,10 @@ namespace BlackCore
|
||||
{
|
||||
public:
|
||||
//! Ctor
|
||||
CCryptoDtoChannel(QString channelTag, const QByteArray &aeadReceiveKey, const QByteArray &aeadTransmitKey, int receiveSequenceHistorySize = 10);
|
||||
CCryptoDtoChannel(const QString &channelTag, const QByteArray &aeadReceiveKey, const QByteArray &aeadTransmitKey, int receiveSequenceHistorySize = 10);
|
||||
|
||||
//! Ctor
|
||||
CCryptoDtoChannel(CryptoDtoChannelConfigDto channelConfig, int receiveSequenceHistorySize = 10);
|
||||
CCryptoDtoChannel(const CryptoDtoChannelConfigDto &channelConfig, int receiveSequenceHistorySize = 10);
|
||||
|
||||
//! Transmit key @{
|
||||
QByteArray getTransmitKey(CryptoDtoMode mode);
|
||||
|
||||
@@ -879,7 +879,6 @@ namespace BlackCore
|
||||
{
|
||||
if (!m_fsdClient) { return {}; }
|
||||
return m_fsdClient->getPresetValues();
|
||||
return {};
|
||||
}
|
||||
|
||||
CAtcStation CContextNetwork::getOnlineStationForCallsign(const CCallsign &callsign) const
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace BlackCore
|
||||
{ }
|
||||
|
||||
ClientIdentification::ClientIdentification(const QString &sender, quint16 clientId, const QString &clientName, int clientVersionMajor,
|
||||
int clientVersionMinor, const QString &userCid, const QString &sysUid, const QString &initialChallenge)
|
||||
int clientVersionMinor, const QString &userCid, const QString &sysUid, const QString &initialChallenge)
|
||||
: MessageBase(sender, "SERVER"),
|
||||
m_clientId(clientId), m_clientName(clientName),
|
||||
m_clientVersionMajor(clientVersionMajor), m_clientVersionMinor(clientVersionMinor),
|
||||
@@ -47,9 +47,10 @@ namespace BlackCore
|
||||
{
|
||||
BlackMisc::CLogMessage(static_cast<ClientIdentification *>(nullptr)).warning(u"Wrong number of arguments.");
|
||||
return {};
|
||||
};
|
||||
}
|
||||
|
||||
ClientIdentification packet(tokens[0], tokens[2].toUShort(nullptr, 16), tokens[3], tokens[4].toInt(), tokens[5].toInt(),
|
||||
tokens[6], tokens[7], tokens.size() > 8 ? tokens[8] : QString());
|
||||
tokens[6], tokens[7], tokens.size() > 8 ? tokens[8] : QString());
|
||||
return packet;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#define BLACKCORE_FSD_CLIENTIDENTIFICATION_H
|
||||
|
||||
#include "messagebase.h"
|
||||
#include "blackconfig/buildconfig.h"
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
@@ -34,8 +35,8 @@ namespace BlackCore
|
||||
|
||||
std::uint16_t m_clientId;
|
||||
QString m_clientName;
|
||||
int m_clientVersionMajor;
|
||||
int m_clientVersionMinor;
|
||||
int m_clientVersionMajor = BlackConfig::CBuildConfig::getVersion().majorVersion();
|
||||
int m_clientVersionMinor = BlackConfig::CBuildConfig::getVersion().minorVersion();
|
||||
QString m_userCid;
|
||||
QString m_sysUid;
|
||||
QString m_initialChallenge;
|
||||
|
||||
Reference in New Issue
Block a user