Fixed issue with false decodes causing app crash

This commit is contained in:
Jordan Sherer 2018-11-03 01:14:31 -04:00
parent cd683f9bf7
commit c9016d7378
3 changed files with 20 additions and 14 deletions

View File

@ -61,6 +61,11 @@ DecodedText::DecodedText (QString const& the_string, bool contest_mode, QString
bits_ = bits(); bits_ = bits();
// don't even try to unpack -24dB frames...they are *very* likely to be false decodes...
if(snr() <= -24){
return;
}
tryUnpack(); tryUnpack();
} }

18
jsc.cpp
View File

@ -107,17 +107,23 @@ QString JSC::decompress(Codeword const& bitvec){
QList<quint64> bytes; QList<quint64> bytes;
QList<int> separators; QList<int> separators;
auto iter = bitvec.begin();
while(iter != bitvec.end()){ int i = 0;
quint64 byte = Varicode::bitsToInt(iter, 4); int count = bitvec.count();
iter += 4; while(i < count){
auto b = bitvec.mid(i, 4);
if(b.length() != 4){
break;
}
quint64 byte = Varicode::bitsToInt(b);
bytes.append(byte); bytes.append(byte);
i += 4;
if(byte < s){ if(byte < s){
if(*iter){ if(count - i > 0 && bitvec.at(i)){
separators.append(bytes.length()-1); separators.append(bytes.length()-1);
} }
iter += 1; i += 1;
} }
} }

View File

@ -1445,6 +1445,9 @@ void MainWindow::initializeDummyData(){
return; return;
} }
// auto d = DecodedText("h+vWp6mRPprH", 6);
// qDebug() << d.message() << buildMessageFrames(d.message());
// qDebug() << Varicode::isValidCallsign("@GROUP1", nullptr); // qDebug() << Varicode::isValidCallsign("@GROUP1", nullptr);
// qDebug() << Varicode::packAlphaNumeric50("VE7/KN4CRD"); // qDebug() << Varicode::packAlphaNumeric50("VE7/KN4CRD");
// qDebug() << Varicode::unpackAlphaNumeric50(Varicode::packAlphaNumeric50("VE7/KN4CRD")); // qDebug() << Varicode::unpackAlphaNumeric50(Varicode::packAlphaNumeric50("VE7/KN4CRD"));
@ -3550,14 +3553,6 @@ void MainWindow::readFromStdout() //readFromStdout
, tr ("Cannot open \"%1\" for append: %2") , tr ("Cannot open \"%1\" for append: %2")
.arg (f.fileName ()).arg (f.errorString ())); .arg (f.fileName ()).arg (f.errorString ()));
} }
if (m_config.insert_blank () && m_blankLine && !m_config.bFox()) {
QString band;
if((DriftingDateTime::currentMSecsSinceEpoch() / 1000 - m_secBandChanged) > 4*m_TRperiod/4) {
band = ' ' + m_config.bands ()->find (m_freqNominal);
}
ui->decodedTextBrowser->insertLineSpacer (band.rightJustified (40, '-'));
m_blankLine = false;
}
DecodedText decodedtext {QString::fromUtf8 (t.constData ()).remove (QRegularExpression {"\r|\n"}), "FT8" == m_mode && DecodedText decodedtext {QString::fromUtf8 (t.constData ()).remove (QRegularExpression {"\r|\n"}), "FT8" == m_mode &&
ui->cbVHFcontest->isChecked(), m_config.my_grid ()}; ui->cbVHFcontest->isChecked(), m_config.my_grid ()};