diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index 82f50b587a..8461862c4a 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -3977,24 +3977,16 @@ QVector EntityItemProperties::unpackStrokeColors(const QByteArray& strokeC // edit packet sender... bool EntityItemProperties::encodeEraseEntityMessage(const EntityItemID& entityItemID, QByteArray& buffer) { - char* copyAt = buffer.data(); uint16_t numberOfIds = 1; // only one entity ID in this message - int outputLength = 0; - if (buffer.size() < (int)(sizeof(numberOfIds) + NUM_BYTES_RFC4122_UUID)) { qCDebug(entities) << "ERROR - encodeEraseEntityMessage() called with buffer that is too small!"; return false; } - memcpy(copyAt, &numberOfIds, sizeof(numberOfIds)); - copyAt += sizeof(numberOfIds); - outputLength = sizeof(numberOfIds); - - memcpy(copyAt, entityItemID.toRfc4122().constData(), NUM_BYTES_RFC4122_UUID); - outputLength += NUM_BYTES_RFC4122_UUID; - - buffer.resize(outputLength); + buffer.resize(0); + buffer.append(reinterpret_cast(&numberOfIds), sizeof(numberOfIds)); + buffer.append(entityItemID.toRfc4122().constData(), NUM_BYTES_RFC4122_UUID); return true; }