From 2d86e807b0358d6a3abca100f93b55ba925edad5 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 15 Jul 2015 15:00:59 -0700 Subject: [PATCH] Move PACKET_WRITE_ERROR to Packet class --- libraries/networking/src/udt/Packet.cpp | 3 ++- libraries/networking/src/udt/Packet.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/libraries/networking/src/udt/Packet.cpp b/libraries/networking/src/udt/Packet.cpp index 31c861dc3c..27093dfddd 100644 --- a/libraries/networking/src/udt/Packet.cpp +++ b/libraries/networking/src/udt/Packet.cpp @@ -11,6 +11,8 @@ #include "Packet.h" +const qint64 Packet::PACKET_WRITE_ERROR = -1; + qint64 Packet::localHeaderSize(PacketType::Value type) { qint64 size = numBytesForArithmeticCodedPacketType(type) + sizeof(PacketVersion) + ((SEQUENCE_NUMBERED_PACKETS.contains(type)) ? sizeof(SequenceNumber) : 0); @@ -208,7 +210,6 @@ void Packet::writeSequenceNumber(SequenceNumber seqNum) { &seqNum, sizeof(seqNum)); } -static const qint64 PACKET_WRITE_ERROR = -1; qint64 Packet::writeData(const char* data, qint64 maxSize) { // make sure we have the space required to write this block diff --git a/libraries/networking/src/udt/Packet.h b/libraries/networking/src/udt/Packet.h index 40d021f2fc..c124e314f9 100644 --- a/libraries/networking/src/udt/Packet.h +++ b/libraries/networking/src/udt/Packet.h @@ -24,6 +24,8 @@ class Packet : public QIODevice { public: using SequenceNumber = uint16_t; + static const qint64 PACKET_WRITE_ERROR; + static std::unique_ptr create(PacketType::Value type, qint64 size = -1); static std::unique_ptr fromReceivedPacket(std::unique_ptr data, qint64 size, const HifiSockAddr& senderSockAddr);