sacnview icon indicating copy to clipboard operation
sacnview copied to clipboard

CID generation is wrong

Open RichardTea opened this issue 2 years ago • 0 comments

CIDs are being generated by the following code:

CID CID::CreateCid()
{
    QUuid uuid = QUuid::createUuid();
    QByteArray bits = uuid.toByteArray();

    CID result;
    memcpy(result.m_cid, bits.data(), CIDBYTES);
    return result;
}

This is simply incorrect. QUuid::toByteArray() returns a string representation of the UUID, eg: {d6baa5c0-c5e9-48eb-bba3-f64a86f29ef8} Fortunately the string representation is always larger than the 16 bytes, and is fairly unique.

The correct call is QUuid::toRfc4122() to get the big-endian representation.

RichardTea avatar Jun 08 '23 11:06 RichardTea