PVS-Studio analys fixes: core package serious issues

pull/375/head
f4exb 2019-06-14 16:58:09 +02:00
rodzic 63132f0165
commit 06dea9b29f
40 zmienionych plików z 105 dodań i 41 usunięć

Wyświetl plik

@ -41,7 +41,9 @@ DeviceXTRX::DeviceXTRX() :
m_inputRate(0),
m_outputRate(0),
m_masterRate(0),
m_clockGen(0)
m_clockGen(0),
m_actualInputRate(0),
m_actualOutputRate(0)
{}
DeviceXTRX::~DeviceXTRX()

Wyświetl plik

@ -456,8 +456,8 @@ bool TestMI::applySettings(const TestMISettings& settings, bool force)
|| (m_settings.m_streams[istream].m_fcPos != settings.m_streams[istream].m_fcPos) || force)
{
int sampleRate = settings.m_streams[istream].m_sampleRate/(1<<settings.m_streams[istream].m_log2Decim);
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, settings.m_streams[istream].m_centerFrequency);
m_fileSinks[istream]->handleMessage(*notif); // forward to file sink
DSPSignalNotification notif(sampleRate, settings.m_streams[istream].m_centerFrequency);
m_fileSinks[istream]->handleMessage(notif); // forward to file sink
DSPMIMOSignalNotification *engineNotif = new DSPMIMOSignalNotification(
sampleRate, settings.m_streams[istream].m_centerFrequency, true, istream);
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(engineNotif);
@ -837,6 +837,8 @@ void TestMI::webapiReverseSendStartStop(bool start)
} else {
m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer);
}
delete swgDeviceSettings;
}
void TestMI::networkManagerFinished(QNetworkReply *reply)

Wyświetl plik

@ -753,6 +753,8 @@ void Bladerf1Output::webapiReverseSendStartStop(bool start)
} else {
m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer);
}
delete swgDeviceSettings;
}
void Bladerf1Output::networkManagerFinished(QNetworkReply *reply)

Wyświetl plik

@ -1201,6 +1201,8 @@ void BladeRF2Output::webapiReverseSendStartStop(bool start)
} else {
m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer);
}
delete swgDeviceSettings;
}
void BladeRF2Output::networkManagerFinished(QNetworkReply *reply)

Wyświetl plik

@ -751,6 +751,8 @@ void HackRFOutput::webapiReverseSendStartStop(bool start)
} else {
m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer);
}
delete swgDeviceSettings;
}
void HackRFOutput::networkManagerFinished(QNetworkReply *reply)

Wyświetl plik

@ -301,10 +301,10 @@ void HackRFOutputGui::on_centerFrequency_changed(quint64 value)
void HackRFOutputGui::on_sampleRate_changed(quint64 value)
{
if (m_sampleRateMode) {
m_settings.m_devSampleRate = value;
} else {
m_settings.m_devSampleRate = value * (1 << m_settings.m_log2Interp);
m_settings.m_devSampleRate = value;
if (!m_sampleRateMode) {
m_settings.m_devSampleRate <<= m_settings.m_log2Interp;
}
displayFcTooltip();
@ -345,11 +345,10 @@ void HackRFOutputGui::on_interp_currentIndexChanged(int index)
m_settings.m_log2Interp = index;
displaySampleRate();
m_settings.m_devSampleRate = ui->sampleRate->getValueNew();
if (m_sampleRateMode) {
m_settings.m_devSampleRate = ui->sampleRate->getValueNew();
} else {
m_settings.m_devSampleRate = ui->sampleRate->getValueNew() * (1 << m_settings.m_log2Interp);
if (!m_sampleRateMode) {
m_settings.m_devSampleRate <<= m_settings.m_log2Interp;
}
sendSettings();

Wyświetl plik

@ -27,7 +27,8 @@ HackRFOutputThread::HackRFOutputThread(hackrf_device* dev, SampleSourceFifo* sam
m_running(false),
m_dev(dev),
m_sampleFifo(sampleFifo),
m_log2Interp(0)
m_log2Interp(0),
m_fcPos(2)
{
std::fill(m_buf, m_buf + 2*HACKRF_BLOCKSIZE, 0);
}

Wyświetl plik

@ -1546,6 +1546,8 @@ void LimeSDROutput::webapiReverseSendStartStop(bool start)
} else {
m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer);
}
delete swgDeviceSettings;
}
void LimeSDROutput::networkManagerFinished(QNetworkReply *reply)

Wyświetl plik

@ -41,6 +41,9 @@ MESSAGE_CLASS_DEFINITION(LocalOutput::MsgReportSampleRateAndFrequency, Message)
LocalOutput::LocalOutput(DeviceAPI *deviceAPI) :
m_deviceAPI(deviceAPI),
m_settings(),
m_centerFrequency(0),
m_sampleRate(48000),
m_fileSink(nullptr),
m_deviceDescription("LocalOutput")
{
m_sampleSourceFifo.resize(96000 * 4);
@ -376,6 +379,8 @@ void LocalOutput::webapiReverseSendStartStop(bool start)
} else {
m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer);
}
delete swgDeviceSettings;
}
void LocalOutput::networkManagerFinished(QNetworkReply *reply)

