Simplify the LSF processing to allow changed META field data changed

through.
This commit is contained in:
Jonathan Naylor
2021-08-26 21:49:46 +01:00
parent ef6ce0ef88
commit d1dc6bb7a0
7 changed files with 148 additions and 114 deletions

View File

@@ -24,6 +24,15 @@
#include <cassert>
#include <cstring>
CM17LSF::CM17LSF(const CM17LSF& lsf) :
m_lsf(NULL),
m_valid(lsf.m_valid)
{
m_lsf = new unsigned char[M17_LSF_LENGTH_BYTES];
::memcpy(m_lsf, lsf.m_lsf, M17_LSF_LENGTH_BYTES);
}
CM17LSF::CM17LSF() :
m_lsf(NULL),
m_valid(false)
@@ -197,3 +206,13 @@ void CM17LSF::setFragment(const unsigned char* data, unsigned int n)
m_valid = CM17CRC::checkCRC16(m_lsf, M17_LSF_LENGTH_BYTES);
}
CM17LSF& CM17LSF::operator=(const CM17LSF& lsf)
{
if (&lsf != this) {
::memcpy(m_lsf, lsf.m_lsf, M17_LSF_LENGTH_BYTES);
m_valid = lsf.m_valid;
}
return *this;
}