Skip to content

Commit

Permalink
Pcap Clang-Tidy and Clazy checks fixes
Browse files Browse the repository at this point in the history
Clean up based on Clang-Tidy and Clazy checks
  • Loading branch information
marcusbirkin committed May 25, 2024
1 parent d9310c7 commit e320cd0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
10 changes: 6 additions & 4 deletions src/pcap/pcapplayback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,11 @@ void PcapPlayback::openThread()
connect(sender, &pcapplaybacksender::sendingFinished, this, &PcapPlayback::playbackFinished);
connect(sender, &pcapplaybacksender::sendingClosed, this, &PcapPlayback::playbackClosed);
connect(sender, &pcapplaybacksender::error, this, &PcapPlayback::error);
connect(sender, &QThread::finished, [this]() {
connect(sender, &QThread::finished, this, [this]()
{
sender->deleteLater();
sender = Q_NULLPTR; });
sender = Q_NULLPTR;
});
connect(sender, &pcapplaybacksender::finished, this, &PcapPlayback::playbackThreadClosed);
ui->progressBar->reset();
sender->start();
Expand Down Expand Up @@ -134,7 +136,7 @@ void PcapPlayback::on_btnOpen_clicked()
char errbuf[PCAP_ERRBUF_SIZE];
pcap_t *m_pcap_in = pcap_open_offline(fileName.toUtf8(), errbuf);
if (!m_pcap_in) {
error(tr("Error opening %1\n%2").arg(QDir::toNativeSeparators(fileName)).arg(errbuf));
error(tr("Error opening %1\n%2").arg(QDir::toNativeSeparators(fileName), errbuf));
return;
} else {
ui->lblFilename->setText(QDir::toNativeSeparators(fileName));
Expand Down Expand Up @@ -191,7 +193,7 @@ void PcapPlayback::on_btnOpen_clicked()
{
QTime elasped(0,0,0);
ui->lblFileTime->setText(QString("%1").arg(
elasped.addMSecs(pkt_start_time.msecsTo(pkt_end_time)).toString("hh:mm:ss.zzz")));
elasped.addMSecs(pkt_start_time.msecsTo(pkt_end_time)).toString("hh:mm:ss.zzz")));
}
updateUIBtns();

Expand Down
6 changes: 3 additions & 3 deletions src/pcap/pcapplaybacksender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void pcapplaybacksender::run()
m_pcap_out = pcap_open_live(dev->name, 0, 1, 0, errbuf);
if (!m_pcap_out)
{
emit error(tr("%1\n%2").arg(errbuf).arg(iface.humanReadableName()));
emit error(tr("%1\n%2").arg(errbuf, iface.humanReadableName()));
return;
}
}
Expand All @@ -107,7 +107,7 @@ void pcapplaybacksender::run()

// Did we get an interface?
if (!m_pcap_out) {
error(tr("Unable to open required interface\n%1").arg(iface.humanReadableName()));
emit error(tr("Unable to open required interface\n%1").arg(iface.humanReadableName()));
return;
}
}
Expand Down Expand Up @@ -211,7 +211,7 @@ bool pcapplaybacksender::openFile()
char errbuf[PCAP_ERRBUF_SIZE];
m_pcap_in = pcap_open_offline(m_filename.toUtf8(), errbuf);
if (!m_pcap_in) {
emit error(tr("Error opening %1\n%2").arg(QDir::toNativeSeparators(m_filename)).arg(errbuf));
emit error(tr("Error opening %1\n%2").arg(QDir::toNativeSeparators(m_filename), errbuf));
return false;
}

Expand Down

0 comments on commit e320cd0

Please sign in to comment.