Move PACKET_WRITE_ERROR to Packet class

This commit is contained in:
Ryan Huffman 2015-07-15 15:00:59 -07:00
parent 12d5ec89d1
commit 2d86e807b0
2 changed files with 4 additions and 1 deletions

View file

@ -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

View file

@ -24,6 +24,8 @@ class Packet : public QIODevice {
public:
using SequenceNumber = uint16_t;
static const qint64 PACKET_WRITE_ERROR;
static std::unique_ptr<Packet> create(PacketType::Value type, qint64 size = -1);
static std::unique_ptr<Packet> fromReceivedPacket(std::unique_ptr<char> data, qint64 size, const HifiSockAddr& senderSockAddr);