Wyświetl plik

@ -879,6 +879,8 @@ void PlutoSDROutput::webapiReverseSendStartStop(bool start)
} else {
m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer);
}
delete swgDeviceSettings;
}
void PlutoSDROutput::networkManagerFinished(QNetworkReply *reply)

Wyświetl plik

@ -205,11 +205,10 @@ void PlutoSDROutputGUI::on_swInterp_currentIndexChanged(int index)
{
m_settings.m_log2Interp = index > 5 ? 5 : index;
displaySampleRate();
m_settings.m_devSampleRate = ui->sampleRate->getValueNew();
if (m_sampleRateMode) {
m_settings.m_devSampleRate = ui->sampleRate->getValueNew();
} else {
m_settings.m_devSampleRate = ui->sampleRate->getValueNew() * (1 << m_settings.m_log2Interp);
if (!m_sampleRateMode) {
m_settings.m_devSampleRate <<= m_settings.m_log2Interp;
}
sendSettings();
@ -217,10 +216,10 @@ void PlutoSDROutputGUI::on_swInterp_currentIndexChanged(int index)
void PlutoSDROutputGUI::on_sampleRate_changed(quint64 value)
{
if (m_sampleRateMode) {
m_settings.m_devSampleRate = value;
} else {
m_settings.m_devSampleRate = value * (1 << m_settings.m_log2Interp);
m_settings.m_devSampleRate = value;
if (!m_sampleRateMode) {
m_settings.m_devSampleRate <<= m_settings.m_log2Interp;
}
sendSettings();

Wyświetl plik

@ -702,4 +702,6 @@ void RemoteOutput::webapiReverseSendStartStop(bool start)
} else {
m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer);
}
delete swgDeviceSettings;
}

Wyświetl plik

@ -1922,6 +1922,8 @@ void SoapySDROutput::webapiReverseSendStartStop(bool start)
} else {
m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer);
}
delete swgDeviceSettings;
}
void SoapySDROutput::networkManagerFinished(QNetworkReply *reply)

Wyświetl plik

@ -1428,6 +1428,8 @@ void XTRXOutput::webapiReverseSendStartStop(bool start)
} else {
m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer);
}
delete swgDeviceSettings;
}
void XTRXOutput::networkManagerFinished(QNetworkReply *reply)

Wyświetl plik

@ -893,6 +893,8 @@ void AirspyInput::webapiReverseSendStartStop(bool start)
} else {
m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer);
}
delete swgDeviceSettings;
}
void AirspyInput::networkManagerFinished(QNetworkReply *reply)

Wyświetl plik

@ -917,6 +917,8 @@ void AirspyHFInput::webapiReverseSendStartStop(bool start)
} else {
m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer);
}
delete swgDeviceSettings;
}
void AirspyHFInput::networkManagerFinished(QNetworkReply *reply)

Wyświetl plik

@ -860,6 +860,8 @@ void Bladerf1Input::webapiReverseSendStartStop(bool start)
} else {
m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer);
}
delete swgDeviceSettings;
}
void Bladerf1Input::networkManagerFinished(QNetworkReply *reply)

Wyświetl plik

@ -1343,6 +1343,8 @@ void BladeRF2Input::webapiReverseSendStartStop(bool start)
} else {
m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer);
}
delete swgDeviceSettings;
}
void BladeRF2Input::networkManagerFinished(QNetworkReply *reply)

Wyświetl plik

@ -1149,6 +1149,8 @@ void FCDProInput::webapiReverseSendStartStop(bool start)
} else {
m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer);
}
delete swgDeviceSettings;
}
void FCDProInput::networkManagerFinished(QNetworkReply *reply)

Wyświetl plik

@ -813,6 +813,8 @@ void FCDProPlusInput::webapiReverseSendStartStop(bool start)
} else {
m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer);
}
delete swgDeviceSettings;
}
void FCDProPlusInput::networkManagerFinished(QNetworkReply *reply)

