Skip to content

Commit

Permalink
Don't store invalid user codes.
Browse files Browse the repository at this point in the history
  • Loading branch information
atsampson authored and Simon Inns committed Jan 2, 2020
1 parent 8a245f2 commit d003ce1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
4 changes: 0 additions & 4 deletions tools/library/tbc/testvbidecoder/testvbidecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ void testDecode()
// the standard says shouldn't work (e.g. invalid BCD digits), and for
// things that discs do anyway regardless of what the standard says :-)

// FIXME - #if 0 blocks are tests that should pass but don't

cerr << "Testing VbiDecoder::decode\n";
cerr << "IEC 60857-1986 - 10.1.1 Lead-in\n";

Expand Down Expand Up @@ -283,10 +281,8 @@ void testDecode()
{
Vbi expected;

#if 0
// Ignore X1 not in range 0-7
assertSame(decoder.decode(0x88DAFE, 0, 0), expected);
#endif
}

cerr << "IEC 60857-1986 - 10.1.10 CLV picture number\n";
Expand Down
12 changes: 7 additions & 5 deletions tools/library/tbc/vbidecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -549,11 +549,13 @@ VbiDecoder::Vbi VbiDecoder::decode(qint32 vbi16, qint32 vbi17, qint32 vbi18)
quint32 x3x4x5 = (usersCode & 0x000FFF);

// x1 should be 0x00-0x07, x3-x5 are 0x00-0x0F
if (x1 > 7) if (verboseDebug) qDebug() << "VbiDecoder::decode(): VBI invalid user code, X1 is > 7";

// Add the two results together to get the user code
vbi.userCode = QString::number(x1, 16).toUpper() + QString::number(x3x4x5, 16).toUpper();
if (verboseDebug) qDebug() << "VbiDecoder::decode(): VBI user code is" << vbi.userCode;
if (x1 > 7) {
if (verboseDebug) qDebug() << "VbiDecoder::decode(): VBI invalid user code, X1 is > 7";
} else {
// Add the two results together to get the user code
vbi.userCode = QString::number(x1, 16).toUpper() + QString::number(x3x4x5, 16).toUpper();
if (verboseDebug) qDebug() << "VbiDecoder::decode(): VBI user code is" << vbi.userCode;
}
}

// IEC 60857-1986 - 10.1.10 CLV picture number --------------------------------------------------------------------
Expand Down

0 comments on commit d003ce1

Please sign in to comment.