Ticket #4938: redundant_length_check.patch

File redundant_length_check.patch, 1.4 KB (added by David Matthews <dm@…>, 12 years ago)

Remove redundant check

  • libs/libmythtv/mhi.cpp

     
    2828    int    m_y;
    2929};
    3030
    31 // Special values for the NetworkBootInfo version.  Real values are a byte.
     31// Special value for the NetworkBootInfo version.  Real values are a byte.
    3232#define NBI_VERSION_UNSET       257
    33 #define NBI_VERSION_ABSENT      256
    3433
    3534MHIContext::MHIContext(InteractiveTV *parent)
    3635    : m_parent(parent),     m_dsmcc(NULL),
     
    280279// A NetworkBootInfo sub-descriptor is present in the PMT.
    281280void MHIContext::SetNetBootInfo(const unsigned char *data, uint length)
    282281{
    283     if (length < 2) return; // Temporary hack? -- dtk May 5th, 2008.
     282    if (length < 2) // A valid descriptor should always have at least 2 bytes.
     283        return;
    284284    QMutexLocker locker(&m_dsmccLock);
    285285    // Save the data from the descriptor.
    286286    m_nbiData.resize(0);
     
    288288    m_nbiData.insert(m_nbiData.begin(), data, data+length);
    289289    // If there is no Network Boot Info or we're setting it
    290290    // for the first time just update the "last version".
    291     if (length < 2)
    292         m_lastNbiVersion = NBI_VERSION_ABSENT;
    293     else if (m_lastNbiVersion == NBI_VERSION_UNSET)
     291    if (m_lastNbiVersion == NBI_VERSION_UNSET)
    294292        m_lastNbiVersion = data[0];
    295293    else
    296294        m_engine_wait.wakeAll();