From 5d95a5c117571c386d291fd04c4a71b01c5cc21b Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Tue, 7 Jul 2015 18:17:28 -0700 Subject: [PATCH] Compile fixes --- libraries/networking/src/NodeList.cpp | 8 ++++---- libraries/networking/src/PacketSender.cpp | 4 +--- libraries/networking/src/ReceivedPacketProcessor.cpp | 6 +++--- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/libraries/networking/src/NodeList.cpp b/libraries/networking/src/NodeList.cpp index 9f6be93a5b..95cad20a15 100644 --- a/libraries/networking/src/NodeList.cpp +++ b/libraries/networking/src/NodeList.cpp @@ -398,11 +398,11 @@ void NodeList::sendDSPathQuery(const QString& newPath) { QByteArray pathQueryUTF8 = newPath.toUtf8(); // get the size of the UTF8 representation of the desired path - quint16 numPathBytes = pathQueryUTF8.size(); + qint64 numPathBytes = pathQueryUTF8.size(); - if (numPathBytes + sizeof(numPathBytes) < pathQueryPacket.size() ) { + if (numPathBytes + (qint64)sizeof(numPathBytes) < pathQueryPacket->bytesAvailable() ) { // append the size of the path to the query packet - pathQueryPacket->write(&numPathBytes, sizeof(numPathBytes)); + pathQueryPacket->write((char*)&pathQueryUTF8, sizeof(numPathBytes)); // append the path itself to the query packet pathQueryPacket->write(pathQueryUTF8); @@ -423,7 +423,7 @@ void NodeList::handleDSPathQueryResponse(const QByteArray& packet) { // This is a response to a path query we theoretically made. // In the future we may want to check that this was actually from our DS and for a query we actually made. - int numHeaderBytes = numBytesForPacketHeaderGivenPacketType(PacketTypeDomainServerPathResponse); + int numHeaderBytes = numBytesForPacketHeaderGivenPacketType(PacketType::DomainServerPathResponse); const char* startPosition = packet.data() + numHeaderBytes; const char* currentPosition = startPosition; diff --git a/libraries/networking/src/PacketSender.cpp b/libraries/networking/src/PacketSender.cpp index 0a19df8186..3db845166e 100644 --- a/libraries/networking/src/PacketSender.cpp +++ b/libraries/networking/src/PacketSender.cpp @@ -49,10 +49,8 @@ PacketSender::~PacketSender() { void PacketSender::queuePacketForSending(const SharedNodePointer& destinationNode, std::unique_ptr packet) { - NodePacketPair networkPacket(destinationNode, packet); - lock(); - _packets.push_back(networkPacket); + _packets.push_back({destinationNode, std::move(packet)}); unlock(); _totalPacketsQueued++; diff --git a/libraries/networking/src/ReceivedPacketProcessor.cpp b/libraries/networking/src/ReceivedPacketProcessor.cpp index 2041b80e91..3d4fecff6e 100644 --- a/libraries/networking/src/ReceivedPacketProcessor.cpp +++ b/libraries/networking/src/ReceivedPacketProcessor.cpp @@ -25,7 +25,7 @@ void ReceivedPacketProcessor::queueReceivedPacket(const SharedNodePointer& sendi NodePacketPair networkPacket(sendingNode, NLPacket::create(PacketType::OctreeStats)); lock(); - _packets.push_back(networkPacket); + _packets.push_back(std::move(networkPacket)); _nodePacketCounts[sendingNode->getUUID()]++; unlock(); @@ -51,14 +51,14 @@ bool ReceivedPacketProcessor::process() { currentPackets.swap(_packets); unlock(); - foreach(auto& packetPair, currentPackets) { + for(auto& packetPair : currentPackets) { // TODO: Replace QByteArray() once NLPacket is coming through on receive side processPacket(packetPair.first, QByteArray()); midProcess(); } lock(); - foreach(auto& packetPair, currentPackets) { + for(auto& packetPair : currentPackets) { _nodePacketCounts[packetPair.first->getUUID()]--; } unlock();