Browse Source

kiwisdrlist : Initialize parsed SDR state and report unknown fields

Initialize KiwiSDR parsing state and log previously unhandled keys once per
process. This gives newly parsed records defined member values while making
unexpected fields in the KiwiSDR data visible without repeatedly flooding
the debug log.

Found by cppcheck (uninitMemberVar) and Coverity

Signed-off-by: Robin Getz <rgetz503@gmail.com>
chirpmodem-v8.0.0
Robin Getz 2 months ago
parent
commit
bd60409c75
No known key found for this signature in database
GPG Key ID: 51C7231FFED0E060
  1. 9
      sdrbase/util/kiwisdrlist.cpp

9
sdrbase/util/kiwisdrlist.cpp

@ -24,6 +24,7 @@ @@ -24,6 +24,7 @@
#include <QXmlStreamReader>
#include <QNetworkDiskCache>
#include <QRegularExpression>
#include <QSet>
#include "util/corsproxy.h"
@ -100,6 +101,7 @@ void KiwiSDRList::handleReply(QNetworkReply* reply) @@ -100,6 +101,7 @@ void KiwiSDRList::handleReply(QNetworkReply* reply)
void KiwiSDRList::handleHTML(const QString& url, const QByteArray& bytes)
{
static QSet<QString> unhandledKeys{};
(void) url;
QList<KiwiSDR> sdrs;
@ -123,7 +125,7 @@ void KiwiSDRList::handleHTML(const QString& url, const QByteArray& bytes) @@ -123,7 +125,7 @@ void KiwiSDRList::handleHTML(const QString& url, const QByteArray& bytes)
if (urlMatch.hasMatch())
{
KiwiSDR sdr;
KiwiSDR sdr{};
sdr.m_url = urlMatch.captured(1);
@ -193,6 +195,11 @@ void KiwiSDRList::handleHTML(const QString& url, const QByteArray& bytes) @@ -193,6 +195,11 @@ void KiwiSDRList::handleHTML(const QString& url, const QByteArray& bytes)
{
sdr.m_snr = value;
}
else if (!unhandledKeys.contains(key))
{
qDebug() << "KiwiSDRList::handleHTML: Unhandled key:" << key << "value:" << value;
unhandledKeys.insert(key);
}
}
sdrs.append(sdr);

Loading…
Cancel
Save