From 0311f64527ee4072356881160e66938c45fa2579 Mon Sep 17 00:00:00 2001 From: John Greb Date: Fri, 21 Nov 2014 15:41:58 +0000 Subject: [PATCH] Quiet some warnings. --- CMakeLists.txt | 2 ++ plugins/channel/nfm/nfmdemod.cpp | 2 -- plugins/channel/ssb/ssbdemod.cpp | 2 ++ plugins/channel/usb/usbdemod.cpp | 11 ++++++----- plugins/channel/wfm/wfmdemod.cpp | 4 +--- plugins/channel/wfm/wfmdemodgui.cpp | 4 ++-- plugins/samplesource/rtlsdr/rtlsdrthread.cpp | 3 +-- sdrbase/audio/audiooutput.cpp | 12 +++++------- sdrbase/dsp/dspengine.cpp | 2 +- sdrbase/dsp/interpolator.cpp | 8 ++++---- sdrbase/dsp/threadedsamplesink.cpp | 2 +- sdrbase/gui/glscope.cpp | 2 +- sdrbase/gui/glspectrum.cpp | 10 +++++----- 13 files changed, 31 insertions(+), 33 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8abc6a808..6efaf80b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,8 @@ project(sdrangelove) set(CMAKE_BUILD_TYPE "Release") #set(CMAKE_BUILD_TYPE "ReleaseWithDebugInfo") #set(CMAKE_BUILD_TYPE "Debug") +#add_definitions(-Wall -fno-strict-aliasing) + set(QT_USE_QTOPENGL TRUE) set(CMAKE_AUTOMOC ON) diff --git a/plugins/channel/nfm/nfmdemod.cpp b/plugins/channel/nfm/nfmdemod.cpp index edd352e68..0d6510f14 100644 --- a/plugins/channel/nfm/nfmdemod.cpp +++ b/plugins/channel/nfm/nfmdemod.cpp @@ -94,10 +94,8 @@ void NFMDemod::feed(SampleVector::const_iterator begin, SampleVector::const_iter ++m_audioBufferFill; if(m_audioBufferFill >= m_audioBuffer.size()) { uint res = m_audioFifo->write((const quint8*)&m_audioBuffer[0], m_audioBufferFill, 1); - /* if(res != m_audioBufferFill) qDebug("lost %u samples", m_audioBufferFill - res); - */ m_audioBufferFill = 0; } } diff --git a/plugins/channel/ssb/ssbdemod.cpp b/plugins/channel/ssb/ssbdemod.cpp index e483fff2a..bbd9055e0 100644 --- a/plugins/channel/ssb/ssbdemod.cpp +++ b/plugins/channel/ssb/ssbdemod.cpp @@ -87,6 +87,8 @@ void SSBDemod::feed(SampleVector::const_iterator begin, SampleVector::const_iter ++m_audioBufferFill; if(m_audioBufferFill >= m_audioBuffer.size()) { uint res = m_audioFifo->write((const quint8*)&m_audioBuffer[0], m_audioBufferFill, 1); + if (res != m_audioBufferFill) + qDebug("lost %u samples", m_audioBufferFill - res); m_audioBufferFill = 0; } } diff --git a/plugins/channel/usb/usbdemod.cpp b/plugins/channel/usb/usbdemod.cpp index bbd3ac2a3..e6773c0c3 100644 --- a/plugins/channel/usb/usbdemod.cpp +++ b/plugins/channel/usb/usbdemod.cpp @@ -77,9 +77,8 @@ void USBDemod::feed(SampleVector::const_iterator begin, SampleVector::const_iter { Real a, b; Complex c; - int n_out; + int i, n_out; cmplx *sideband; - bool consumed; int samplestep = 2; if ((m_sampleRate == 72000)||(m_sampleRate == 144000)) @@ -99,8 +98,8 @@ void USBDemod::feed(SampleVector::const_iterator begin, SampleVector::const_iter n_out += USBFilter->run(c, &sideband, true); if (m_sampleRate == 64000) n_out += USBFilter->run(c, &sideband, true); - for (m_i; m_i < n_out; m_i += samplestep) { - Real demod = (sideband[m_i].real() + sideband[m_i].imag()) * 32768.0; + for (i = m_i ; i < n_out; i += samplestep) { + Real demod = (sideband[i].real() + sideband[i].imag()) * 32768.0; // Downsample by 4x for audio display if (!(m_undersampleCount++ & 3)) @@ -112,10 +111,12 @@ void USBDemod::feed(SampleVector::const_iterator begin, SampleVector::const_iter ++m_audioBufferFill; if(m_audioBufferFill >= m_audioBuffer.size()) { uint res = m_audioFifo->write((const quint8*)&m_audioBuffer[0], m_audioBufferFill, 1); + if (res != m_audioBufferFill) + qDebug("lost %u samples", m_audioBufferFill - res); m_audioBufferFill = 0; } } - m_i -= n_out; + m_i = i - n_out; } if(m_audioFifo->write((const quint8*)&m_audioBuffer[0], m_audioBufferFill, 0) != m_audioBufferFill) ;//qDebug("lost samples"); diff --git a/plugins/channel/wfm/wfmdemod.cpp b/plugins/channel/wfm/wfmdemod.cpp index 1329a93d7..c1b1703a2 100644 --- a/plugins/channel/wfm/wfmdemod.cpp +++ b/plugins/channel/wfm/wfmdemod.cpp @@ -72,10 +72,8 @@ void WFMDemod::feed(SampleVector::const_iterator begin, SampleVector::const_iter ++m_audioBufferFill; if(m_audioBufferFill >= m_audioBuffer.size()) { uint res = m_audioFifo->write((const quint8*)&m_audioBuffer[0], m_audioBufferFill, 1); - /* if(res != m_audioBufferFill) qDebug("lost %u samples", m_audioBufferFill - res); - */ m_audioBufferFill = 0; } @@ -83,7 +81,7 @@ void WFMDemod::feed(SampleVector::const_iterator begin, SampleVector::const_iter } } if(m_audioFifo->write((const quint8*)&m_audioBuffer[0], m_audioBufferFill, 0) != m_audioBufferFill) - ;//qDebug("lost samples"); + qDebug("lost samples"); m_audioBufferFill = 0; if(m_sampleSink != NULL) diff --git a/plugins/channel/wfm/wfmdemodgui.cpp b/plugins/channel/wfm/wfmdemodgui.cpp index b6f66c7cc..0739253e0 100644 --- a/plugins/channel/wfm/wfmdemodgui.cpp +++ b/plugins/channel/wfm/wfmdemodgui.cpp @@ -144,8 +144,8 @@ WFMDemodGUI::WFMDemodGUI(PluginAPI* pluginAPI, QWidget* parent) : m_spectrumVis->configure(m_threadedSampleSink->getMessageQueue(), 64, 10, FFTWindow::BlackmanHarris); m_channelMarker = new ChannelMarker(this); - m_channelMarker->setColor(Qt::red); - m_channelMarker->setBandwidth(16000); + m_channelMarker->setColor(Qt::blue); + m_channelMarker->setBandwidth(32000); m_channelMarker->setCenterFrequency(0); m_channelMarker->setVisible(true); connect(m_channelMarker, SIGNAL(changed()), this, SLOT(viewChanged())); diff --git a/plugins/samplesource/rtlsdr/rtlsdrthread.cpp b/plugins/samplesource/rtlsdr/rtlsdrthread.cpp index fe9c4f981..0560a74b8 100644 --- a/plugins/samplesource/rtlsdr/rtlsdrthread.cpp +++ b/plugins/samplesource/rtlsdr/rtlsdrthread.cpp @@ -123,7 +123,7 @@ void RTLSDRThread::decimate16(SampleVector::iterator* it, const quint8* buf, qin // Offset tuning: 4x downsample and rotate, then // downsample 4x more. [ rotate: 0, 1, -3, 2, -4, -5, 7, -6] qint16 xreal[4], yimag[4]; - bool b; + for (int pos = 0; pos < len - 31; ) { for (int i = 0; i < 4; i++) { xreal[i] = (buf[pos+0] - buf[pos+3] + buf[pos+7] - buf[pos+4]) << 4; @@ -147,7 +147,6 @@ void RTLSDRThread::decimate16(SampleVector::iterator* it, const quint8* buf, qin // Decimate everything by 16x, except 288kHz void RTLSDRThread::callback(const quint8* buf, qint32 len) { - qint16 xreal, yimag, phase; SampleVector::iterator it = m_convertBuffer.begin(); int mode = 0; diff --git a/sdrbase/audio/audiooutput.cpp b/sdrbase/audio/audiooutput.cpp index a7786965e..2b1d6a2ba 100644 --- a/sdrbase/audio/audiooutput.cpp +++ b/sdrbase/audio/audiooutput.cpp @@ -110,15 +110,13 @@ bool AudioOutput::open(OpenMode mode) qint64 AudioOutput::readData(char* data, qint64 maxLen) { - if(maxLen == 0) - return 0; - QMutexLocker mutexLocker(&m_mutex); - maxLen -= maxLen % 4; - int framesPerBuffer = maxLen / 4; + unsigned int framesPerBuffer = maxLen / 4; + if(framesPerBuffer == 0) + return 0; - if((int)m_mixBuffer.size() < framesPerBuffer * 2) { + if(m_mixBuffer.size() < framesPerBuffer * 2) { m_mixBuffer.resize(framesPerBuffer * 2); // allocate 2 qint32 per frame (stereo) if(m_mixBuffer.size() != framesPerBuffer * 2) return 0; @@ -144,7 +142,7 @@ qint64 AudioOutput::readData(char* data, qint64 maxLen) // convert to int16 std::vector::const_iterator src = m_mixBuffer.begin(); qint16* dst = (qint16*)data; - for(int i = 0; i < framesPerBuffer; ++i) { + for(uint i = 0; i < framesPerBuffer; i++) { // left channel qint32 s = *src++; if(s < -32768) diff --git a/sdrbase/dsp/dspengine.cpp b/sdrbase/dsp/dspengine.cpp index 76763fbb2..1c3cab6de 100644 --- a/sdrbase/dsp/dspengine.cpp +++ b/sdrbase/dsp/dspengine.cpp @@ -323,7 +323,7 @@ void DSPEngine::handleSetSource(SampleSource* source) void DSPEngine::generateReport() { bool needReport = false; - int sampleRate; + unsigned int sampleRate; quint64 centerFrequency; if(m_sampleSource != NULL) { diff --git a/sdrbase/dsp/interpolator.cpp b/sdrbase/dsp/interpolator.cpp index 781864bee..1e03c422a 100644 --- a/sdrbase/dsp/interpolator.cpp +++ b/sdrbase/dsp/interpolator.cpp @@ -90,18 +90,18 @@ void Interpolator::create(int phaseSteps, double sampleRate, double cutoff) // move taps around to match sse storage requirements m_taps = new float[2 * taps.size() + 8]; - for(int i = 0; i < 2 * taps.size() + 8; ++i) + for(uint i = 0; i < 2 * taps.size() + 8; ++i) m_taps[i] = 0; m_alignedTaps = (float*)((((quint64)m_taps) + 15) & ~15); - for(int i = 0; i < taps.size(); ++i) { + for(uint i = 0; i < taps.size(); ++i) { m_alignedTaps[2 * i + 0] = polyphase[i]; m_alignedTaps[2 * i + 1] = polyphase[i]; } m_taps2 = new float[2 * taps.size() + 8]; - for(int i = 0; i < 2 * taps.size() + 8; ++i) + for(uint i = 0; i < 2 * taps.size() + 8; ++i) m_taps2[i] = 0; m_alignedTaps2 = (float*)((((quint64)m_taps2) + 15) & ~15); - for(int i = 1; i < taps.size(); ++i) { + for(uint i = 1; i < taps.size(); ++i) { m_alignedTaps2[2 * (i - 1) + 0] = polyphase[i]; m_alignedTaps2[2 * (i - 1) + 1] = polyphase[i]; } diff --git a/sdrbase/dsp/threadedsamplesink.cpp b/sdrbase/dsp/threadedsamplesink.cpp index f5aab2fe9..c26dbd3b2 100644 --- a/sdrbase/dsp/threadedsamplesink.cpp +++ b/sdrbase/dsp/threadedsamplesink.cpp @@ -65,7 +65,7 @@ void ThreadedSampleSink::handleData() size_t count = m_sampleFifo.readBegin(m_sampleFifo.fill(), &part1begin, &part1end, &part2begin, &part2end); // first part of FIFO data - if(part1begin != part1end) { + if(count > 0) { // handle data if(m_sampleSink != NULL) m_sampleSink->feed(part1begin, part1end, positiveOnly); diff --git a/sdrbase/gui/glscope.cpp b/sdrbase/gui/glscope.cpp index 73c0d6202..3dcd28a74 100644 --- a/sdrbase/gui/glscope.cpp +++ b/sdrbase/gui/glscope.cpp @@ -118,7 +118,7 @@ void GLScope::paintGL() handleMode(); - if(m_displayTrace->size() != m_oldTraceSize) { + if(m_displayTrace->size() - m_oldTraceSize != 0) { m_oldTraceSize = m_displayTrace->size(); emit traceSizeChanged(m_displayTrace->size()); } diff --git a/sdrbase/gui/glspectrum.cpp b/sdrbase/gui/glspectrum.cpp index 16db20b61..619b7f611 100644 --- a/sdrbase/gui/glspectrum.cpp +++ b/sdrbase/gui/glspectrum.cpp @@ -663,7 +663,7 @@ void GLSpectrum::paintGL() // paint max hold lines on top of histogram if(m_displayMaxHold) { - if(m_maxHold.size() < m_fftSize) + if(m_maxHold.size() < (uint)m_fftSize) m_maxHold.resize(m_fftSize); for(int i = 0; i < m_fftSize; i++) { int j; @@ -818,12 +818,12 @@ void GLSpectrum::applyChanges() int topMargin = fm.ascent() * 1.5; int bottomMargin = fm.ascent() * 1.5; - int waterfallHeight; - int waterfallTop; + int waterfallHeight = 0; + int waterfallTop = 0; int frequencyScaleHeight = fm.height() * 2; int frequencyScaleTop; - int histogramTop; - int histogramHeight; + int histogramTop = 0; + int histogramHeight = 20; int leftMargin; int rightMargin = fm.width("000");