mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 14:29:03 +02:00
Partially fill packet header on construction
This commit is contained in:
parent
12edec7bea
commit
d87679f115
1 changed files with 4 additions and 1 deletions
|
@ -42,7 +42,10 @@ Packet::Packet(PacketType::Value type, int64_t size) :
|
||||||
_packetSize(headerSize(type) + size),
|
_packetSize(headerSize(type) + size),
|
||||||
_packet(new char(_packetSize)),
|
_packet(new char(_packetSize)),
|
||||||
_payload(_packet.get() + headerSize(type), size) {
|
_payload(_packet.get() + headerSize(type), size) {
|
||||||
Q_ASSERT(size <= maxPayloadSize(type));
|
|
||||||
|
Q_ASSERT(size <= maxPayloadSize(type));
|
||||||
|
auto offset = packArithmeticallyCodedValue(type, _packet);
|
||||||
|
_packet[offset] = versionForPacketType(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
PacketType::Value Packet::getPacketType() const {
|
PacketType::Value Packet::getPacketType() const {
|
||||||
|
|
Loading…
Reference in a new issue