mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-18 11:25:33 +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);
|
||||
|
||||
Reference in New Issue
Block a user