diff --git a/plugins/channelrx/demoddatv/leansdr/dsp.h b/plugins/channelrx/demoddatv/leansdr/dsp.h index 03725abc5..6067ee7a0 100644 --- a/plugins/channelrx/demoddatv/leansdr/dsp.h +++ b/plugins/channelrx/demoddatv/leansdr/dsp.h @@ -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; diff --git a/plugins/channelrx/demoddatv/leansdr/hdlc.h b/plugins/channelrx/demoddatv/leansdr/hdlc.h index 7c8dc9f66..ac936f5d1 100644 --- a/plugins/channelrx/demoddatv/leansdr/hdlc.h +++ b/plugins/channelrx/demoddatv/leansdr/hdlc.h @@ -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(); } diff --git a/plugins/channelrx/demoddatv/leansdr/math.h b/plugins/channelrx/demoddatv/leansdr/math.h index c25d64c5d..26a94b250 100644 --- a/plugins/channelrx/demoddatv/leansdr/math.h +++ b/plugins/channelrx/demoddatv/leansdr/math.h @@ -9,7 +9,7 @@ namespace leansdr { template 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 &x) { re+=x.re; im+=x.im; } @@ -34,7 +34,7 @@ namespace leansdr { complex operator *(const T &k, const complex &a) { return complex(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 { diff --git a/plugins/channeltx/udpsink/udpsink.cpp b/plugins/channeltx/udpsink/udpsink.cpp index 890749b7e..9e18c5f22 100644 --- a/plugins/channeltx/udpsink/udpsink.cpp +++ b/plugins/channeltx/udpsink/udpsink.cpp @@ -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; } diff --git a/plugins/samplesource/airspy/airspyinput.cpp b/plugins/samplesource/airspy/airspyinput.cpp index a22bd51d3..7ec2f68f3 100644 --- a/plugins/samplesource/airspy/airspyinput.cpp +++ b/plugins/samplesource/airspy/airspyinput.cpp @@ -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; } diff --git a/plugins/samplesource/airspyhf/airspyhfinput.cpp b/plugins/samplesource/airspyhf/airspyhfinput.cpp index 93c468621..1cadfcc39 100644 --- a/plugins/samplesource/airspyhf/airspyhfinput.cpp +++ b/plugins/samplesource/airspyhf/airspyhfinput.cpp @@ -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()) { diff --git a/plugins/samplesource/airspyhf/airspyhfthread.cpp b/plugins/samplesource/airspyhf/airspyhfthread.cpp index 3a1fba0d6..cde2ac7f1 100644 --- a/plugins/samplesource/airspyhf/airspyhfthread.cpp +++ b/plugins/samplesource/airspyhf/airspyhfthread.cpp @@ -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; } diff --git a/qrtplib/rtcpsdesinfo.cpp b/qrtplib/rtcpsdesinfo.cpp index 735065061..73b43c5dd 100644 --- a/qrtplib/rtcpsdesinfo.cpp +++ b/qrtplib/rtcpsdesinfo.cpp @@ -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; diff --git a/qrtplib/rtpinternalsourcedata.cpp b/qrtplib/rtpinternalsourcedata.cpp index 4995dd97f..5ae3a5402 100644 --- a/qrtplib/rtpinternalsourcedata.cpp +++ b/qrtplib/rtpinternalsourcedata.cpp @@ -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; diff --git a/qrtplib/rtppacket.cpp b/qrtplib/rtppacket.cpp index a0545da34..41355eff4 100644 --- a/qrtplib/rtppacket.cpp +++ b/qrtplib/rtppacket.cpp @@ -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 diff --git a/qrtplib/rtppacketbuilder.cpp b/qrtplib/rtppacketbuilder.cpp index a6974430a..2c6467951 100644 --- a/qrtplib/rtppacketbuilder.cpp +++ b/qrtplib/rtppacketbuilder.cpp @@ -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; diff --git a/qrtplib/rtpsources.cpp b/qrtplib/rtpsources.cpp index 62bbc725f..3d49a7348 100644 --- a/qrtplib/rtpsources.cpp +++ b/qrtplib/rtpsources.cpp @@ -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;