From 86a218ad20b64e40bd93f600104a99cfa446f75f Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 8 Jul 2015 18:52:15 -0700 Subject: [PATCH] fix for templated read/write in PacketList --- libraries/networking/src/LimitedNodeList.cpp | 4 ++-- libraries/networking/src/PacketList.cpp | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libraries/networking/src/LimitedNodeList.cpp b/libraries/networking/src/LimitedNodeList.cpp index c85fb730ee..901788b1f3 100644 --- a/libraries/networking/src/LimitedNodeList.cpp +++ b/libraries/networking/src/LimitedNodeList.cpp @@ -551,7 +551,7 @@ std::unique_ptr LimitedNodeList::constructPingReplyPacket(const QByteA return replyPacket; } -std::unique_ptr constructICEPingPacket(PingType_t pingType, const QUuid& iceID) { +std::unique_ptr LimitedNodeList::constructICEPingPacket(PingType_t pingType, const QUuid& iceID) { int packetSize = NUM_BYTES_RFC4122_UUID + sizeof(PingType_t); auto icePingPacket = NLPacket::create(PacketType::ICEPing, packetSize); @@ -562,7 +562,7 @@ std::unique_ptr constructICEPingPacket(PingType_t pingType, const QUui return icePingPacket; } -std::unique_ptr constructICEPingReplyPacket(const QByteArray& pingPacket, const QUuid& iceID) { +std::unique_ptr LimitedNodeList::constructICEPingReplyPacket(const QByteArray& pingPacket, const QUuid& iceID) { // pull out the ping type so we can reply back with that PingType_t pingType; diff --git a/libraries/networking/src/PacketList.cpp b/libraries/networking/src/PacketList.cpp index d4209258d2..db0b4fc90c 100644 --- a/libraries/networking/src/PacketList.cpp +++ b/libraries/networking/src/PacketList.cpp @@ -32,13 +32,13 @@ template std::unique_ptr PacketList::createPacketWithExte } } -template qint64 Packet::readPrimitive(T* data) { - return QIODevice::read(reinterpret_cast(data), sizeof(T)); +template template qint64 PacketList::readPrimitive(U* data) { + return QIODevice::read(reinterpret_cast(data), sizeof(U)); } -template qint64 Packet::writePrimitive(const T& data) { - static_assert(!std::is_pointer::value, "T must not be a pointer"); - return QIODevice::write(reinterpret_cast(&data), sizeof(T)); +template template qint64 PacketList::writePrimitive(const U& data) { + static_assert(!std::is_pointer::value, "T must not be a pointer"); + return QIODevice::write(reinterpret_cast(&data), sizeof(U)); } template qint64 PacketList::writeData(const char* data, qint64 maxSize) {