From 628523525777b80dd4c9921a70b1341d1f41e18a Mon Sep 17 00:00:00 2001 From: f4exb Date: Sat, 14 Nov 2020 19:18:41 +0100 Subject: [PATCH] Fixed -Wtype-limits warnings --- .../beamsteeringcwmod/beamsteeringcwmodsettings.cpp | 2 +- plugins/channelrx/demodchirpchat/chirpchatdemod.cpp | 2 +- plugins/channelrx/demodnfm/nfmdemodsink.cpp | 6 ------ plugins/channeltx/modfreedv/freedvmodsource.cpp | 6 ------ plugins/samplemimo/testmosync/testmosyncworker.cpp | 2 +- sdrbase/limerfe/limerfecontroller.cpp | 2 +- 6 files changed, 4 insertions(+), 16 deletions(-) diff --git a/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmodsettings.cpp b/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmodsettings.cpp index 6b20efe1d..07b4b0690 100644 --- a/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmodsettings.cpp +++ b/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmodsettings.cpp @@ -100,7 +100,7 @@ bool BeamSteeringCWModSettings::deserialize(const QByteArray& data) m_log2Interp = tmp > 6 ? 6 : tmp; d.readU32(13, &m_filterChainHash, 0); d.readS32(14, &stmp, 0); - m_channelOutput = tmp < 0 ? 0 : tmp > 2 ? 2 : tmp; + m_channelOutput = stmp < 0 ? 0 : stmp > 2 ? 2 : stmp; return true; } diff --git a/plugins/channelrx/demodchirpchat/chirpchatdemod.cpp b/plugins/channelrx/demodchirpchat/chirpchatdemod.cpp index da26bc1c7..d859753b7 100644 --- a/plugins/channelrx/demodchirpchat/chirpchatdemod.cpp +++ b/plugins/channelrx/demodchirpchat/chirpchatdemod.cpp @@ -517,7 +517,7 @@ void ChirpChatDemod::webapiUpdateChannelSettings( if (channelSettingsKeys.contains("udpPort")) { uint16_t port = response.getChirpChatDemodSettings()->getUdpPort(); - settings.m_udpPort = port < 1024 ? 1024 : port > 65535 ? 65535 : port; + settings.m_udpPort = port < 1024 ? 1024 : port; } if (channelSettingsKeys.contains("rgbColor")) { settings.m_rgbColor = response.getChirpChatDemodSettings()->getRgbColor(); diff --git a/plugins/channelrx/demodnfm/nfmdemodsink.cpp b/plugins/channelrx/demodnfm/nfmdemodsink.cpp index fa7821377..6b9ff3423 100644 --- a/plugins/channelrx/demodnfm/nfmdemodsink.cpp +++ b/plugins/channelrx/demodnfm/nfmdemodsink.cpp @@ -320,12 +320,6 @@ void NFMDemodSink::applySettings(const NFMDemodSettings& settings, bool force) void NFMDemodSink::applyAudioSampleRate(unsigned int sampleRate) { - if (sampleRate < 0) - { - qWarning("NFMDemodSink::applyAudioSampleRate: invalid sample rate: %d", sampleRate); - return; - } - qDebug("NFMDemodSink::applyAudioSampleRate: %u m_channelSampleRate: %d", sampleRate, m_channelSampleRate); m_filterTaps = (sampleRate / 48) | 1; diff --git a/plugins/channeltx/modfreedv/freedvmodsource.cpp b/plugins/channeltx/modfreedv/freedvmodsource.cpp index c15b845d2..27a71fa52 100644 --- a/plugins/channeltx/modfreedv/freedvmodsource.cpp +++ b/plugins/channeltx/modfreedv/freedvmodsource.cpp @@ -364,12 +364,6 @@ void FreeDVModSource::calculateLevel(qint16& sample) void FreeDVModSource::applyAudioSampleRate(unsigned int sampleRate) { - if (sampleRate < 0) - { - qWarning("FreeDVModSource::applyAudioSampleRate: invalid sample rate %d", sampleRate); - return; - } - qDebug("FreeDVModSource::applyAudioSampleRate: %d", sampleRate); // TODO: put up simple IIR interpolator when sampleRate < m_modemSampleRate diff --git a/plugins/samplemimo/testmosync/testmosyncworker.cpp b/plugins/samplemimo/testmosync/testmosyncworker.cpp index 2065d1794..f987d7a9e 100644 --- a/plugins/samplemimo/testmosync/testmosyncworker.cpp +++ b/plugins/samplemimo/testmosync/testmosyncworker.cpp @@ -104,7 +104,7 @@ void TestMOSyncWorker::setSamplerate(int samplerate) void TestMOSyncWorker::setLog2Interpolation(unsigned int log2Interpolation) { - if ((log2Interpolation < 0) || (log2Interpolation > 6)) { + if (log2Interpolation > 6) { return; } diff --git a/sdrbase/limerfe/limerfecontroller.cpp b/sdrbase/limerfe/limerfecontroller.cpp index 57e653377..35a718cea 100644 --- a/sdrbase/limerfe/limerfecontroller.cpp +++ b/sdrbase/limerfe/limerfecontroller.cpp @@ -349,7 +349,7 @@ void LimeRFEController::settingsToState(const LimeRFESettings& settings) } } - m_rfeBoardState.attValue = settings.m_attenuationFactor < 0 ? 0 : settings.m_attenuationFactor > 7 ? 7 : settings.m_attenuationFactor; + m_rfeBoardState.attValue = settings.m_attenuationFactor > 7 ? 7 : settings.m_attenuationFactor; m_rfeBoardState.notchOnOff = settings.m_amfmNotch; m_rfeBoardState.enableSWR = settings.m_swrEnable ? RFE_SWR_ENABLE : RFE_SWR_DISABLE;