bool CECTag::WriteChildren(CECSocket& socket) const { uint16 tmp = (uint16)m_tagList.size(); if (!socket.WriteNumber(&tmp, sizeof(tmp))) return false; for (const_iterator it = begin(); it != end(); ++it) { if (!it->WriteTag(socket)) return false; } return true; }
bool CECTag::WriteTag(CECSocket& socket) const { ec_tagname_t tmp_tagName = (m_tagName << 1) | (m_tagList.empty() ? 0 : 1); ec_tagtype_t type = m_dataType; ec_taglen_t tagLen = GetTagLen(); wxASSERT(type != EC_TAGTYPE_UNKNOWN); if (!socket.WriteNumber(&tmp_tagName, sizeof(ec_tagname_t))) return false; if (!socket.WriteNumber(&type, sizeof(ec_tagtype_t))) return false; if (!socket.WriteNumber(&tagLen, sizeof(ec_taglen_t))) return false; if (!m_tagList.empty()) { if (!WriteChildren(socket)) return false; } if (m_dataLen > 0) { if (m_tagData != NULL) { // This is here only to make sure everything, it should not be NULL at this point if (!socket.WriteBuffer(m_tagData, m_dataLen)) return false; } } return true; }