From 9bd8e9c34e59a974a81aca98f7e3a818c444624a Mon Sep 17 00:00:00 2001
From: f4exb <f4exb06@gmail.com>
Date: Sat, 14 Nov 2020 22:08:06 +0100
Subject: [PATCH] Fixed -Wsign-compare warnings

---
 devices/metis/devicemetisscan.cpp             | 30 +++++++++----------
 devices/metis/devicemetisscan.h               |  2 +-
 .../interferometer/interferometercorr.cpp     | 20 ++++++-------
 .../interferometer/interferometercorr.h       | 22 +++++++-------
 .../demodadsb/adsbdemodsinkworker.cpp         |  2 +-
 plugins/channelrx/demodam/amdemodsink.h       |  4 +--
 .../demodchirpchat/chirpchatdemodsettings.cpp | 10 +++----
 .../demodchirpchat/chirpchatdemodsettings.h   | 22 +++++++-------
 .../demodchirpchat/chirpchatdemodsink.cpp     |  6 ++--
 .../demodchirpchat/chirpchatdemodsink.h       |  6 ++--
 .../channelrx/demoddatv/leansdr/discrmath.h   |  4 +--
 plugins/channelrx/demoddatv/leansdr/dvbs2.h   |  2 +-
 plugins/channelrx/demodssb/ssbdemodgui.cpp    |  2 +-
 .../channelrx/freqtracker/freqtrackersink.cpp |  2 +-
 .../channelrx/freqtracker/freqtrackersink.h   |  2 +-
 plugins/channelrx/remotesink/remotesinkfifo.h |  8 ++---
 plugins/channeltx/modatv/atvmodsource.cpp     |  2 +-
 plugins/channeltx/modatv/atvmodsource.h       |  4 +--
 .../modchirpchat/chirpchatmodsettings.cpp     |  4 +--
 .../modchirpchat/chirpchatmodsettings.h       | 12 ++++----
 .../modchirpchat/chirpchatmodsource.cpp       |  2 +-
 .../remotesource/remotesourcegui.cpp          |  2 +-
 .../metismiso/metismisoudphandler.cpp         |  5 ++--
 .../limesdroutput/limesdroutputplugin.cpp     |  2 +-
 .../remoteoutput/remoteoutputfifo.h           |  8 ++---
 .../usrpoutput/usrpoutputplugin.cpp           |  2 +-
 .../xtrxoutput/xtrxoutputplugin.cpp           |  2 +-
 .../audioinput/audioinputplugin.cpp           |  2 +-
 .../limesdrinput/limesdrinputplugin.cpp       |  2 +-
 .../usrpinput/usrpinputplugin.cpp             |  2 +-
 .../xtrxinput/xtrxinputplugin.cpp             |  2 +-
 sdrbase/channel/channelwebapiutils.cpp        |  8 ++---
 sdrbase/channel/channelwebapiutils.h          |  4 +--
 sdrbase/dsp/dspdevicemimoengine.cpp           |  8 ++---
 sdrbase/dsp/firfilter.h                       | 10 +++----
 sdrbase/dsp/glscopesettings.cpp               |  4 +--
 sdrbase/dsp/glspectrumsettings.cpp            |  4 +--
 sdrbase/dsp/glspectrumsettings.h              |  2 +-
 sdrbase/dsp/samplemififo.cpp                  |  4 +--
 sdrbase/dsp/spectrumvis.cpp                   |  2 +-
 sdrbase/maincore.cpp                          | 10 +++----
 sdrbase/maincore.h                            |  6 ++--
 sdrgui/gui/glspectrumgui.cpp                  |  4 +--
 sdrgui/limerfegui/limerfeusbdialog.cpp        |  8 ++---
 sdrgui/mainwindow.cpp                         |  2 +-
 sdrgui/mainwindow.h                           |  2 +-
 46 files changed, 137 insertions(+), 138 deletions(-)

diff --git a/devices/metis/devicemetisscan.cpp b/devices/metis/devicemetisscan.cpp
index 5772206d8..fb6f0709f 100644
--- a/devices/metis/devicemetisscan.cpp
+++ b/devices/metis/devicemetisscan.cpp
@@ -24,11 +24,11 @@ void DeviceMetisScan::scan()
 {
     m_scans.clear();
 
-    if (m_udpSocket.bind(QHostAddress::AnyIPv4, 10001, QUdpSocket::ShareAddress)) 
+    if (m_udpSocket.bind(QHostAddress::AnyIPv4, 10001, QUdpSocket::ShareAddress))
     {
         connect(&m_udpSocket, SIGNAL(readyRead()), this, SLOT(readyRead()));
-    } 
-    else 
+    }
+    else
     {
         qDebug() << "DeviceMetisScan::scan: cannot bind socket";
         return;
@@ -40,7 +40,7 @@ void DeviceMetisScan::scan()
     buffer[2] = (unsigned char) 0x02;
     std::fill(&buffer[3], &buffer[63], 0);
 
-    if (m_udpSocket.writeDatagram((const char*) buffer, sizeof(buffer), QHostAddress::Broadcast, 1024) < 0) 
+    if (m_udpSocket.writeDatagram((const char*) buffer, sizeof(buffer), QHostAddress::Broadcast, 1024) < 0)
     {
         qDebug() << "DeviceMetisScan::scan: discovery writeDatagram failed " << m_udpSocket.errorString();
         return;
@@ -59,7 +59,7 @@ void DeviceMetisScan::scan()
     qDebug() << "DeviceMetisScan::scan: start 0.5 second timeout loop";
     // Execute the event loop here and wait for the timeout to trigger
     // which in turn will trigger event loop quit.
-    loop.exec();    
+    loop.exec();
 
     disconnect(&m_udpSocket, SIGNAL(readyRead()), this, SLOT(readyRead()));
     m_udpSocket.close();
@@ -81,11 +81,11 @@ void DeviceMetisScan::enumOriginDevices(const QString& hardwareId, PluginInterfa
             i, // sequence
             8, // Nb Rx
             1  // Nb Tx
-        ));        
+        ));
     }
 }
 
-const DeviceMetisScan::DeviceScan* DeviceMetisScan::getDeviceAt(unsigned int index) const
+const DeviceMetisScan::DeviceScan* DeviceMetisScan::getDeviceAt(int index) const
 {
     if (index < m_scans.size()) {
         return &m_scans.at(index);
@@ -97,7 +97,7 @@ const DeviceMetisScan::DeviceScan* DeviceMetisScan::getDeviceAt(unsigned int ind
 void DeviceMetisScan::getSerials(QList<QString>& serials) const
 {
     for (int i = 0; i < m_scans.size(); i++) {
-        serials.append(m_scans.at(i).m_serial); 
+        serials.append(m_scans.at(i).m_serial);
     }
 }
 
@@ -107,17 +107,17 @@ void DeviceMetisScan::readyRead()
     quint16 metisPort;
     unsigned char buffer[1024];
 
-    if (m_udpSocket.readDatagram((char*) &buffer, (qint64) sizeof(buffer), &metisAddress, &metisPort) < 0) 
+    if (m_udpSocket.readDatagram((char*) &buffer, (qint64) sizeof(buffer), &metisAddress, &metisPort) < 0)
     {
         qDebug() << "DeviceMetisScan::readyRead: readDatagram failed " << m_udpSocket.errorString();
         return;
     }
 
-    QString metisIP = QString("%1:%2").arg(metisAddress.toString()).arg(metisPort); 
+    QString metisIP = QString("%1:%2").arg(metisAddress.toString()).arg(metisPort);
 
-    if (buffer[0] == 0xEF && buffer[1] == 0xFE) 
+    if (buffer[0] == 0xEF && buffer[1] == 0xFE)
     {
-        switch(buffer[2]) 
+        switch(buffer[2])
         {
             case 3:  // reply
                 // should not happen on this port
@@ -138,9 +138,9 @@ void DeviceMetisScan::readyRead()
             case 1:  // a data packet
                 break;
         }
-    } 
-    else 
+    }
+    else
     {
         qDebug() << "DeviceMetisScan::readyRead: received invalid response to discovery";
     }
-}
\ No newline at end of file
+}
diff --git a/devices/metis/devicemetisscan.h b/devices/metis/devicemetisscan.h
index 5d3b7366f..10a8bba28 100644
--- a/devices/metis/devicemetisscan.h
+++ b/devices/metis/devicemetisscan.h
@@ -54,7 +54,7 @@ public:
 
     void scan();
     int getNbDevices() const { return m_scans.size(); }