Wyświetl plik

@ -658,6 +658,8 @@ void FileSourceInput::webapiReverseSendStartStop(bool start)
} else {
m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer);
}
delete swgDeviceSettings;
}
void FileSourceInput::networkManagerFinished(QNetworkReply *reply)

Wyświetl plik

@ -825,6 +825,8 @@ void HackRFInput::webapiReverseSendStartStop(bool start)
} else {
m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer);
}
delete swgDeviceSettings;
}
void HackRFInput::networkManagerFinished(QNetworkReply *reply)

Wyświetl plik

@ -345,10 +345,10 @@ void HackRFInputGui::on_centerFrequency_changed(quint64 value)
void HackRFInputGui::on_sampleRate_changed(quint64 value)
{
if (m_sampleRateMode) {
m_settings.m_devSampleRate = value;
} else {
m_settings.m_devSampleRate = value * (1 << m_settings.m_log2Decim);
m_settings.m_devSampleRate = value;
if (!m_sampleRateMode) {
m_settings.m_devSampleRate <<= m_settings.m_log2Decim;
}
displayFcTooltip();
@ -363,11 +363,10 @@ void HackRFInputGui::on_decim_currentIndexChanged(int index)
m_settings.m_log2Decim = index;
displaySampleRate();
m_settings.m_devSampleRate = ui->sampleRate->getValueNew();
if (m_sampleRateMode) {
m_settings.m_devSampleRate = ui->sampleRate->getValueNew();
} else {
m_settings.m_devSampleRate = ui->sampleRate->getValueNew() * (1 << m_settings.m_log2Decim);
if (!m_sampleRateMode) {
m_settings.m_devSampleRate <<= m_settings.m_log2Decim;
}
sendSettings();

Wyświetl plik

@ -545,6 +545,8 @@ void KiwiSDRInput::webapiReverseSendStartStop(bool start)
} else {
m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer);
}
delete swgDeviceSettings;
}
void KiwiSDRInput::networkManagerFinished(QNetworkReply *reply)

Wyświetl plik

@ -1790,6 +1790,8 @@ void LimeSDRInput::webapiReverseSendStartStop(bool start)
} else {
m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer);
}
delete swgDeviceSettings;
}
void LimeSDRInput::networkManagerFinished(QNetworkReply *reply)

Wyświetl plik

@ -43,6 +43,7 @@ MESSAGE_CLASS_DEFINITION(LocalInput::MsgReportSampleRateAndFrequency, Message)
LocalInput::LocalInput(DeviceAPI *deviceAPI) :
m_deviceAPI(deviceAPI),
m_settings(),
m_centerFrequency(0),
m_deviceDescription("LocalInput")
{
m_sampleFifo.setSize(96000 * 4);
@ -457,6 +458,8 @@ void LocalInput::webapiReverseSendStartStop(bool start)
} else {
m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer);
}
delete swgDeviceSettings;
}
void LocalInput::networkManagerFinished(QNetworkReply *reply)

Wyświetl plik

@ -698,6 +698,8 @@ void PerseusInput::webapiReverseSendStartStop(bool start)
} else {
m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer);
}
delete swgDeviceSettings;
}
void PerseusInput::networkManagerFinished(QNetworkReply *reply)

Wyświetl plik

@ -1022,6 +1022,8 @@ void PlutoSDRInput::webapiReverseSendStartStop(bool start)
} else {
m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer);
}
delete swgDeviceSettings;
}
void PlutoSDRInput::networkManagerFinished(QNetworkReply *reply)

Wyświetl plik

@ -230,11 +230,10 @@ void PlutoSDRInputGui::on_swDecim_currentIndexChanged(int index)
{
m_settings.m_log2Decim = index > 6 ? 6 : index;
displaySampleRate();
m_settings.m_devSampleRate = ui->sampleRate->getValueNew();
if (m_sampleRateMode) {
m_settings.m_devSampleRate = ui->sampleRate->getValueNew();
} else {
m_settings.m_devSampleRate = ui->sampleRate->getValueNew() * (1 << m_settings.m_log2Decim);
if (!m_sampleRateMode) {
m_settings.m_devSampleRate <<= m_settings.m_log2Decim;
}
sendSettings();
@ -249,10 +248,10 @@ void PlutoSDRInputGui::on_fcPos_currentIndexChanged(int index)
void PlutoSDRInputGui::on_sampleRate_changed(quint64 value)
{
if (m_sampleRateMode) {
m_settings.m_devSampleRate = value;
} else {
m_settings.m_devSampleRate = value * (1 << m_settings.m_log2Decim);
m_settings.m_devSampleRate = value;
if (!m_sampleRateMode) {
m_settings.m_devSampleRate <<= m_settings.m_log2Decim;
}
displayFcTooltip();

Wyświetl plik

@ -507,6 +507,8 @@ void RemoteInput::webapiReverseSendStartStop(bool start)
} else {
m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer);
}
delete swgDeviceSettings;
}
void RemoteInput::networkManagerFinished(QNetworkReply *reply)

Wyświetl plik

@ -862,6 +862,8 @@ void RTLSDRInput::webapiReverseSendStartStop(bool start)
} else {
m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer);
}
delete swgDeviceSettings;
}
void RTLSDRInput::networkManagerFinished(QNetworkReply *reply)

