From 63bea7734b444040bee8617f62aed5659236aa7a Mon Sep 17 00:00:00 2001 From: f4exb Date: Mon, 27 Dec 2021 19:04:23 +0100 Subject: [PATCH] Fixed range-loop-construct warnings in GCC 11 --- plugins/feature/map/mapgui.cpp | 2 +- .../soapysdroutput/soapysdroutput.cpp | 24 +++++++++---------- .../soapysdrinput/soapysdrinput.cpp | 24 +++++++++---------- sdrbase/util/csv.cpp | 2 +- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/plugins/feature/map/mapgui.cpp b/plugins/feature/map/mapgui.cpp index 056909715..01b8d1ef5 100644 --- a/plugins/feature/map/mapgui.cpp +++ b/plugins/feature/map/mapgui.cpp @@ -794,7 +794,7 @@ void MapGUI::setBeacons(QList *beacons) void MapGUI::addIBPBeacons() { // Add to Map - for (const auto beacon : IBPBeacon::m_beacons) + for (const auto& beacon : IBPBeacon::m_beacons) { SWGSDRangel::SWGMapItem beaconMapItem; beaconMapItem.setName(new QString(beacon.m_callsign)); diff --git a/plugins/samplesink/soapysdroutput/soapysdroutput.cpp b/plugins/samplesink/soapysdroutput/soapysdroutput.cpp index 90efa9c38..9e2267215 100644 --- a/plugins/samplesink/soapysdroutput/soapysdroutput.cpp +++ b/plugins/samplesink/soapysdroutput/soapysdroutput.cpp @@ -1546,7 +1546,7 @@ void SoapySDROutput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response.getSoapySdrOutputSettings()->setTunableElements(new QList); } - for (const auto itName : settings.m_tunableElements.keys()) + for (const auto& itName : settings.m_tunableElements.keys()) { response.getSoapySdrOutputSettings()->getTunableElements()->append(new SWGSDRangel::SWGArgValue); response.getSoapySdrOutputSettings()->getTunableElements()->back()->setKey(new QString( itName)); @@ -1564,7 +1564,7 @@ void SoapySDROutput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response.getSoapySdrOutputSettings()->setIndividualGains(new QList); } - for (const auto itName : settings.m_individualGains.keys()) + for (const auto& itName : settings.m_individualGains.keys()) { response.getSoapySdrOutputSettings()->getIndividualGains()->append(new SWGSDRangel::SWGArgValue); response.getSoapySdrOutputSettings()->getIndividualGains()->back()->setKey(new QString(itName)); @@ -1597,7 +1597,7 @@ void SoapySDROutput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response.getSoapySdrOutputSettings()->setStreamArgSettings(new QList); } - for (const auto itName : settings.m_streamArgSettings.keys()) + for (const auto& itName : settings.m_streamArgSettings.keys()) { response.getSoapySdrOutputSettings()->getStreamArgSettings()->append(new SWGSDRangel::SWGArgValue); response.getSoapySdrOutputSettings()->getStreamArgSettings()->back()->setKey(new QString(itName)); @@ -1611,7 +1611,7 @@ void SoapySDROutput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response.getSoapySdrOutputSettings()->setDeviceArgSettings(new QList); } - for (const auto itName : settings.m_deviceArgSettings.keys()) + for (const auto& itName : settings.m_deviceArgSettings.keys()) { response.getSoapySdrOutputSettings()->getDeviceArgSettings()->append(new SWGSDRangel::SWGArgValue); response.getSoapySdrOutputSettings()->getDeviceArgSettings()->back()->setKey(new QString(itName)); @@ -1637,7 +1637,7 @@ void SoapySDROutput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& resp response.getSoapySdrOutputReport()->setDeviceSettingsArgs(new QList); - for (const auto itArg : m_deviceShared.m_deviceParams->getDeviceArgs()) + for (const auto& itArg : m_deviceShared.m_deviceParams->getDeviceArgs()) { response.getSoapySdrOutputReport()->getDeviceSettingsArgs()->append(new SWGSDRangel::SWGArgInfo); webapiFormatArgInfo(itArg, response.getSoapySdrOutputReport()->getDeviceSettingsArgs()->back()); @@ -1645,7 +1645,7 @@ void SoapySDROutput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& resp response.getSoapySdrOutputReport()->setStreamSettingsArgs(new QList); - for (const auto itArg : channelSettings->m_streamSettingsArgs) + for (const auto& itArg : channelSettings->m_streamSettingsArgs) { response.getSoapySdrOutputReport()->getStreamSettingsArgs()->append(new SWGSDRangel::SWGArgInfo); webapiFormatArgInfo(itArg, response.getSoapySdrOutputReport()->getStreamSettingsArgs()->back()); @@ -1653,7 +1653,7 @@ void SoapySDROutput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& resp response.getSoapySdrOutputReport()->setFrequencySettingsArgs(new QList); - for (const auto itArg : channelSettings->m_frequencySettingsArgs) + for (const auto& itArg : channelSettings->m_frequencySettingsArgs) { response.getSoapySdrOutputReport()->getFrequencySettingsArgs()->append(new SWGSDRangel::SWGArgInfo); webapiFormatArgInfo(itArg, response.getSoapySdrOutputReport()->getFrequencySettingsArgs()->back()); @@ -1669,7 +1669,7 @@ void SoapySDROutput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& resp { response.getSoapySdrOutputReport()->setAntennas(new QList); - for (const auto itAntenna : channelSettings->m_antennas) { + for (const auto& itAntenna : channelSettings->m_antennas) { response.getSoapySdrOutputReport()->getAntennas()->append(new QString(itAntenna.c_str())); } } @@ -1685,7 +1685,7 @@ void SoapySDROutput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& resp { response.getSoapySdrOutputReport()->setGainSettings(new QList); - for (const auto itGain : channelSettings->m_gainSettings) + for (const auto& itGain : channelSettings->m_gainSettings) { response.getSoapySdrOutputReport()->getGainSettings()->append(new SWGSDRangel::SWGSoapySDRGainSetting()); response.getSoapySdrOutputReport()->getGainSettings()->back()->setRange(new SWGSDRangel::SWGRangeFloat()); @@ -1699,7 +1699,7 @@ void SoapySDROutput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& resp { response.getSoapySdrOutputReport()->setFrequencySettings(new QList); - for (const auto itFreq : channelSettings->m_frequencySettings) + for (const auto& itFreq : channelSettings->m_frequencySettings) { response.getSoapySdrOutputReport()->getFrequencySettings()->append(new SWGSDRangel::SWGSoapySDRFrequencySetting()); response.getSoapySdrOutputReport()->getFrequencySettings()->back()->setRanges(new QList); @@ -1805,13 +1805,13 @@ void SoapySDROutput::webapiFormatArgInfo(const SoapySDR::ArgInfo& arg, SWGSDRang argInfo->setValueOptions(new QList); - for (const auto itOpt : arg.options) { + for (const auto& itOpt : arg.options) { argInfo->getValueOptions()->append(new QString(itOpt.c_str())); } argInfo->setOptionNames(new QList); - for (const auto itOpt : arg.optionNames) { + for (const auto& itOpt : arg.optionNames) { argInfo->getOptionNames()->append(new QString(itOpt.c_str())); } } diff --git a/plugins/samplesource/soapysdrinput/soapysdrinput.cpp b/plugins/samplesource/soapysdrinput/soapysdrinput.cpp index a8282b445..84681b831 100644 --- a/plugins/samplesource/soapysdrinput/soapysdrinput.cpp +++ b/plugins/samplesource/soapysdrinput/soapysdrinput.cpp @@ -1638,7 +1638,7 @@ void SoapySDRInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& r response.getSoapySdrInputSettings()->setTunableElements(new QList); } - for (const auto itName : settings.m_tunableElements.keys()) + for (const auto& itName : settings.m_tunableElements.keys()) { response.getSoapySdrInputSettings()->getTunableElements()->append(new SWGSDRangel::SWGArgValue); response.getSoapySdrInputSettings()->getTunableElements()->back()->setKey(new QString(itName)); @@ -1656,7 +1656,7 @@ void SoapySDRInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& r response.getSoapySdrInputSettings()->setIndividualGains(new QList); } - for (const auto itName : settings.m_individualGains.keys()) + for (const auto& itName : settings.m_individualGains.keys()) { response.getSoapySdrInputSettings()->getIndividualGains()->append(new SWGSDRangel::SWGArgValue); response.getSoapySdrInputSettings()->getIndividualGains()->back()->setKey(new QString(itName)); @@ -1689,7 +1689,7 @@ void SoapySDRInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& r response.getSoapySdrInputSettings()->setStreamArgSettings(new QList); } - for (const auto itName : settings.m_streamArgSettings.keys()) + for (const auto& itName : settings.m_streamArgSettings.keys()) { response.getSoapySdrInputSettings()->getStreamArgSettings()->append(new SWGSDRangel::SWGArgValue); response.getSoapySdrInputSettings()->getStreamArgSettings()->back()->setKey(new QString(itName)); @@ -1703,7 +1703,7 @@ void SoapySDRInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& r response.getSoapySdrInputSettings()->setDeviceArgSettings(new QList); } - for (const auto itName : settings.m_deviceArgSettings.keys()) + for (const auto& itName : settings.m_deviceArgSettings.keys()) { response.getSoapySdrInputSettings()->getDeviceArgSettings()->append(new SWGSDRangel::SWGArgValue); response.getSoapySdrInputSettings()->getDeviceArgSettings()->back()->setKey(new QString(itName)); @@ -1729,7 +1729,7 @@ void SoapySDRInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& respo response.getSoapySdrInputReport()->setDeviceSettingsArgs(new QList); - for (const auto itArg : m_deviceShared.m_deviceParams->getDeviceArgs()) + for (const auto& itArg : m_deviceShared.m_deviceParams->getDeviceArgs()) { response.getSoapySdrInputReport()->getDeviceSettingsArgs()->append(new SWGSDRangel::SWGArgInfo()); webapiFormatArgInfo(itArg, response.getSoapySdrInputReport()->getDeviceSettingsArgs()->back()); @@ -1737,7 +1737,7 @@ void SoapySDRInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& respo response.getSoapySdrInputReport()->setStreamSettingsArgs(new QList); - for (const auto itArg : channelSettings->m_streamSettingsArgs) + for (const auto& itArg : channelSettings->m_streamSettingsArgs) { response.getSoapySdrInputReport()->getStreamSettingsArgs()->append(new SWGSDRangel::SWGArgInfo()); webapiFormatArgInfo(itArg, response.getSoapySdrInputReport()->getStreamSettingsArgs()->back()); @@ -1745,7 +1745,7 @@ void SoapySDRInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& respo response.getSoapySdrInputReport()->setFrequencySettingsArgs(new QList); - for (const auto itArg : channelSettings->m_frequencySettingsArgs) + for (const auto& itArg : channelSettings->m_frequencySettingsArgs) { response.getSoapySdrInputReport()->getFrequencySettingsArgs()->append(new SWGSDRangel::SWGArgInfo()); webapiFormatArgInfo(itArg, response.getSoapySdrInputReport()->getFrequencySettingsArgs()->back()); @@ -1761,7 +1761,7 @@ void SoapySDRInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& respo { response.getSoapySdrInputReport()->setAntennas(new QList); - for (const auto itAntenna : channelSettings->m_antennas) { + for (const auto& itAntenna : channelSettings->m_antennas) { response.getSoapySdrInputReport()->getAntennas()->append(new QString(itAntenna.c_str())); } } @@ -1777,7 +1777,7 @@ void SoapySDRInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& respo { response.getSoapySdrInputReport()->setGainSettings(new QList); - for (const auto itGain : channelSettings->m_gainSettings) + for (const auto& itGain : channelSettings->m_gainSettings) { response.getSoapySdrInputReport()->getGainSettings()->append(new SWGSDRangel::SWGSoapySDRGainSetting()); response.getSoapySdrInputReport()->getGainSettings()->back()->setRange(new SWGSDRangel::SWGRangeFloat()); @@ -1791,7 +1791,7 @@ void SoapySDRInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& respo { response.getSoapySdrInputReport()->setFrequencySettings(new QList); - for (const auto itFreq : channelSettings->m_frequencySettings) + for (const auto& itFreq : channelSettings->m_frequencySettings) { response.getSoapySdrInputReport()->getFrequencySettings()->append(new SWGSDRangel::SWGSoapySDRFrequencySetting()); response.getSoapySdrInputReport()->getFrequencySettings()->back()->setRanges(new QList); @@ -1897,13 +1897,13 @@ void SoapySDRInput::webapiFormatArgInfo(const SoapySDR::ArgInfo& arg, SWGSDRange argInfo->setValueOptions(new QList); - for (const auto itOpt : arg.options) { + for (const auto& itOpt : arg.options) { argInfo->getValueOptions()->append(new QString(itOpt.c_str())); } argInfo->setOptionNames(new QList); - for (const auto itOpt : arg.optionNames) { + for (const auto& itOpt : arg.optionNames) { argInfo->getOptionNames()->append(new QString(itOpt.c_str())); } } diff --git a/sdrbase/util/csv.cpp b/sdrbase/util/csv.cpp index d12afbd3b..715551955 100644 --- a/sdrbase/util/csv.cpp +++ b/sdrbase/util/csv.cpp @@ -150,7 +150,7 @@ QHash CSV::readHeader(QTextStream &in, QStringList requiredColumns colNumbers.insert(row[i], i); } // Check all required columns exist - for (const auto col : requiredColumns) + for (const auto& col : requiredColumns) { if (!colNumbers.contains(col)) { error = QString("Missing column %1").arg(col);