From b83d514c3ba84a65804b4176a41595addcfd324a Mon Sep 17 00:00:00 2001 From: srcejon Date: Tue, 8 Oct 2024 22:19:29 +0100 Subject: [PATCH] Lint fixes --- plugins/channelrx/remotetcpsink/remotetcpsink.cpp | 10 +++++----- plugins/channelrx/remotetcpsink/remotetcpsink.h | 2 +- .../remotetcpsink/remotetcpsinkbaseband.cpp | 6 +++--- plugins/channelrx/remotetcpsink/remotetcpsinkgui.cpp | 8 ++++---- .../samplesource/remotetcpinput/remotetcpinput.cpp | 12 ++++++------ plugins/samplesource/remotetcpinput/remotetcpinput.h | 10 +++++----- .../remotetcpinput/remotetcpinputgui.cpp | 10 +++++----- .../remotetcpinput/remotetcpinputtcphandler.h | 2 +- sdrbase/util/socket.h | 4 ++-- 9 files changed, 32 insertions(+), 32 deletions(-) diff --git a/plugins/channelrx/remotetcpsink/remotetcpsink.cpp b/plugins/channelrx/remotetcpsink/remotetcpsink.cpp index ce7f120df..7d0ff2a43 100644 --- a/plugins/channelrx/remotetcpsink/remotetcpsink.cpp +++ b/plugins/channelrx/remotetcpsink/remotetcpsink.cpp @@ -167,7 +167,7 @@ bool RemoteTCPSink::handleMessage(const Message& cmd) { if (MsgConfigureRemoteTCPSink::match(cmd)) { - MsgConfigureRemoteTCPSink& cfg = (MsgConfigureRemoteTCPSink&) cmd; + const MsgConfigureRemoteTCPSink& cfg = (const MsgConfigureRemoteTCPSink&) cmd; qDebug() << "RemoteTCPSink::handleMessage: MsgConfigureRemoteTCPSink"; applySettings(cfg.getSettings(), cfg.getSettingsKeys(), cfg.getForce(), cfg.getRestartRequired()); @@ -175,7 +175,7 @@ bool RemoteTCPSink::handleMessage(const Message& cmd) } else if (DSPSignalNotification::match(cmd)) { - DSPSignalNotification& notif = (DSPSignalNotification&) cmd; + const DSPSignalNotification& notif = (const DSPSignalNotification&) cmd; m_basebandSampleRate = notif.getSampleRate(); qDebug() << "RemoteTCPSink::handleMessage: DSPSignalNotification: m_basebandSampleRate:" << m_basebandSampleRate; @@ -191,7 +191,7 @@ bool RemoteTCPSink::handleMessage(const Message& cmd) } else if (MsgSendMessage::match(cmd)) { - MsgSendMessage& msg = (MsgSendMessage&) cmd; + const MsgSendMessage& msg = (const MsgSendMessage&) cmd; // Forward to the sink m_basebandSink->getInputMessageQueue()->push(MsgSendMessage::create(msg.getAddress(), msg.getPort(), msg.getCallsign(), msg.getText(), msg.getBroadcast())); @@ -199,14 +199,14 @@ bool RemoteTCPSink::handleMessage(const Message& cmd) } else if (MsgReportConnection::match(cmd)) { - MsgReportConnection& msg = (MsgReportConnection&) cmd; + const MsgReportConnection& msg = (const MsgReportConnection&) cmd; m_clients = msg.getClients(); updatePublicListing(); return true; } else if (MsgReportDisconnect::match(cmd)) { - MsgReportDisconnect& msg = (MsgReportDisconnect&) cmd; + const MsgReportDisconnect& msg = (const MsgReportDisconnect&) cmd; m_clients = msg.getClients(); updatePublicListing(); return true; diff --git a/plugins/channelrx/remotetcpsink/remotetcpsink.h b/plugins/channelrx/remotetcpsink/remotetcpsink.h index b9f491ce7..bc030e08c 100644 --- a/plugins/channelrx/remotetcpsink/remotetcpsink.h +++ b/plugins/channelrx/remotetcpsink/remotetcpsink.h @@ -198,7 +198,7 @@ public: private: QString m_error; - MsgError(const QString& error) : + explicit MsgError(const QString& error) : Message(), m_error(error) { } diff --git a/plugins/channelrx/remotetcpsink/remotetcpsinkbaseband.cpp b/plugins/channelrx/remotetcpsink/remotetcpsinkbaseband.cpp index 95373af9b..6fc3d26a4 100644 --- a/plugins/channelrx/remotetcpsink/remotetcpsinkbaseband.cpp +++ b/plugins/channelrx/remotetcpsink/remotetcpsinkbaseband.cpp @@ -125,7 +125,7 @@ bool RemoteTCPSinkBaseband::handleMessage(const Message& cmd) if (RemoteTCPSink::MsgConfigureRemoteTCPSink::match(cmd)) { QMutexLocker mutexLocker(&m_mutex); - RemoteTCPSink::MsgConfigureRemoteTCPSink& cfg = (RemoteTCPSink::MsgConfigureRemoteTCPSink&) cmd; + const RemoteTCPSink::MsgConfigureRemoteTCPSink& cfg = (const RemoteTCPSink::MsgConfigureRemoteTCPSink&) cmd; qDebug() << "RemoteTCPSinkBaseband::handleMessage: MsgConfigureRemoteTCPSink"; applySettings(cfg.getSettings(), cfg.getSettingsKeys(), cfg.getForce(), cfg.getRestartRequired()); @@ -134,7 +134,7 @@ bool RemoteTCPSinkBaseband::handleMessage(const Message& cmd) } else if (DSPSignalNotification::match(cmd)) { - DSPSignalNotification& notif = (DSPSignalNotification&) cmd; + const DSPSignalNotification& notif = (const DSPSignalNotification&) cmd; qDebug() << "RemoteTCPSinkBaseband::handleMessage: DSPSignalNotification: basebandSampleRate:" << notif.getSampleRate(); setBasebandSampleRate(notif.getSampleRate()); m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(notif.getSampleRate())); @@ -143,7 +143,7 @@ bool RemoteTCPSinkBaseband::handleMessage(const Message& cmd) } else if (RemoteTCPSink::MsgSendMessage::match(cmd)) { - RemoteTCPSink::MsgSendMessage& msg = (RemoteTCPSink::MsgSendMessage&) cmd; + const RemoteTCPSink::MsgSendMessage& msg = (const RemoteTCPSink::MsgSendMessage&) cmd; m_sink.sendMessage(msg.getAddress(), msg.getPort(), msg.getCallsign(), msg.getText(), msg.getBroadcast()); diff --git a/plugins/channelrx/remotetcpsink/remotetcpsinkgui.cpp b/plugins/channelrx/remotetcpsink/remotetcpsinkgui.cpp index c06274098..863fe575f 100644 --- a/plugins/channelrx/remotetcpsink/remotetcpsinkgui.cpp +++ b/plugins/channelrx/remotetcpsink/remotetcpsinkgui.cpp @@ -175,7 +175,7 @@ bool RemoteTCPSinkGUI::handleMessage(const Message& message) { if (RemoteTCPSink::MsgConfigureRemoteTCPSink::match(message)) { - const RemoteTCPSink::MsgConfigureRemoteTCPSink& cfg = (RemoteTCPSink::MsgConfigureRemoteTCPSink&) message; + const RemoteTCPSink::MsgConfigureRemoteTCPSink& cfg = (const RemoteTCPSink::MsgConfigureRemoteTCPSink&) message; if ((cfg.getSettings().m_channelSampleRate != m_settings.m_channelSampleRate) || (cfg.getSettings().m_sampleBits != m_settings.m_sampleBits)) { @@ -195,7 +195,7 @@ bool RemoteTCPSinkGUI::handleMessage(const Message& message) } else if (RemoteTCPSink::MsgReportConnection::match(message)) { - const RemoteTCPSink::MsgReportConnection& report = (RemoteTCPSink::MsgReportConnection&) message; + const RemoteTCPSink::MsgReportConnection& report = (const RemoteTCPSink::MsgReportConnection&) message; ui->clients->setText(QString("%1/%2").arg(report.getClients()).arg(m_settings.m_maxClients)); QString ip = QString("%1:%2").arg(report.getAddress().toString()).arg(report.getPort()); @@ -208,7 +208,7 @@ bool RemoteTCPSinkGUI::handleMessage(const Message& message) } else if (RemoteTCPSink::MsgReportDisconnect::match(message)) { - const RemoteTCPSink::MsgReportDisconnect& report = (RemoteTCPSink::MsgReportDisconnect&) message; + const RemoteTCPSink::MsgReportDisconnect& report = (const RemoteTCPSink::MsgReportDisconnect&) message; ui->clients->setText(QString("%1/%2").arg(report.getClients()).arg(m_settings.m_maxClients)); QString ip = QString("%1:%2").arg(report.getAddress().toString()).arg(report.getPort()); @@ -222,7 +222,7 @@ bool RemoteTCPSinkGUI::handleMessage(const Message& message) } else if (RemoteTCPSink::MsgReportBW::match(message)) { - const RemoteTCPSink::MsgReportBW& report = (RemoteTCPSink::MsgReportBW&) message; + const RemoteTCPSink::MsgReportBW& report = (const RemoteTCPSink::MsgReportBW&) message; m_bwAvg(report.getBW()); m_networkBWAvg(report.getNetworkBW()); diff --git a/plugins/samplesource/remotetcpinput/remotetcpinput.cpp b/plugins/samplesource/remotetcpinput/remotetcpinput.cpp index ce54ddeb4..ae27a4cf5 100644 --- a/plugins/samplesource/remotetcpinput/remotetcpinput.cpp +++ b/plugins/samplesource/remotetcpinput/remotetcpinput.cpp @@ -220,14 +220,14 @@ bool RemoteTCPInput::handleMessage(const Message& message) else if (MsgConfigureRemoteTCPInput::match(message)) { qDebug() << "RemoteTCPInput::handleMessage:" << message.getIdentifier(); - MsgConfigureRemoteTCPInput& conf = (MsgConfigureRemoteTCPInput&) message; + const MsgConfigureRemoteTCPInput& conf = (const MsgConfigureRemoteTCPInput&) message; applySettings(conf.getSettings(), conf.getSettingsKeys(), conf.getForce()); return true; } else if (RemoteTCPInputTCPHandler::MsgReportConnection::match(message)) { qDebug() << "RemoteTCPInput::handleMessage:" << message.getIdentifier(); - RemoteTCPInputTCPHandler::MsgReportConnection& report = (RemoteTCPInputTCPHandler::MsgReportConnection&) message; + const RemoteTCPInputTCPHandler::MsgReportConnection& report = (const RemoteTCPInputTCPHandler::MsgReportConnection&) message; if (report.getConnected()) { qDebug() << "Disconnected - stopping DSP"; @@ -237,19 +237,19 @@ bool RemoteTCPInput::handleMessage(const Message& message) } else if (MsgSaveReplay::match(message)) { - MsgSaveReplay& cmd = (MsgSaveReplay&) message; + const MsgSaveReplay& cmd = (const MsgSaveReplay&) message; m_replayBuffer.save(cmd.getFilename(), m_settings.m_devSampleRate, getCenterFrequency()); return true; } else if (MsgSendMessage::match(message)) { - MsgSendMessage& msg = (MsgSendMessage&) message; + const MsgSendMessage& msg = (const MsgSendMessage&) message; m_remoteInputTCPPHandler->getInputMessageQueue()->push(MsgSendMessage::create(msg.getCallsign(), msg.getText(), msg.getBroadcast())); return true; } else if (MsgReportPosition::match(message)) { - MsgReportPosition& report = (MsgReportPosition&) message; + const MsgReportPosition& report = (const MsgReportPosition&) message; m_latitude = report.getLatitude(); m_longitude = report.getLongitude(); @@ -261,7 +261,7 @@ bool RemoteTCPInput::handleMessage(const Message& message) } else if (MsgReportDirection::match(message)) { - MsgReportDirection& report = (MsgReportDirection&) message; + const MsgReportDirection& report = (const MsgReportDirection&) message; m_isotropic = report.getIsotropic(); m_azimuth = report.getAzimuth(); diff --git a/plugins/samplesource/remotetcpinput/remotetcpinput.h b/plugins/samplesource/remotetcpinput/remotetcpinput.h index 449109a31..a2c3831cc 100644 --- a/plugins/samplesource/remotetcpinput/remotetcpinput.h +++ b/plugins/samplesource/remotetcpinput/remotetcpinput.h @@ -79,10 +79,10 @@ public: return new MsgStartStop(startStop); } - protected: + private: bool m_startStop; - MsgStartStop(bool startStop) : + explicit MsgStartStop(bool startStop) : Message(), m_startStop(startStop) { } @@ -105,7 +105,7 @@ public: outBytesAvailable, outSize, outSeconds); } - protected: + private: qint64 m_inBytesAvailable; qint64 m_inSize; float m_inSeconds; @@ -135,7 +135,7 @@ public: return new MsgSaveReplay(filename); } - protected: + private: QString m_filename; MsgSaveReplay(const QString& filename) : @@ -156,7 +156,7 @@ public: return new MsgSendMessage(callsign, text, broadcast); } - protected: + private: QString m_callsign; QString m_text; bool m_broadcast; diff --git a/plugins/samplesource/remotetcpinput/remotetcpinputgui.cpp b/plugins/samplesource/remotetcpinput/remotetcpinputgui.cpp index ea52cbf89..7270b4c03 100644 --- a/plugins/samplesource/remotetcpinput/remotetcpinputgui.cpp +++ b/plugins/samplesource/remotetcpinput/remotetcpinputgui.cpp @@ -151,7 +151,7 @@ bool RemoteTCPInputGui::handleMessage(const Message& message) { if (RemoteTCPInput::MsgConfigureRemoteTCPInput::match(message)) { - const RemoteTCPInput::MsgConfigureRemoteTCPInput& cfg = (RemoteTCPInput::MsgConfigureRemoteTCPInput&) message; + const RemoteTCPInput::MsgConfigureRemoteTCPInput& cfg = (const RemoteTCPInput::MsgConfigureRemoteTCPInput&) message; if (cfg.getForce()) { m_settings = cfg.getSettings(); @@ -166,7 +166,7 @@ bool RemoteTCPInputGui::handleMessage(const Message& message) } else if (RemoteTCPInput::MsgStartStop::match(message)) { - RemoteTCPInput::MsgStartStop& notif = (RemoteTCPInput::MsgStartStop&) message; + const RemoteTCPInput::MsgStartStop& notif = (const RemoteTCPInput::MsgStartStop&) message; m_connectionError = false; blockApplySettings(true); ui->startStop->setChecked(notif.getStartStop()); @@ -175,7 +175,7 @@ bool RemoteTCPInputGui::handleMessage(const Message& message) } else if (RemoteTCPInput::MsgReportTCPBuffer::match(message)) { - const RemoteTCPInput::MsgReportTCPBuffer& report = (RemoteTCPInput::MsgReportTCPBuffer&) message; + const RemoteTCPInput::MsgReportTCPBuffer& report = (const RemoteTCPInput::MsgReportTCPBuffer&) message; ui->inGauge->setMaximum((int)report.getInSize()); ui->inGauge->setValue((int)report.getInBytesAvailable()); ui->inBufferLenSecsText->setText(QString("%1s").arg(report.getInSeconds(), 0, 'f', 2)); @@ -186,7 +186,7 @@ bool RemoteTCPInputGui::handleMessage(const Message& message) } else if (RemoteTCPInputTCPHandler::MsgReportRemoteDevice::match(message)) { - const RemoteTCPInputTCPHandler::MsgReportRemoteDevice& report = (RemoteTCPInputTCPHandler::MsgReportRemoteDevice&) message; + const RemoteTCPInputTCPHandler::MsgReportRemoteDevice& report = (const RemoteTCPInputTCPHandler::MsgReportRemoteDevice&) message; QHash devices = { {RemoteTCPProtocol::RTLSDR_E4000, "RTLSDR E4000"}, {RemoteTCPProtocol::RTLSDR_FC0012, "RTLSDR FC0012"}, @@ -301,7 +301,7 @@ bool RemoteTCPInputGui::handleMessage(const Message& message) } else if (RemoteTCPInputTCPHandler::MsgReportConnection::match(message)) { - const RemoteTCPInputTCPHandler::MsgReportConnection& report = (RemoteTCPInputTCPHandler::MsgReportConnection&) message; + const RemoteTCPInputTCPHandler::MsgReportConnection& report = (const RemoteTCPInputTCPHandler::MsgReportConnection&) message; qDebug() << "RemoteTCPInputGui::handleMessage: MsgReportConnection connected: " << report.getConnected(); m_connectionError = !report.getConnected(); updateStatus(); diff --git a/plugins/samplesource/remotetcpinput/remotetcpinputtcphandler.h b/plugins/samplesource/remotetcpinput/remotetcpinputtcphandler.h index 192873f43..082c2a190 100644 --- a/plugins/samplesource/remotetcpinput/remotetcpinputtcphandler.h +++ b/plugins/samplesource/remotetcpinput/remotetcpinputtcphandler.h @@ -45,7 +45,7 @@ class DeviceAPI; class FIFO { public: - FIFO(qsizetype elements = 10); + explicit FIFO(qsizetype elements = 10); qsizetype write(quint8 *data, qsizetype elements); qsizetype read(quint8 *data, qsizetype elements); diff --git a/sdrbase/util/socket.h b/sdrbase/util/socket.h index 4e15b6d8b..28adb865d 100644 --- a/sdrbase/util/socket.h +++ b/sdrbase/util/socket.h @@ -54,7 +54,7 @@ class SDRBASE_API TCPSocket : public Socket { public: - TCPSocket(QTcpSocket *socket) ; + explicit TCPSocket(QTcpSocket *socket) ; qint64 write(const char *data, qint64 length) override; void flush() override; qint64 read(char *data, qint64 length) override; @@ -72,7 +72,7 @@ class SDRBASE_API WebSocket : public Socket { public: - WebSocket(QWebSocket *socket); + explicit WebSocket(QWebSocket *socket); qint64 write(const char *data, qint64 length) override; void flush() override; qint64 read(char *data, qint64 length) override;