mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 04:44:11 +02:00
don't seek in Packet before open
This commit is contained in:
parent
462ff97722
commit
5f592df610
3 changed files with 8 additions and 15 deletions
|
@ -64,13 +64,7 @@ std::unique_ptr<NLPacket> NLPacket::fromReceivedPacket(std::unique_ptr<char> dat
|
|||
}
|
||||
|
||||
std::unique_ptr<NLPacket> NLPacket::createCopy(const NLPacket& other) {
|
||||
auto packet = std::unique_ptr<NLPacket>(new NLPacket(other));
|
||||
|
||||
if (other.isOpen()) {
|
||||
packet->open(other.openMode());
|
||||
}
|
||||
|
||||
return packet;
|
||||
return std::unique_ptr<NLPacket>(new NLPacket(other));
|
||||
}
|
||||
|
||||
NLPacket::NLPacket(PacketType::Value type, qint64 size) :
|
||||
|
|
|
@ -44,13 +44,7 @@ std::unique_ptr<Packet> Packet::fromReceivedPacket(std::unique_ptr<char> data, q
|
|||
}
|
||||
|
||||
std::unique_ptr<Packet> Packet::createCopy(const Packet& other) {
|
||||
auto packet = std::unique_ptr<Packet>(new Packet(other));
|
||||
|
||||
if (other.isOpen()) {
|
||||
packet->open(other.openMode());
|
||||
}
|
||||
|
||||
return packet;
|
||||
return std::unique_ptr<Packet>(new Packet(other));
|
||||
}
|
||||
|
||||
qint64 Packet::totalHeadersSize() const {
|
||||
|
@ -104,6 +98,11 @@ Packet::Packet(const Packet& other) :
|
|||
QIODevice()
|
||||
{
|
||||
*this = other;
|
||||
|
||||
if (other.isOpen()) {
|
||||
this->open(other.openMode());
|
||||
}
|
||||
|
||||
this->seek(other.pos());
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ public:
|
|||
|
||||
using QIODevice::read;
|
||||
QByteArray read(qint64 maxSize);
|
||||
|
||||
|
||||
template<typename T> qint64 peekPrimitive(T* data);
|
||||
template<typename T> qint64 readPrimitive(T* data);
|
||||
template<typename T> qint64 writePrimitive(const T& data);
|
||||
|
|
Loading…
Reference in a new issue