-    const DeviceScan* getDeviceAt(unsigned int index) const;
+    const DeviceScan* getDeviceAt(int index) const;
     void getSerials(QList<QString>& serials) const;
     void enumOriginDevices(const QString& hardwareId, PluginInterface::OriginDevices& originDevices);
 
diff --git a/plugins/channelmimo/interferometer/interferometercorr.cpp b/plugins/channelmimo/interferometer/interferometercorr.cpp
index b04e95b81..f536bf4b3 100644
--- a/plugins/channelmimo/interferometer/interferometercorr.cpp
+++ b/plugins/channelmimo/interferometer/interferometercorr.cpp
@@ -160,9 +160,9 @@ InterferometerCorrelator::~InterferometerCorrelator()
 
 bool InterferometerCorrelator::performCorr(
     const SampleVector& data0,
-    int size0,
+    unsigned int size0,
     const SampleVector& data1,
-    int size1
+    unsigned int size1
 )
 {
     bool results = false;
@@ -308,9 +308,9 @@ bool InterferometerCorrelator::performCorr(
 
 bool InterferometerCorrelator::performOpCorr(
     const SampleVector& data0,
-    int size0,
+    unsigned int size0,
     const SampleVector& data1,
-    int size1,
+    unsigned int size1,
     Sample sampleOp(const Sample& a, const Sample& b)
 )
 {
@@ -333,9 +333,9 @@ bool InterferometerCorrelator::performOpCorr(
 
 bool InterferometerCorrelator::performIFFTCorr(
     const SampleVector& data0,
-    int size0,
+    unsigned int size0,
     const SampleVector& data1,
-    int size1,
+    unsigned int size1,
     bool star
 )
 {
@@ -457,9 +457,9 @@ bool InterferometerCorrelator::performIFFTCorr(
 
 bool InterferometerCorrelator::performIFFT2Corr(
     const SampleVector& data0,
-    int size0,
+    unsigned int size0,
     const SampleVector& data1,
-    int size1
+    unsigned int size1
 )
 {
     unsigned int size = std::min(size0, size1);
@@ -566,9 +566,9 @@ bool InterferometerCorrelator::performIFFT2Corr(
 
 bool InterferometerCorrelator::performFFTProd(
     const SampleVector& data0,
-    int size0,
+    unsigned int size0,
     const SampleVector& data1,
-    int size1
+    unsigned int size1
 )
 {
     unsigned int size = std::min(size0, size1);
diff --git a/plugins/channelmimo/interferometer/interferometercorr.h b/plugins/channelmimo/interferometer/interferometercorr.h
index 146bbba26..a8ed5fb66 100644
--- a/plugins/channelmimo/interferometer/interferometercorr.h
+++ b/plugins/channelmimo/interferometer/interferometercorr.h
@@ -39,9 +39,9 @@ public:
     InterferometerSettings::CorrelationType getCorrType() const { return m_corrType; }
     bool performCorr( //!< Returns true if results were produced
         const SampleVector& data0,
-        int size0,
+        unsigned int size0,
         const SampleVector& data1,
-        int size1
+        unsigned int size1
     );
     int getFullFFTSize() const { return 2*m_fftSize; }
     void setPhase(int phase);
@@ -57,35 +57,35 @@ signals:
 private:
     bool performOpCorr( //!< Returns true if results were produced
         const SampleVector& data0,
-        int size0,
+        unsigned int size0,
         const SampleVector& data1,
-        int size1,
+        unsigned int size1,
         Sample sampleOp(const Sample& a, const Sample& b)
     );
     bool performIFFTCorr( //!< Returns true if results were produced
         const SampleVector& data0,
-        int size0,
+        unsigned int size0,
         const SampleVector& data1,
-        int size1,
+        unsigned int size1,
         bool star = false
     );
     bool performIFFT2Corr( //!< Returns true if results were produced
         const SampleVector& data0,
-        int size0,
+        unsigned int size0,
         const SampleVector& data1,
-        int size1
+        unsigned int size1
     );
     bool performFFTProd( //!< Returns true if results were produced
         const SampleVector& data0,
-        int size0,
+        unsigned int size0,
         const SampleVector& data1,
-        int size1
+        unsigned int size1
     );
     void adjustSCorrSize(int size);
     void adjustTCorrSize(int size);
 
     InterferometerSettings::CorrelationType m_corrType;
-    int m_fftSize;                   //!< FFT length
+    unsigned int m_fftSize;          //!< FFT length
     FFTEngine *m_fft[2];             //!< FFT engines (double FFT)
     FFTEngine *m_invFFT;             //!< Inverse FFT engine (double FFT)
     FFTEngine *m_fft2[2];            //!< FFT engines
diff --git a/plugins/channelrx/demodadsb/adsbdemodsinkworker.cpp b/plugins/channelrx/demodadsb/adsbdemodsinkworker.cpp
index 0e1755066..e3e2d1eaf 100644
--- a/plugins/channelrx/demodadsb/adsbdemodsinkworker.cpp
+++ b/plugins/channelrx/demodadsb/adsbdemodsinkworker.cpp
@@ -186,7 +186,7 @@ void ADSBDemodSinkWorker::run()
             if ((df == 17) || (df == 18))
             {
                 m_crc.init();
-                int parity = (data[11] << 16) | (data[12] << 8) | data[13]; // Parity / CRC
+                unsigned int parity = (data[11] << 16) | (data[12] << 8) | data[13]; // Parity / CRC
 
                 m_crc.calculate(data, ADS_B_ES_BYTES-3);
                 if (parity == m_crc.get())
diff --git a/plugins/channelrx/demodam/amdemodsink.h b/plugins/channelrx/demodam/amdemodsink.h
index 1ab7d3652..8e5ee09f7 100644
--- a/plugins/channelrx/demodam/amdemodsink.h
+++ b/plugins/channelrx/demodam/amdemodsink.h
@@ -95,7 +95,7 @@ private:
 	Real m_interpolatorDistanceRemain;
 
 	Real m_squelchLevel;
-	uint32_t m_squelchCount;
+	int m_squelchCount;
 	bool m_squelchOpen;
 	DoubleBufferFIFO<Real> m_squelchDelayLine;
 	double m_magsq;
@@ -123,4 +123,4 @@ private:
     void processOneSample(Complex &ci);
 };
 
-#endif // INCLUDE_AMDEMODSINK_H
\ No newline at end of file
+#endif // INCLUDE_AMDEMODSINK_H
diff --git a/plugins/channelrx/demodchirpchat/chirpchatdemodsettings.cpp b/plugins/channelrx/demodchirpchat/chirpchatdemodsettings.cpp
index 817ccf733..7ab8900bd 100644
--- a/plugins/channelrx/demodchirpchat/chirpchatdemodsettings.cpp
+++ b/plugins/channelrx/demodchirpchat/chirpchatdemodsettings.cpp
@@ -111,12 +111,12 @@ QByteArray ChirpChatDemodSettings::serialize() const
     s.writeS32(8, m_codingScheme);
     s.writeBool(9, m_decodeActive);
     s.writeS32(10, m_eomSquelchTenths);
-    s.writeS32(11, m_nbSymbolsMax);
+    s.writeU32(11, m_nbSymbolsMax);
     s.writeS32(12, m_packetLength);
     s.writeS32(13, m_nbParityBits);
     s.writeBool(14, m_hasCRC);
     s.writeBool(15, m_hasHeader);
-    s.writeS32(17, m_preambleChirps);
+    s.writeU32(17, m_preambleChirps);
     s.writeS32(18, (int) m_fftWindow);
     s.writeBool(20, m_useReverseAPI);
     s.writeString(21, m_reverseAPIAddress);
@@ -167,12 +167,12 @@ bool ChirpChatDemodSettings::deserialize(const QByteArray& data)
         m_codingScheme = (CodingScheme) tmp;
         d.readBool(9, &m_decodeActive, true);
         d.readS32(10, &m_eomSquelchTenths, 60);
-        d.readS32(11, &m_nbSymbolsMax, 255);
+        d.readU32(11, &m_nbSymbolsMax, 255);
         d.readS32(12, &m_packetLength, 32);
         d.readS32(13, &m_nbParityBits, 1);
         d.readBool(14, &m_hasCRC, true);
         d.readBool(15, &m_hasHeader, true);
-        d.readS32(17, &m_preambleChirps, 8);
+        d.readU32(17, &m_preambleChirps, 8);
         d.readS32(18, &tmp, (int) FFTWindow::Rectangle);
         m_fftWindow = (FFTWindow::Function) tmp;
         d.readBool(20, &m_useReverseAPI, false);
@@ -223,4 +223,4 @@ unsigned int ChirpChatDemodSettings::getNbSFDFourths() const
 bool ChirpChatDemodSettings::hasSyncWord() const
 {
     return m_codingScheme == CodingLoRa;
-}
\ No newline at end of file
+}
diff --git a/plugins/channelrx/demodchirpchat/chirpchatdemodsettings.h b/plugins/channelrx/demodchirpchat/chirpchatdemodsettings.h
index 987893544..8a31625ce 100644
--- a/plugins/channelrx/demodchirpchat/chirpchatdemodsettings.h
+++ b/plugins/channelrx/demodchirpchat/chirpchatdemodsettings.h
@@ -44,17 +44,17 @@ struct ChirpChatDemodSettings
     FFTWindow::Function m_fftWindow;
     CodingScheme m_codingScheme;
     bool m_decodeActive;
-    int m_eomSquelchTenths;  //!< Squelch factor to trigger end of message (/10)
-    int m_nbSymbolsMax;      //!< Maximum number of symbols in a payload
-    bool m_autoNbSymbolsMax; //!< Set maximum number of symbols in a payload automatically using last messag value
-    int m_preambleChirps;    //!< Number of expected preamble chirps
-    int m_nbParityBits;      //!< Hamming parity bits (LoRa)
-    int m_packetLength;      //!< Payload packet length in bytes or characters (LoRa)
-    bool m_hasCRC;           //!< Payload has CRC (LoRa)
-    bool m_hasHeader;        //!< Header present before actual payload (LoRa)
-    bool m_sendViaUDP;       //!< Send decoded message via UDP
-    QString m_udpAddress;    //!< UDP address where to send message
-    uint16_t m_udpPort;      //!< UDP port where to send message
+    int m_eomSquelchTenths;        //!< Squelch factor to trigger end of message (/10)
+    unsigned int m_nbSymbolsMax;   //!< Maximum number of symbols in a payload
+    bool m_autoNbSymbolsMax;       //!< Set maximum number of symbols in a payload automatically using last messag value
+    unsigned int m_preambleChirps; //!< Number of expected preamble chirps
+    int m_nbParityBits;            //!< Hamming parity bits (LoRa)
+    int m_packetLength;            //!< Payload packet length in bytes or characters (LoRa)
+    bool m_hasCRC;                 //!< Payload has CRC (LoRa)
+    bool m_hasHeader;              //!< Header present before actual payload (LoRa)
+    bool m_sendViaUDP;             //!< Send decoded message via UDP
+    QString m_udpAddress;          //!< UDP address where to send message
+    uint16_t m_udpPort;            //!< UDP port where to send message
     uint32_t m_rgbColor;
     QString m_title;
     int m_streamIndex;
diff --git a/plugins/channelrx/demodchirpchat/chirpchatdemodsink.cpp b/plugins/channelrx/demodchirpchat/chirpchatdemodsink.cpp
index cf0c40db4..5693957b0 100644
--- a/plugins/channelrx/demodchirpchat/chirpchatdemodsink.cpp
+++ b/plugins/channelrx/demodchirpchat/chirpchatdemodsink.cpp
@@ -117,7 +117,7 @@ void ChirpChatDemodSink::initSF(unsigned int sf, unsigned int deBits, FFTWindow:
     float phase = -halfAngle;
     double accumulator = 0;
 
-    for (int i = 0; i < m_fftLength; i++)
+    for (unsigned int i = 0; i < m_fftLength; i++)
     {
         accumulator = fmod(accumulator + phase, 2*M_PI);
         m_downChirps[i] = Complex(std::conj(std::polar(1.0, accumulator)));
@@ -191,7 +191,7 @@ void ChirpChatDemodSink::processSample(const Complex& ci)
                 m_argMaxHistoryCounter = 0;
                 bool preambleFound = true;
 
-                for (int i = 1; i < m_requiredPreambleChirps; i++)
+                for (unsigned int i = 1; i < m_requiredPreambleChirps; i++)
                 {
                     int delta = m_argMaxHistory[i] - m_argMaxHistory[i-1];
                     // qDebug("ChirpChatDemodSink::processSample: search: delta: %d / %d", delta, m_deLength);
@@ -314,7 +314,7 @@ void ChirpChatDemodSink::processSample(const Complex& ci)
                     int zadj;
                     int sfdSkip = m_sfdSkip;
 
-                    for (int i = 0; i < m_chirpCount - 1 - (m_settings.hasSyncWord() ? 2 : 0); i++)
+                    for (unsigned int i = 0; i < m_chirpCount - 1 - (m_settings.hasSyncWord() ? 2 : 0); i++)
                     {
                         sadj += m_preambleHistory[i] > m_nbSymbols/2 ? m_preambleHistory[i] - m_nbSymbols : m_preambleHistory[i];
                         nadj++;
diff --git a/plugins/channelrx/demodchirpchat/chirpchatdemodsink.h b/plugins/channelrx/demodchirpchat/chirpchatdemodsink.h
index 0fa1831ba..bce0aa603 100644
--- a/plugins/channelrx/demodchirpchat/chirpchatdemodsink.h
+++ b/plugins/channelrx/demodchirpchat/chirpchatdemodsink.h
@@ -72,8 +72,8 @@ private:
 	int m_bandwidth;
     int m_channelSampleRate;
     int m_channelFrequencyOffset;
-	int m_chirp;
-	int m_chirp0;
+	unsigned int m_chirp;
+	unsigned int m_chirp0;
 
     static const unsigned int m_requiredPreambleChirps = 4; //!< Number of chirps required to estimate preamble
     static const unsigned int m_maxSFDSearchChirps = 8;     //!< Maximum number of chirps when looking for SFD after preamble detection
@@ -143,4 +143,4 @@ private:
     unsigned int evalSymbol(unsigned int rawSymbol);
 };
 
-#endif // INCLUDE_CHIRPCHATDEMODSINK_H
\ No newline at end of file
+#endif // INCLUDE_CHIRPCHATDEMODSINK_H
diff --git a/plugins/channelrx/demoddatv/leansdr/discrmath.h b/plugins/channelrx/demoddatv/leansdr/discrmath.h
index 285e6b0d5..0464ff739 100644
--- a/plugins/channelrx/demoddatv/leansdr/discrmath.h
+++ b/plugins/channelrx/demoddatv/leansdr/discrmath.h
@@ -40,7 +40,7 @@ struct bitvect
     bitvect(T val)
     {
         v[0] = val;
-        for (int i = 1; i < NW; ++i)
+        for (unsigned int i = 1; i < NW; ++i)
             v[i] = 0;
     }
 
@@ -139,7 +139,7 @@ bitvect<T, N> shiftdivmod(const Tm *m, size_t nm, const bitvect<T, N> &p,
                           T init = 0)
 {
     bitvect<T, N> res;
-    for (int i = 0; i < res.NW; ++i)
+    for (unsigned int i = 0; i < res.NW; ++i)
         res.v[i] = init;
     const Tm bitmask = (Tm)1 << (sizeof(Tm) * 8 - 1);
     for (; nm--; ++m)
diff --git a/plugins/channelrx/demoddatv/leansdr/dvbs2.h b/plugins/channelrx/demoddatv/leansdr/dvbs2.h
index 2fbf2e72f..08498304d 100644
--- a/plugins/channelrx/demoddatv/leansdr/dvbs2.h
+++ b/plugins/channelrx/demoddatv/leansdr/dvbs2.h
@@ -171,7 +171,7 @@ struct s2_bbscrambling
     s2_bbscrambling()
     {
         uint16_t st = 0x00a9; // 000 0000 1010 1001  (Fig 5 reversed)
-        for (int i = 0; i < sizeof(pattern); ++i)
+        for (unsigned int i = 0; i < sizeof(pattern); ++i)
         {
             uint8_t out = 0;
             for (int n = 8; n--;)
diff --git a/plugins/channelrx/demodssb/ssbdemodgui.cpp b/plugins/channelrx/demodssb/ssbdemodgui.cpp
index 7567e45cc..47fd5803a 100644
--- a/plugins/channelrx/demodssb/ssbdemodgui.cpp
+++ b/plugins/channelrx/demodssb/ssbdemodgui.cpp
@@ -197,7 +197,7 @@ void SSBDemodGUI::on_audioMute_toggled(bool checked)
 
 void SSBDemodGUI::on_spanLog2_valueChanged(int value)
 {
-    unsigned int s2max = spanLog2Max();
+    int s2max = spanLog2Max();
 
     if ((value < 0) || (value > s2max-1)) {
         return;
diff --git a/plugins/channelrx/freqtracker/freqtrackersink.cpp b/plugins/channelrx/freqtracker/freqtrackersink.cpp
index 4b8ee1c78..157305561 100644
--- a/plugins/channelrx/freqtracker/freqtrackersink.cpp
+++ b/plugins/channelrx/freqtracker/freqtrackersink.cpp
@@ -385,7 +385,7 @@ void FreqTrackerSink::tick()
     {
         if ((m_settings.m_tracking) && getSquelchOpen())
         {
-            uint32_t decayDivider = 200.0 * m_settings.m_alphaEMA;
+            int decayDivider = 200.0 * m_settings.m_alphaEMA;
             int decayAmount = m_sinkSampleRate < decayDivider ? 1 : m_sinkSampleRate / decayDivider;
             int trim = m_sinkSampleRate / 1000;
 
diff --git a/plugins/channelrx/freqtracker/freqtrackersink.h b/plugins/channelrx/freqtracker/freqtrackersink.h
index f1abf867c..bed91fa7b 100644
--- a/plugins/channelrx/freqtracker/freqtrackersink.h
+++ b/plugins/channelrx/freqtracker/freqtrackersink.h
@@ -98,7 +98,7 @@ private:
 
     int m_channelSampleRate;
     int m_inputFrequencyOffset;
-    uint32_t m_sinkSampleRate;
+    int m_sinkSampleRate;
 
 	SpectrumVis* m_spectrumSink;
 	SampleVector m_sampleBuffer;
diff --git a/plugins/channelrx/remotesink/remotesinkfifo.h b/plugins/channelrx/remotesink/remotesinkfifo.h
index e1e055320..7e0d47b13 100644
--- a/plugins/channelrx/remotesink/remotesinkfifo.h
+++ b/plugins/channelrx/remotesink/remotesinkfifo.h
@@ -44,12 +44,12 @@ signals:
 private:
     std::vector<RemoteDataBlock> m_data;
     int m_size;
-    unsigned int m_readHead;   //!< index of last data block processed
-    unsigned int m_servedHead; //!< index of last data block served
-    unsigned int m_writeHead;  //!< index of next data block to serve
+    int m_readHead;   //!< index of last data block processed
+    int m_servedHead; //!< index of last data block served
+    int m_writeHead;  //!< index of next data block to serve
     QMutex m_mutex;
 
     unsigned int calculateRemainder();
 };
 
-#endif // REMOTESINK_REMOTESINKFIFO_H_
\ No newline at end of file
+#endif // REMOTESINK_REMOTESINKFIFO_H_
diff --git a/plugins/channeltx/modatv/atvmodsource.cpp b/plugins/channeltx/modatv/atvmodsource.cpp
index 63298c2f7..924029ec9 100644
--- a/plugins/channeltx/modatv/atvmodsource.cpp
+++ b/plugins/channeltx/modatv/atvmodsource.cpp
@@ -1088,7 +1088,7 @@ void ATVModSource::reportVideoFileSourceStreamTiming()
     }
 }
 
-void ATVModSource::configureCameraIndex(int index)
+void ATVModSource::configureCameraIndex(unsigned int index)
 {
     if (index < m_cameras.size())
     {
diff --git a/plugins/channeltx/modatv/atvmodsource.h b/plugins/channeltx/modatv/atvmodsource.h
index b2b66b52f..daa55009d 100644
--- a/plugins/channeltx/modatv/atvmodsource.h
+++ b/plugins/channeltx/modatv/atvmodsource.h
@@ -68,7 +68,7 @@ public:
     void openVideo(const QString& fileName);
     void seekVideoFileStream(int seekPercentage);
     void reportVideoFileSourceStreamTiming();
-    void configureCameraIndex(int index);
+    void configureCameraIndex(unsigned int index);
     void configureCameraData(uint32_t index, float mnaualFPS, bool manualFPSEnable);
 
     static void getBaseValues(int outputSampleRate, int linesPerSecond, int& sampleRateUnits, uint32_t& nbPointsPerRateUnit);
@@ -164,7 +164,7 @@ private:
     int      m_nbLines2;         //!< same number as above (non interlaced) or Euclidean half the number above (interlaced)
     int      m_nbLinesField1;    //!< In interlaced mode: number of lines in field1 transition included
     uint32_t m_nbImageLines2;    //!< half the number of effective image lines
-    uint32_t m_nbImageLines;     //!< number of effective image lines
+    int      m_nbImageLines;     //!< number of effective image lines
     uint32_t m_imageLineStart1;  //!< start index of line for field 1
     uint32_t m_imageLineStart2;  //!< start index of line for field 2
     int      m_nbHorizPoints;    //!< number of line points per horizontal line
diff --git a/plugins/channeltx/modchirpchat/chirpchatmodsettings.cpp b/plugins/channeltx/modchirpchat/chirpchatmodsettings.cpp
index 9ecd7061f..a371d87a9 100644
--- a/plugins/channeltx/modchirpchat/chirpchatmodsettings.cpp
+++ b/plugins/channeltx/modchirpchat/chirpchatmodsettings.cpp
@@ -157,7 +157,7 @@ QByteArray ChirpChatModSettings::serialize() const
     s.writeS32(7, m_deBits);
     s.writeBool(8, m_channelMute);
     s.writeU32(9, m_syncWord);
-    s.writeS32(10, m_preambleChirps);
+    s.writeU32(10, m_preambleChirps);
     s.writeS32(11, m_quietMillis);
     s.writeBool(12, m_useReverseAPI);
     s.writeString(13, m_reverseAPIAddress);
@@ -226,7 +226,7 @@ bool ChirpChatModSettings::deserialize(const QByteArray& data)
         d.readBool(8, &m_channelMute, false);
         d.readU32(9, &utmp, 0x34);
         m_syncWord = utmp > 255 ? 0 : utmp;
-        d.readS32(10, &m_preambleChirps, 8);
+        d.readU32(10, &m_preambleChirps, 8);
         d.readS32(11, &m_quietMillis, 1000);
         d.readBool(11, &m_useReverseAPI, false);
         d.readString(12, &m_reverseAPIAddress, "127.0.0.1");
diff --git a/plugins/channeltx/modchirpchat/chirpchatmodsettings.h b/plugins/channeltx/modchirpchat/chirpchatmodsettings.h
index f2eed957e..451b9c102 100644
--- a/plugins/channeltx/modchirpchat/chirpchatmodsettings.h
+++ b/plugins/channeltx/modchirpchat/chirpchatmodsettings.h
@@ -52,12 +52,12 @@ struct ChirpChatModSettings
     int m_inputFrequencyOffset;
     int m_bandwidthIndex;
     int m_spreadFactor;
-    int m_deBits;         //!< Low data rate optmize (DE) bits
-    int m_preambleChirps; //!< Number of preamble chirps
-    int m_quietMillis;    //!< Number of milliseconds to pause between transmissions
-    int m_nbParityBits;   //!< Hamming parity bits (LoRa)
-    bool m_hasCRC;        //!< Payload has CRC (LoRa)
-    bool m_hasHeader;     //!< Header present before actual payload (LoRa)
+    int m_deBits;                  //!< Low data rate optmize (DE) bits
+    unsigned int m_preambleChirps; //!< Number of preamble chirps
+    int m_quietMillis;             //!< Number of milliseconds to pause between transmissions
+    int m_nbParityBits;            //!< Hamming parity bits (LoRa)
+    bool m_hasCRC;                 //!< Payload has CRC (LoRa)
+    bool m_hasHeader;              //!< Header present before actual payload (LoRa)
     unsigned char m_syncWord;
     bool m_channelMute;
     CodingScheme m_codingScheme;
diff --git a/plugins/channeltx/modchirpchat/chirpchatmodsource.cpp b/plugins/channeltx/modchirpchat/chirpchatmodsource.cpp
index 9c6e6dc48..d09b2df8f 100644
--- a/plugins/channeltx/modchirpchat/chirpchatmodsource.cpp
+++ b/plugins/channeltx/modchirpchat/chirpchatmodsource.cpp
@@ -62,7 +62,7 @@ void ChirpChatModSource::initSF(unsigned int sf)
     m_phaseIncrements = new double[2*m_fftLength*ChirpChatModSettings::oversampling];
     phase = -halfAngle;
 
-    for (int i = 0; i < m_fftLength*ChirpChatModSettings::oversampling; i++)
+    for (unsigned int i = 0; i < m_fftLength*ChirpChatModSettings::oversampling; i++)
     {
         m_phaseIncrements[i] = phase;
         phase += (2*halfAngle) / (m_fftLength*ChirpChatModSettings::oversampling);
diff --git a/plugins/channeltx/remotesource/remotesourcegui.cpp b/plugins/channeltx/remotesource/remotesourcegui.cpp
index b2d23c49e..5070f706b 100644
--- a/plugins/channeltx/remotesource/remotesourcegui.cpp
+++ b/plugins/channeltx/remotesource/remotesourcegui.cpp
@@ -78,7 +78,7 @@ bool RemoteSourceGUI::handleMessage(const Message& message)
     {
         const RemoteSource::MsgReportStreamData& report = (RemoteSource::MsgReportStreamData&) message;
 
-        uint32_t remoteSampleRate = report.get_sampleRate();
+        int remoteSampleRate = report.get_sampleRate();
 
         if (remoteSampleRate != m_remoteSampleRate)
         {
diff --git a/plugins/samplemimo/metismiso/metismisoudphandler.cpp b/plugins/samplemimo/metismiso/metismisoudphandler.cpp
index b08abaf28..80a28d8a6 100644
--- a/plugins/samplemimo/metismiso/metismisoudphandler.cpp
+++ b/plugins/samplemimo/metismiso/metismisoudphandler.cpp
@@ -263,8 +263,7 @@ void MetisMISOUDPHandler::dataReadyRead()
     quint16 metisPort;
     unsigned char receiveBuffer[1032];
     qint64 length;
-
-    long sequence;
+    unsigned long sequence;
 
     if ((length = m_socket.readDatagram((char*) &receiveBuffer, (qint64) sizeof(receiveBuffer), &metisAddress, &metisPort)) != 1032)
     {
@@ -483,7 +482,7 @@ bool MetisMISOUDPHandler::getRxIQInversion(int index)
 void MetisMISOUDPHandler::processIQBuffer(unsigned char* buffer)
 {
     int b = 0;
-    int r;
+    unsigned int r;
     int sampleI, sampleQ, sampleMic;
 
 
diff --git a/plugins/samplesink/limesdroutput/limesdroutputplugin.cpp b/plugins/samplesink/limesdroutput/limesdroutputplugin.cpp
index 8aeaa6f2a..26d54f0d3 100644
--- a/plugins/samplesink/limesdroutput/limesdroutputplugin.cpp
+++ b/plugins/samplesink/limesdroutput/limesdroutputplugin.cpp
@@ -78,7 +78,7 @@ PluginInterface::SamplingDevices LimeSDROutputPlugin::enumSampleSinks(const Orig
     {
         if (it->hardwareId == m_hardwareID)
         {
-            for (unsigned int j = 0; j < it->nbTxStreams; j++)
+            for (int j = 0; j < it->nbTxStreams; j++)
             {
                 qDebug("LimeSDROutputPlugin::enumSampleSinks: device #%d channel %u: %s", it->sequence, j, qPrintable(it->serial));
                 QString displayedName = it->displayableName;
diff --git a/plugins/samplesink/remoteoutput/remoteoutputfifo.h b/plugins/samplesink/remoteoutput/remoteoutputfifo.h
index 113c779bf..aa870c286 100644
--- a/plugins/samplesink/remoteoutput/remoteoutputfifo.h
+++ b/plugins/samplesink/remoteoutput/remoteoutputfifo.h
@@ -44,12 +44,12 @@ signals:
 private:
     std::vector<RemoteDataBlock> m_data;
     int m_size;
-    unsigned int m_readHead;   //!< index of last data block processed
-    unsigned int m_servedHead; //!< index of last data block served
-    unsigned int m_writeHead;  //!< index of next data block to serve
+    int m_readHead;   //!< index of last data block processed
+    int m_servedHead; //!< index of last data block served
+    int m_writeHead;  //!< index of next data block to serve
     QMutex m_mutex;
 
     unsigned int calculateRemainder();
 };
 
-#endif // REMOTESINK_REMOTEOUTPUTFIFO_H_
\ No newline at end of file
+#endif // REMOTESINK_REMOTEOUTPUTFIFO_H_
diff --git a/plugins/samplesink/usrpoutput/usrpoutputplugin.cpp b/plugins/samplesink/usrpoutput/usrpoutputplugin.cpp
index 8a503825a..f072bee8f 100644
--- a/plugins/samplesink/usrpoutput/usrpoutputplugin.cpp
+++ b/plugins/samplesink/usrpoutput/usrpoutputplugin.cpp
@@ -78,7 +78,7 @@ PluginInterface::SamplingDevices USRPOutputPlugin::enumSampleSinks(const OriginD
     {
         if (it->hardwareId == m_hardwareID)
         {
-            for (unsigned int j = 0; j < it->nbTxStreams; j++)
+            for (int j = 0; j < it->nbTxStreams; j++)
             {
                 qDebug("USRPOutputPlugin::enumSampleSinks: device #%d channel %u: %s", it->sequence, j, qPrintable(it->serial));
                 QString displayedName = it->displayableName;
diff --git a/plugins/samplesink/xtrxoutput/xtrxoutputplugin.cpp b/plugins/samplesink/xtrxoutput/xtrxoutputplugin.cpp
index a071c29dd..fd569ac1f 100644
--- a/plugins/samplesink/xtrxoutput/xtrxoutputplugin.cpp
+++ b/plugins/samplesink/xtrxoutput/xtrxoutputplugin.cpp
@@ -79,7 +79,7 @@ PluginInterface::SamplingDevices XTRXOutputPlugin::enumSampleSinks(const OriginD
     {
         if (it->hardwareId == m_hardwareID)
         {
-            for (unsigned int j = 0; j < it->nbTxStreams; j++)
+            for (int j = 0; j < it->nbTxStreams; j++)
             {
                 qDebug("XTRXInputPlugin::enumSampleSinks: device #%d channel %u: %s", it->sequence, j, qPrintable(it->serial));
                 QString displayedName = it->displayableName;
diff --git a/plugins/samplesource/audioinput/audioinputplugin.cpp b/plugins/samplesource/audioinput/audioinputplugin.cpp
index 6589679a9..292180b1a 100644
--- a/plugins/samplesource/audioinput/audioinputplugin.cpp
+++ b/plugins/samplesource/audioinput/audioinputplugin.cpp
@@ -83,7 +83,7 @@ PluginInterface::SamplingDevices AudioInputPlugin::enumSampleSources(const Origi
     {
         if (it->hardwareId == m_hardwareID)
         {
-            for (unsigned int j = 0; j < it->nbRxStreams; j++)
+            for (int j = 0; j < it->nbRxStreams; j++)
             {
                 result.append(SamplingDevice(
                     it->displayableName,
diff --git a/plugins/samplesource/limesdrinput/limesdrinputplugin.cpp b/plugins/samplesource/limesdrinput/limesdrinputplugin.cpp
index 8092fed45..93ff16af1 100644
--- a/plugins/samplesource/limesdrinput/limesdrinputplugin.cpp
+++ b/plugins/samplesource/limesdrinput/limesdrinputplugin.cpp
@@ -78,7 +78,7 @@ PluginInterface::SamplingDevices LimeSDRInputPlugin::enumSampleSources(const Ori
     {
         if (it->hardwareId == m_hardwareID)
         {
-            for (unsigned int j = 0; j < it->nbRxStreams; j++)
+            for (int j = 0; j < it->nbRxStreams; j++)
             {
                 qDebug("LimeSDRInputPlugin::enumSampleSources: device #%d channel %u: %s", it->sequence, j, qPrintable(it->serial));
                 QString displayedName = it->displayableName;
diff --git a/plugins/samplesource/usrpinput/usrpinputplugin.cpp b/plugins/samplesource/usrpinput/usrpinputplugin.cpp
index 377844d16..647309458 100644
--- a/plugins/samplesource/usrpinput/usrpinputplugin.cpp
+++ b/plugins/samplesource/usrpinput/usrpinputplugin.cpp
@@ -78,7 +78,7 @@ PluginInterface::SamplingDevices USRPInputPlugin::enumSampleSources(const Origin
     {
         if (it->hardwareId == m_hardwareID)
         {
-            for (unsigned int j = 0; j < it->nbRxStreams; j++)
+            for (int j = 0; j < it->nbRxStreams; j++)
             {
                 qDebug("USRPInputPlugin::enumSampleSources: device #%d channel %u: %s", it->sequence, j, qPrintable(it->serial));
                 QString displayedName = it->displayableName;
diff --git a/plugins/samplesource/xtrxinput/xtrxinputplugin.cpp b/plugins/samplesource/xtrxinput/xtrxinputplugin.cpp
index fbf52d75c..10ab0855c 100644
--- a/plugins/samplesource/xtrxinput/xtrxinputplugin.cpp
+++ b/plugins/samplesource/xtrxinput/xtrxinputplugin.cpp
@@ -81,7 +81,7 @@ PluginInterface::SamplingDevices XTRXInputPlugin::enumSampleSources(const Origin
     {
         if (it->hardwareId == m_hardwareID)
         {
-            for (unsigned int j = 0; j < it->nbRxStreams; j++)
+            for (int j = 0; j < it->nbRxStreams; j++)
             {
                 qDebug("XTRXInputPlugin::enumSampleSources: device #%d channel %u: %s", it->sequence, j, qPrintable(it->serial));
                 QString displayedName = it->displayableName;
diff --git a/sdrbase/channel/channelwebapiutils.cpp b/sdrbase/channel/channelwebapiutils.cpp
index 99a5fcad0..62a104a21 100644
--- a/sdrbase/channel/channelwebapiutils.cpp
+++ b/sdrbase/channel/channelwebapiutils.cpp
@@ -35,7 +35,7 @@
 #include "webapi/webapiadapterinterface.h"
 #include "webapi/webapiutils.h"
 
-bool ChannelWebAPIUtils::getCenterFrequency(int deviceIndex, double &frequencyInHz)
+bool ChannelWebAPIUtils::getCenterFrequency(unsigned int deviceIndex, double &frequencyInHz)
 {
     SWGSDRangel::SWGDeviceSettings deviceSettingsResponse;
     SWGSDRangel::SWGErrorResponse errorResponse;
@@ -44,7 +44,7 @@ bool ChannelWebAPIUtils::getCenterFrequency(int deviceIndex, double &frequencyIn
 
     // Get current device settings
     std::vector<DeviceSet*> deviceSets = MainCore::instance()->getDeviceSets();
-    if ((deviceIndex >= 0) && (deviceIndex < deviceSets.size()))
+    if (deviceIndex < deviceSets.size())
     {
         deviceSet = deviceSets[deviceIndex];
         if (deviceSet->m_deviceSourceEngine)
@@ -91,7 +91,7 @@ bool ChannelWebAPIUtils::getCenterFrequency(int deviceIndex, double &frequencyIn
     return WebAPIUtils::getSubObjectDouble(*jsonObj, "centerFrequency", frequencyInHz);
 }
 
-bool ChannelWebAPIUtils::setCenterFrequency(int deviceIndex, double frequencyInHz)
+bool ChannelWebAPIUtils::setCenterFrequency(unsigned int deviceIndex, double frequencyInHz)
 {
     SWGSDRangel::SWGDeviceSettings deviceSettingsResponse;
     SWGSDRangel::SWGErrorResponse errorResponse;
@@ -100,7 +100,7 @@ bool ChannelWebAPIUtils::setCenterFrequency(int deviceIndex, double frequencyInH
 
     // Get current device settings
     std::vector<DeviceSet*> deviceSets = MainCore::instance()->getDeviceSets();
-    if ((deviceIndex >= 0) && (deviceIndex < deviceSets.size()))
+    if (deviceIndex < deviceSets.size())
     {
         deviceSet = deviceSets[deviceIndex];
         if (deviceSet->m_deviceSourceEngine)
diff --git a/sdrbase/channel/channelwebapiutils.h b/sdrbase/channel/channelwebapiutils.h
index 52b080f9c..624cf6ae6 100644
--- a/sdrbase/channel/channelwebapiutils.h
+++ b/sdrbase/channel/channelwebapiutils.h
@@ -23,8 +23,8 @@
 class SDRBASE_API ChannelWebAPIUtils
 {
 public:
-    static bool getCenterFrequency(int deviceIndex, double &frequencyInHz);
-    static bool setCenterFrequency(int deviceIndex, double frequencyInHz);
+    static bool getCenterFrequency(unsigned int deviceIndex, double &frequencyInHz);
+    static bool setCenterFrequency(unsigned int deviceIndex, double frequencyInHz);
 };
 
 #endif // SDRBASE_CHANNEL_CHANNELWEBAPIUTILS_H_
diff --git a/sdrbase/dsp/dspdevicemimoengine.cpp b/sdrbase/dsp/dspdevicemimoengine.cpp
index 3c5465e95..dd782e82c 100644
--- a/sdrbase/dsp/dspdevicemimoengine.cpp
+++ b/sdrbase/dsp/dspdevicemimoengine.cpp
@@ -811,13 +811,13 @@ void DSPDeviceMIMOEngine::handleSetMIMO(DeviceSampleMIMO* mimo)
         return;
     }
 
-    for (int i = 0; i < m_deviceSampleMIMO->getNbSinkFifos(); i++)
+    for (unsigned int i = 0; i < m_deviceSampleMIMO->getNbSinkFifos(); i++)
     {
         m_basebandSampleSinks.push_back(BasebandSampleSinks());
         m_sourcesCorrections.push_back(SourceCorrection());
     }
 
-    for (int i = 0; i < m_deviceSampleMIMO->getNbSourceFifos(); i++)
+    for (unsigned int i = 0; i < m_deviceSampleMIMO->getNbSourceFifos(); i++)
     {
         m_basebandSampleSources.push_back(BasebandSampleSources());
         m_sourceSampleBuffers.push_back(IncrementalVector<Sample>());
@@ -1018,7 +1018,7 @@ void DSPDeviceMIMOEngine::handleSynchronousMessages()
         MIMOChannel *channel = msg->getChannel();
         m_mimoChannels.push_back(channel);
 
-        for (int isource = 0; isource < m_deviceSampleMIMO->getNbSourceStreams(); isource++)
+        for (unsigned int isource = 0; isource < m_deviceSampleMIMO->getNbSourceStreams(); isource++)
         {
             DSPMIMOSignalNotification notif(
                 m_deviceSampleMIMO->getSourceSampleRate(isource),
@@ -1029,7 +1029,7 @@ void DSPDeviceMIMOEngine::handleSynchronousMessages()
             channel->handleMessage(notif);
         }
 
-        for (int isink = 0; isink < m_deviceSampleMIMO->getNbSinkStreams(); isink++)
+        for (unsigned int isink = 0; isink < m_deviceSampleMIMO->getNbSinkStreams(); isink++)
         {
             DSPMIMOSignalNotification notif(
                 m_deviceSampleMIMO->getSinkSampleRate(isink),
diff --git a/sdrbase/dsp/firfilter.h b/sdrbase/dsp/firfilter.h
index 2df3fe7f6..4ade8ab87 100644
--- a/sdrbase/dsp/firfilter.h
+++ b/sdrbase/dsp/firfilter.h
@@ -35,14 +35,14 @@ public:
     Type filter(Type sample)
     {
         Type acc = 0;
-        int n_samples = m_samples.size();
-        int n_taps = m_taps.size() - 1;
-        int a = m_ptr;
-        int b = a == 0 ? n_samples - 1 : a - 1;
+        unsigned int n_samples = m_samples.size();
+        unsigned int n_taps = m_taps.size() - 1;
+        unsigned int a = m_ptr;
+        unsigned int b = a == 0 ? n_samples - 1 : a - 1;
 
         m_samples[m_ptr] = sample;
 
-        for (int i = 0; i < n_taps; ++i)
+        for (unsigned int i = 0; i < n_taps; ++i)
         {
             acc += (m_samples[a] + m_samples[b]) * m_taps[i];
 
diff --git a/sdrbase/dsp/glscopesettings.cpp b/sdrbase/dsp/glscopesettings.cpp
index 598ceee90..cd1a51988 100644
--- a/sdrbase/dsp/glscopesettings.cpp
+++ b/sdrbase/dsp/glscopesettings.cpp
@@ -135,7 +135,7 @@ bool GLScopeSettings::deserialize(const QByteArray& data)
         m_tracesData.clear();
         float r, g, b;
 
-        for (int iTrace = 0; iTrace < nbTracesSaved; iTrace++)
+        for (unsigned int iTrace = 0; iTrace < nbTracesSaved; iTrace++)
         {
             if (20 + 16*iTrace > 200) {
                 break;
@@ -171,7 +171,7 @@ bool GLScopeSettings::deserialize(const QByteArray& data)
         d.readU32(200, &nbTriggersSaved, 1);
         m_triggersData.clear();
 
-        for (int iTrigger = 0; iTrigger < nbTriggersSaved; iTrigger++)
+        for (unsigned int iTrigger = 0; iTrigger < nbTriggersSaved; iTrigger++)
         {
             m_triggersData.push_back(TriggerData());
 
diff --git a/sdrbase/dsp/glspectrumsettings.cpp b/sdrbase/dsp/glspectrumsettings.cpp
index 9592815ef..cc139ad14 100644
--- a/sdrbase/dsp/glspectrumsettings.cpp
+++ b/sdrbase/dsp/glspectrumsettings.cpp
@@ -60,7 +60,7 @@ QByteArray GLSpectrumSettings::serialize() const
 {
 	SimpleSerializer s(1);
 
-	s.writeS32(1, m_fftSize);
+	s.writeU32(1, m_fftSize);
 	s.writeS32(2, m_fftOverlap);
 	s.writeS32(3, (int) m_fftWindow);
 	s.writeReal(4, m_refLevel);
@@ -102,7 +102,7 @@ bool GLSpectrumSettings::deserialize(const QByteArray& data)
 
 	if (d.getVersion() == 1)
     {
-		d.readS32(1, &m_fftSize, 1024);
+		d.readU32(1, &m_fftSize, 1024);
 		d.readS32(2, &m_fftOverlap, 0);
         d.readS32(3, &tmp, (int) FFTWindow::Hanning);
 		m_fftWindow = (FFTWindow::Function) tmp;
diff --git a/sdrbase/dsp/glspectrumsettings.h b/sdrbase/dsp/glspectrumsettings.h
index a3a734c7a..4bdfd08d4 100644
--- a/sdrbase/dsp/glspectrumsettings.h
+++ b/sdrbase/dsp/glspectrumsettings.h
@@ -36,7 +36,7 @@ public:
         AvgModeMax
     };
 
-	int m_fftSize;
+	unsigned int m_fftSize;
 	int m_fftOverlap;
 	FFTWindow::Function m_fftWindow;
 	Real m_refLevel;
diff --git a/sdrbase/dsp/samplemififo.cpp b/sdrbase/dsp/samplemififo.cpp
index 56b626505..f987fbe13 100644
--- a/sdrbase/dsp/samplemififo.cpp
+++ b/sdrbase/dsp/samplemififo.cpp
@@ -296,7 +296,7 @@ void SampleMIFifo::writeAsync(const SampleVector::const_iterator& begin, unsigne
     }
 
     QMutexLocker mutexLocker(&m_mutex);
-    int spaceLeft = m_size - m_vFill[stream];
+    unsigned int spaceLeft = m_size < m_vFill[stream] ? 0 : m_size - m_vFill[stream];
 
     if (size > m_size)
     {
@@ -376,4 +376,4 @@ void SampleMIFifo::readAsync(
     }
 
     m_vHead[stream] = m_vFill[stream];
-}
\ No newline at end of file
+}
diff --git a/sdrbase/dsp/spectrumvis.cpp b/sdrbase/dsp/spectrumvis.cpp
index 2bf95b3b4..5b7f07211 100644
--- a/sdrbase/dsp/spectrumvis.cpp
+++ b/sdrbase/dsp/spectrumvis.cpp
@@ -690,7 +690,7 @@ void SpectrumVis::applySettings(const GLSpectrumSettings& settings, bool force)
 {
     QMutexLocker mutexLocker(&m_mutex);
 
-    int fftSize = settings.m_fftSize > MAX_FFT_SIZE ?
+    unsigned int fftSize = settings.m_fftSize > MAX_FFT_SIZE ?
         MAX_FFT_SIZE :
         settings.m_fftSize < 64 ?
             64 :
diff --git a/sdrbase/maincore.cpp b/sdrbase/maincore.cpp
index fed2c4f9a..3dd9c830d 100644
--- a/sdrbase/maincore.cpp
+++ b/sdrbase/maincore.cpp
@@ -110,18 +110,18 @@ void MainCore::setLoggingOptions()
     }
 }
 
-ChannelAPI *MainCore::getChannel(int deviceSetIndex, int channelIndex)
+ChannelAPI *MainCore::getChannel(unsigned int deviceSetIndex, int channelIndex)
 {
-    if ((deviceSetIndex >= 0) && (deviceSetIndex < m_deviceSets.size())) {
+    if (deviceSetIndex < m_deviceSets.size()) {
         return m_deviceSets[deviceSetIndex]->getChannelAt(channelIndex);
     } else {
         return nullptr;
     }
 }
 
-Feature *MainCore::getFeature(int featureSetIndex, int featureIndex)
+Feature *MainCore::getFeature(unsigned int featureSetIndex, int featureIndex)
 {
-    if ((featureSetIndex >= 0) && (featureSetIndex < m_featureSets.size())) {
+    if (featureSetIndex < m_featureSets.size()) {
         return m_featureSets[featureSetIndex]->getFeatureAt(featureIndex);
     } else {
         return nullptr;
@@ -136,7 +136,7 @@ void MainCore::appendFeatureSet()
     m_featureSetsMap.insert(featureSet, newIndex);
 }
 
-void MainCore::removeFeatureSet(int index)
+void MainCore::removeFeatureSet(unsigned int index)
 {
     if (index < m_featureSets.size())
     {
diff --git a/sdrbase/maincore.h b/sdrbase/maincore.h
index 5c9011566..b9df7f113 100644
--- a/sdrbase/maincore.h
+++ b/sdrbase/maincore.h
@@ -413,13 +413,13 @@ public:
     std::vector<DeviceSet*>& getDeviceSets() { return m_deviceSets; }
     std::vector<FeatureSet*>& getFeatureeSets() { return m_featureSets; }
     void setLoggingOptions();
-    ChannelAPI *getChannel(int deviceSetIndex, int channelIndex);
-    Feature *getFeature(int featureSetIndex, int featureIndex);
+    ChannelAPI *getChannel(unsigned int deviceSetIndex, int channelIndex);
+    Feature *getFeature(unsigned int featureSetIndex, int featureIndex);
     bool existsChannel(ChannelAPI *channel) const { return m_channelsMap.contains(channel); }
     bool existsFeature(Feature *feature) const { return m_featuresMap.contains(feature); }
     // slave mode
     void appendFeatureSet();
-    void removeFeatureSet(int index);
+    void removeFeatureSet(unsigned int index);
     void removeLastFeatureSet();
     void appendDeviceSet(int deviceType);
     void removeLastDeviceSet();
diff --git a/sdrgui/gui/glspectrumgui.cpp b/sdrgui/gui/glspectrumgui.cpp
index 445966e57..107b822f4 100644
--- a/sdrgui/gui/glspectrumgui.cpp
+++ b/sdrgui/gui/glspectrumgui.cpp
@@ -134,9 +134,9 @@ void GLSpectrumGUI::displaySettings()
 
 	ui->fftWindow->setCurrentIndex(m_settings.m_fftWindow);
 
-	for (int i = 0; i < 6; i++)
+	for (unsigned int i = 0; i < 6; i++)
 	{
-		if (m_settings.m_fftSize == (1 << (i + 7)))
+		if (m_settings.m_fftSize == (1U << (i + 7)))
 		{
 			ui->fftSize->setCurrentIndex(i);
 			break;
diff --git a/sdrgui/limerfegui/limerfeusbdialog.cpp b/sdrgui/limerfegui/limerfeusbdialog.cpp
index b680e3e18..6aefec1f1 100644
--- a/sdrgui/limerfegui/limerfeusbdialog.cpp
+++ b/sdrgui/limerfegui/limerfeusbdialog.cpp
@@ -651,9 +651,9 @@ void LimeRFEUSBDialog::syncRxTx()
 
 void LimeRFEUSBDialog::stopStartRx(bool start)
 {
-    int rxDeviceSetSequence = ui->deviceSetRx->currentIndex();
+    unsigned int rxDeviceSetSequence = ui->deviceSetRx->currentIndex();
 
-    if ((rxDeviceSetSequence < 0) || (rxDeviceSetSequence >= m_sourceEngines.size())) {
+    if (rxDeviceSetSequence >= m_sourceEngines.size()) {
         return;
     }
 
@@ -677,9 +677,9 @@ void LimeRFEUSBDialog::stopStartRx(bool start)
 
 void LimeRFEUSBDialog::stopStartTx(bool start)
 {
-    int txDeviceSetSequence = ui->deviceSetTx->currentIndex();
+    unsigned int txDeviceSetSequence = ui->deviceSetTx->currentIndex();
 
-    if ((txDeviceSetSequence < 0) || (txDeviceSetSequence >= m_sinkEngines.size())) {
+    if (txDeviceSetSequence >= m_sinkEngines.size()) {
         return;
     }
 
diff --git a/sdrgui/mainwindow.cpp b/sdrgui/mainwindow.cpp
index f25833ca9..d49660f44 100644
--- a/sdrgui/mainwindow.cpp
+++ b/sdrgui/mainwindow.cpp
@@ -638,7 +638,7 @@ void MainWindow::addFeatureSet()
     ui->tabFeatures->addTab(m_featureUIs.back()->m_featureWindow, QString("F%1").arg(tabIndex));
 }
 
-void MainWindow::removeFeatureSet(int tabIndex)
+void MainWindow::removeFeatureSet(unsigned int tabIndex)
 {
     if (tabIndex < m_featureUIs.size())
     {
diff --git a/sdrgui/mainwindow.h b/sdrgui/mainwindow.h
index 0d12e3b41..654007946 100644
--- a/sdrgui/mainwindow.h
+++ b/sdrgui/mainwindow.h
@@ -138,7 +138,7 @@ private:
 	void addMIMODevice();
     void removeLastDevice();
     void addFeatureSet();
-    void removeFeatureSet(int tabIndex);
+    void removeFeatureSet(unsigned int tabIndex);
     void removeAllFeatureSets();
     void deleteChannel(int deviceSetIndex, int channelIndex);
     void sampleSourceChanged(int tabIndex, int newDeviceIndex);