Wyświetl plik

@ -949,6 +949,8 @@ void SDRPlayInput::webapiReverseSendStartStop(bool start)
} else {
m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer);
}
delete swgDeviceSettings;
}
void SDRPlayInput::networkManagerFinished(QNetworkReply *reply)

Wyświetl plik

@ -2020,6 +2020,8 @@ void SoapySDRInput::webapiReverseSendStartStop(bool start)
} else {
m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer);
}
delete swgDeviceSettings;
}
void SoapySDRInput::networkManagerFinished(QNetworkReply *reply)

Wyświetl plik

@ -727,6 +727,8 @@ void TestSourceInput::webapiReverseSendStartStop(bool start)
} else {
m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer);
}
delete swgDeviceSettings;
}
void TestSourceInput::networkManagerFinished(QNetworkReply *reply)

Wyświetl plik

@ -1640,6 +1640,8 @@ void XTRXInput::webapiReverseSendStartStop(bool start)
} else {
m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer);
}
delete swgDeviceSettings;
}
void XTRXInput::networkManagerFinished(QNetworkReply *reply)

Wyświetl plik

@ -40,6 +40,8 @@ AudioNetSink::AudioNetSink(QObject *parent) :
m_port(9998)
{
std::fill(m_data, m_data+m_dataBlockSize, 0);
std::fill(m_opusIn, m_opusIn+m_opusBlockSize, 0);
m_codecRatio = (m_sampleRate / m_decimation) / (AudioOpus::m_bitrate / 8); // compressor ratio
m_udpSocket = new QUdpSocket(parent);
}
@ -57,6 +59,8 @@ AudioNetSink::AudioNetSink(QObject *parent, int sampleRate, bool stereo) :
m_port(9998)
{
std::fill(m_data, m_data+m_dataBlockSize, 0);
std::fill(m_opusIn, m_opusIn+m_opusBlockSize, 0);
m_codecRatio = (m_sampleRate / m_decimation) / (AudioOpus::m_bitrate / 8); // compressor ratio
m_udpSocket = new QUdpSocket(parent);
m_rtpBufferAudio = new RTPSink(m_udpSocket, sampleRate, stereo);
}

Wyświetl plik

@ -24,6 +24,7 @@ ChannelAPI::ChannelAPI(const QString& name, StreamType streamType) :
m_streamType(streamType),
m_name(name),
m_indexInDeviceSet(-1),
m_deviceSetIndex(0),
m_deviceAPI(0),
m_uid(UidCalculator::getNewObjectId())
{ }

Wyświetl plik

@ -139,7 +139,7 @@ qint32 DeviceSampleSource::calculateFrequencyShift(
}
}
}
else if (frequencyShiftScheme == FSHIFT_TXSYNC)
else // frequencyShiftScheme == FSHIFT_TXSYNC
{
if (fcPos == FC_POS_CENTER) {
return 0;
@ -166,8 +166,4 @@ qint32 DeviceSampleSource::calculateFrequencyShift(
return 0;
}
}
else
{
return 0;
}
}

Wyświetl plik

@ -35,6 +35,7 @@ MainParser::MainParser() :
{
m_serverAddress = "127.0.0.1";
m_serverPort = 8091;
m_mimoSupport = false;
m_mimoOption.setFlags(QCommandLineOption::HiddenFromHelp);
m_parser.setApplicationDescription("Software Defined Radio application");

Wyświetl plik

@ -54,6 +54,7 @@ ScopeVis::ScopeVis(GLScope* glScope) :
m_timeBase(1),
m_timeOfsProMill(0),
m_traceStart(true),
m_triggerLocation(0),
m_sampleRate(0),
m_liveSampleRate(0),
m_liveLog2Decim(0),