From 4ac89f7ed2fa2d1e1c9d7598ff636b4abcab06cc Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Sat, 3 Oct 2026 16:58:36 -0400 Subject: [PATCH] moddatv: Fix GCC uninitialized variable warnings Handle unsupported modulation and DVB-S code rates in getDVBSDataBitrate() and stop checkBitrates() when no valid bitrate can be calculated. Signed-off-by: Robin Getz --- plugins/channeltx/moddatv/datvmodsettings.cpp | 6 ++++++ plugins/channeltx/moddatv/datvmodsource.cpp | 3 +++ 2 files changed, 9 insertions(+) diff --git a/plugins/channeltx/moddatv/datvmodsettings.cpp b/plugins/channeltx/moddatv/datvmodsettings.cpp index eb6addab7..c42321e15 100644 --- a/plugins/channeltx/moddatv/datvmodsettings.cpp +++ b/plugins/channeltx/moddatv/datvmodsettings.cpp @@ -251,6 +251,9 @@ int DATVModSettings::getDVBSDataBitrate() const case DATVModSettings::APSK32: bitsPerSymbol = 5.0f; break; + default: + qWarning("DATVModSettings::getDVBSDataBitrate: Unsupported modulation"); + return 0; } if (m_standard == DATVModSettings::DVB_S) @@ -297,6 +300,9 @@ int DATVModSettings::getDVBSDataBitrate() const case DATVModSettings::FEC35: convFactor = 3.0f/5.0f; break; + default: + qWarning("DATVModSettings::getDVBSDataBitrate: Unsupported DVB-S code rate"); + return 0; } fecFactor = rsFactor * convFactor; plFactor = 1.0f; diff --git a/plugins/channeltx/moddatv/datvmodsource.cpp b/plugins/channeltx/moddatv/datvmodsource.cpp index 90a21b163..567800e55 100644 --- a/plugins/channeltx/moddatv/datvmodsource.cpp +++ b/plugins/channeltx/moddatv/datvmodsource.cpp @@ -214,7 +214,10 @@ void DATVModSource::checkBitrates() qDebug() << "MPEG-TS bitrate: " << m_mpegTSBitrate; qDebug() << "DVB data bitrate: " << dataBitrate; if (dataBitrate <= 0) + { qWarning() << "Unable to calculate DVB data bitrate"; + return; + } if (dataBitrate < m_mpegTSBitrate) qWarning() << "DVB data bitrate is lower than the bitrate of the MPEG transport stream"; m_tsRatio = m_mpegTSBitrate/(float)dataBitrate;