kopia lustrzana https://github.com/f4exb/sdrangel
PVS studio static analyzer fixes (2)
rodzic
b00aea8989
commit
5777875618
|
@ -334,7 +334,7 @@ private:
|
|||
{
|
||||
for (unsigned int i = 0; i < ncoeffs; ++i)
|
||||
{
|
||||
float a = 2 * M_PI * f * (i - (ncoeffs / 2));
|
||||
float a = 2 * M_PI * f * (i - (ncoeffs / 2.0f));
|
||||
float c = cosf(a), s = sinf(a);
|
||||
// TBD Support T=complex
|
||||
shifted_coeffs[i].re = coeffs[i] * c;
|
||||
|
|
|
@ -13,10 +13,17 @@ struct hdlc_dec
|
|||
|
||||
hdlc_dec(int _minframesize, // Including CRC, excluding HDLC flags.
|
||||
int _maxframesize, bool _invert) :
|
||||
minframesize(_minframesize), maxframesize(_maxframesize), invertmask(
|
||||
_invert ? 0xff : 0), framebuf(new u8[maxframesize]), debug(
|
||||
false)
|
||||
minframesize(_minframesize),
|
||||
maxframesize(_maxframesize),
|
||||
invertmask(_invert ? 0xff : 0),
|
||||
framebuf(new u8[maxframesize]),
|
||||
debug(false)
|
||||
{
|
||||
byte_out = 0;
|
||||
nbits_out = 0;
|
||||
framesize = 0;
|
||||
crc16 = 0;
|
||||
|
||||
reset();
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace leansdr {
|
|||
template<typename T>
|
||||
struct complex {
|
||||
T re, im;
|
||||
complex() { }
|
||||
complex() : re(0), im(0) { }
|
||||
complex(T x) : re(x), im(0) { }
|
||||
complex(T x, T y) : re(x), im(y) { }
|
||||
inline void operator +=(const complex<T> &x) { re+=x.re; im+=x.im; }
|
||||
|
@ -34,7 +34,7 @@ namespace leansdr {
|
|||
complex<T> operator *(const T &k, const complex<T> &a) {
|
||||
return complex<T>(k*a.re, k*a.im);
|
||||
}
|
||||
|
||||
|
||||
// TBD Optimize with dedicated instructions
|
||||
inline int hamming_weight(uint8_t x) {
|
||||
static const int lut[16] = { 0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4 };
|
||||
|
@ -72,7 +72,7 @@ namespace leansdr {
|
|||
for ( ; x; ++n,x>>=1 ) ;
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
// Pre-computed sin/cos for 16-bit angles
|
||||
|
||||
struct trig16 {
|
||||
|
|
|
@ -637,9 +637,6 @@ int UDPSink::webapiSettingsPutPatch(
|
|||
if (channelSettingsKeys.contains("amModFactor")) {
|
||||
settings.m_amModFactor = response.getUdpSinkSettings()->getAmModFactor();
|
||||
}
|
||||
if (channelSettingsKeys.contains("amModFactor")) {
|
||||
settings.m_amModFactor = response.getUdpSinkSettings()->getAmModFactor();
|
||||
}
|
||||
if (channelSettingsKeys.contains("channelMute")) {
|
||||
settings.m_channelMute = response.getUdpSinkSettings()->getChannelMute() != 0;
|
||||
}
|
||||
|
|
|
@ -654,9 +654,6 @@ int AirspyInput::webapiSettingsPutPatch(
|
|||
if (deviceSettingsKeys.contains("vgaGain")) {
|
||||
settings.m_vgaGain = response.getAirspySettings()->getVgaGain();
|
||||
}
|
||||
if (deviceSettingsKeys.contains("vgaGain")) {
|
||||
settings.m_vgaGain = response.getAirspySettings()->getVgaGain();
|
||||
}
|
||||
if (deviceSettingsKeys.contains("lnaAGC")) {
|
||||
settings.m_lnaAGC = response.getAirspySettings()->getLnaAgc() != 0;
|
||||
}
|
||||
|
|
|
@ -154,13 +154,7 @@ bool AirspyHFInput::start()
|
|||
|
||||
if (m_running) { stop(); }
|
||||
|
||||
if ((m_airspyHFThread = new AirspyHFThread(m_dev, &m_sampleFifo)) == 0)
|
||||
{
|
||||
qCritical("AirspyHFInput::start: out of memory");
|
||||
stop();
|
||||
return false;
|
||||
}
|
||||
|
||||
m_airspyHFThread = new AirspyHFThread(m_dev, &m_sampleFifo);
|
||||
int sampleRateIndex = m_settings.m_devSampleRateIndex;
|
||||
|
||||
if (m_settings.m_devSampleRateIndex >= m_sampleRates.size()) {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2018 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
|
@ -31,6 +32,7 @@ AirspyHFThread::AirspyHFThread(airspyhf_device_t* dev, SampleSinkFifo* sampleFif
|
|||
m_samplerate(10),
|
||||
m_log2Decim(0)
|
||||
{
|
||||
memset((char*) m_buf, 0, 2*AIRSPYHF_BLOCKSIZE*sizeof(qint16));
|
||||
m_this = this;
|
||||
}
|
||||
|
||||
|
|
|
@ -85,8 +85,7 @@ int RTCPSDESInfo::SetPrivateValue(const uint8_t *prefix, std::size_t prefixlen,
|
|||
int status;
|
||||
|
||||
item = new SDESPrivateItem();
|
||||
if (item == 0)
|
||||
return ERR_RTP_OUTOFMEM;
|
||||
|
||||
if ((status = item->SetPrefix(prefix, prefixlen)) < 0)
|
||||
{
|
||||
delete item;
|
||||
|
|
|
@ -244,8 +244,6 @@ int RTPInternalSourceData::ProcessBYEPacket(const uint8_t *reason, std::size_t r
|
|||
|
||||
byetime = receivetime;
|
||||
byereason = new uint8_t[reasonlen];
|
||||
if (byereason == 0)
|
||||
return ERR_RTP_OUTOFMEM;
|
||||
memcpy(byereason, reason, reasonlen);
|
||||
byereasonlen = reasonlen;
|
||||
receivedbye = true;
|
||||
|
|
|
@ -308,11 +308,6 @@ int RTPPacket::BuildPacket(
|
|||
if (buffer == 0)
|
||||
{
|
||||
packet = new uint8_t[packetlength];
|
||||
if (packet == 0)
|
||||
{
|
||||
packetlength = 0;
|
||||
return ERR_RTP_OUTOFMEM;
|
||||
}
|
||||
externalbuffer = false;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -62,6 +62,7 @@ RTPPacketBuilder::RTPPacketBuilder(RTPRandom &r) :
|
|||
numcsrcs = 0;
|
||||
numpayloadbytes = 0;
|
||||
numpackets = 0;
|
||||
memset((char *) csrcs, 0, RTP_MAXCSRCS*sizeof(uint32_t));
|
||||
timeinit.Dummy();
|
||||
|
||||
//std::cout << (void *)(&rtprnd) << std::endl;
|
||||
|
@ -81,8 +82,6 @@ int RTPPacketBuilder::Init(unsigned int max)
|
|||
|
||||
maxpacksize = max;
|
||||
buffer = new uint8_t[max];
|
||||
if (buffer == 0)
|
||||
return ERR_RTP_OUTOFMEM;
|
||||
packetlength = 0;
|
||||
numpackets = 0;
|
||||
|
||||
|
@ -113,8 +112,6 @@ int RTPPacketBuilder::SetMaximumPacketSize(unsigned int max)
|
|||
if (max <= 0)
|
||||
return ERR_RTP_PACKBUILD_INVALIDMAXPACKETSIZE;
|
||||
newbuf = new uint8_t[max];
|
||||
if (newbuf == 0)
|
||||
return ERR_RTP_OUTOFMEM;
|
||||
|
||||
delete[] buffer;
|
||||
buffer = newbuf;
|
||||
|
|
|
@ -169,8 +169,7 @@ int RTPSources::ProcessRawPacket(RTPRawPacket *rawpack, RTPTransmitter *rtptrans
|
|||
|
||||
// First, we'll see if the packet can be parsed
|
||||
rtppack = new RTPPacket(*rawpack);
|
||||
if (rtppack == 0)
|
||||
return ERR_RTP_OUTOFMEM;
|
||||
|
||||
if ((status = rtppack->GetCreationError()) < 0)
|
||||
{
|
||||
if (status == ERR_RTP_PACKET_INVALIDPACKET)
|
||||
|
@ -808,8 +807,6 @@ int RTPSources::ObtainSourceDataInstance(uint32_t ssrc, RTPInternalSourceData **
|
|||
if (sourcelist.GotoElement(ssrc) < 0) // No entry for this source
|
||||
{
|
||||
srcdat2 = new RTPInternalSourceData(ssrc);
|
||||
if (srcdat2 == 0)
|
||||
return ERR_RTP_OUTOFMEM;
|
||||
if ((status = sourcelist.AddElement(ssrc, srcdat2)) < 0)
|
||||
{
|
||||
delete srcdat2;
|
||||
|
|
Ładowanie…
Reference in New Issue