perfect SetDeviceName

This commit is contained in:
Christian Semmler 2023-06-15 16:22:48 +02:00
parent 8b58e6fe28
commit e6f8da256f
No known key found for this signature in database
GPG key ID: 086DAA1360BEEE5C

View file

@ -30,20 +30,21 @@ MxVideoParam &MxVideoParam::operator=(const MxVideoParam &other)
return *this;
}
// TODO: this doesn't match exactly, something weird with the conditional on id
void MxVideoParam::SetDeviceName(char *id)
{
if (this->m_deviceId != 0)
free(this->m_deviceId);
if (id == 0)
{
this->m_deviceId = 0;
}
else
if (id != 0)
{
this->m_deviceId = (char *)malloc(strlen(id) + 1);
strcpy(this->m_deviceId, id);
if (this->m_deviceId != 0) {
strcpy(this->m_deviceId, id);
}
}
else {
this->m_deviceId = 0;
}
}