Static analysis related fixes

This commit is contained in:
Charles J. Cliffe
2016-03-30 19:34:36 -04:00
parent e0df7cb41d
commit f22ef685f5
6 changed files with 36 additions and 22 deletions
+25 -16
View File
@@ -137,17 +137,23 @@ bool DemodulatorInstance::isTerminated() {
switch (cmd.cmd) {
case DemodulatorThreadCommand::DEMOD_THREAD_CMD_AUDIO_TERMINATED:
t_Audio->join();
audioTerminated = true;
delete t_Audio;
if (t_Audio) {
t_Audio->join();
audioTerminated = true;
delete t_Audio;
t_Audio = nullptr;
}
break;
case DemodulatorThreadCommand::DEMOD_THREAD_CMD_DEMOD_TERMINATED:
#ifdef __APPLE__
pthread_join(t_Demod, NULL);
#else
t_Demod->join();
delete t_Demod;
#endif
if (t_Demod) {
#ifdef __APPLE__
pthread_join(t_Demod, nullptr);
#else
t_Demod->join();
delete t_Demod;
#endif
t_Demod = nullptr;
}
#if ENABLE_DIGITAL_LAB
if (activeOutput) {
closeOutput();
@@ -156,13 +162,16 @@ bool DemodulatorInstance::isTerminated() {
demodTerminated = true;
break;
case DemodulatorThreadCommand::DEMOD_THREAD_CMD_DEMOD_PREPROCESS_TERMINATED:
#ifdef __APPLE__
pthread_join(t_PreDemod, NULL);
#else
t_PreDemod->join();
delete t_PreDemod;
#endif
preDemodTerminated = true;
if (t_PreDemod) {
#ifdef __APPLE__
pthread_join(t_PreDemod, NULL);
#else
t_PreDemod->join();
delete t_PreDemod;
#endif
preDemodTerminated = true;
t_PreDemod = nullptr;
}
break;
default:
break;
+1 -1
View File
@@ -84,7 +84,7 @@ void DemodulatorWorkerThread::run() {
float As = 60.0f; // stop-band attenuation [dB]
if (result.sampleRate && result.bandwidth) {
if (cModem && result.sampleRate && result.bandwidth) {
result.bandwidth = cModem->checkSampleRate(result.bandwidth, makeDemod?demodCommand.audioSampleRate:filterCommand.audioSampleRate);
result.iqResampleRatio = (double) (result.bandwidth) / (double) result.sampleRate;
result.iqResampler = msresamp_crcf_create(result.iqResampleRatio, As);