From 5caaf0dc7f1710b97c0bce05abd80fb9ff2746cd Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Fri, 31 Jan 2014 13:28:56 -0800 Subject: [PATCH 1/4] check against NULL node from nodeWithUUID() --- libraries/octree/src/JurisdictionSender.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/octree/src/JurisdictionSender.cpp b/libraries/octree/src/JurisdictionSender.cpp index 52990397db..854496e40f 100644 --- a/libraries/octree/src/JurisdictionSender.cpp +++ b/libraries/octree/src/JurisdictionSender.cpp @@ -64,7 +64,7 @@ bool JurisdictionSender::process() { _nodesRequestingJurisdictions.pop(); SharedNodePointer node = NodeList::getInstance()->nodeWithUUID(nodeUUID); - if (node->getActiveSocket() != NULL) { + if (node && node->getActiveSocket() != NULL) { const HifiSockAddr* nodeAddress = node->getActiveSocket(); _packetSender.queuePacketForSending(*nodeAddress, QByteArray(reinterpret_cast(bufferOut), sizeOut)); nodeCount++; From 254a0c0aed17c62b24cc51b1ac036a8ff6533d59 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 31 Jan 2014 13:44:24 -0800 Subject: [PATCH 2/4] remove a double push on UUID in OctreeQuery --- libraries/octree/src/OctreeQuery.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/libraries/octree/src/OctreeQuery.cpp b/libraries/octree/src/OctreeQuery.cpp index 51b73a9ed2..ed8bfd0da4 100644 --- a/libraries/octree/src/OctreeQuery.cpp +++ b/libraries/octree/src/OctreeQuery.cpp @@ -103,9 +103,6 @@ int OctreeQuery::parseData(const QByteArray& packet) { const unsigned char* startPosition = reinterpret_cast(packet.data()); const unsigned char* sourceBuffer = startPosition + numBytesPacketHeader; - // push past the node session UUID - sourceBuffer += NUM_BYTES_RFC4122_UUID; - // user UUID _uuid = QUuid::fromRfc4122(QByteArray((char*) sourceBuffer, NUM_BYTES_RFC4122_UUID)); sourceBuffer += NUM_BYTES_RFC4122_UUID; From 9b549723d3e302b9fbb928309af4836e496dc31e Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 31 Jan 2014 13:47:59 -0800 Subject: [PATCH 3/4] remove unused UUID from OctreeQuery --- libraries/octree/src/OctreeQuery.cpp | 10 ---------- libraries/octree/src/OctreeQuery.h | 5 ----- 2 files changed, 15 deletions(-) diff --git a/libraries/octree/src/OctreeQuery.cpp b/libraries/octree/src/OctreeQuery.cpp index ed8bfd0da4..5c67715ab9 100644 --- a/libraries/octree/src/OctreeQuery.cpp +++ b/libraries/octree/src/OctreeQuery.cpp @@ -24,7 +24,6 @@ static const float fingerVectorRadix = 4; // bits of precision when converting f OctreeQuery::OctreeQuery() : NodeData(), - _uuid(), _cameraPosition(0,0,0), _cameraOrientation(), _cameraFov(0.0f), @@ -53,11 +52,6 @@ int OctreeQuery::getBroadcastData(unsigned char* destinationBuffer) { // that can pack any type given the number of bytes // and return the number of bytes to push the pointer - // UUID - QByteArray uuidByteArray = _uuid.toRfc4122(); - memcpy(destinationBuffer, uuidByteArray.constData(), uuidByteArray.size()); - destinationBuffer += uuidByteArray.size(); - // camera details memcpy(destinationBuffer, &_cameraPosition, sizeof(_cameraPosition)); destinationBuffer += sizeof(_cameraPosition); @@ -103,10 +97,6 @@ int OctreeQuery::parseData(const QByteArray& packet) { const unsigned char* startPosition = reinterpret_cast(packet.data()); const unsigned char* sourceBuffer = startPosition + numBytesPacketHeader; - // user UUID - _uuid = QUuid::fromRfc4122(QByteArray((char*) sourceBuffer, NUM_BYTES_RFC4122_UUID)); - sourceBuffer += NUM_BYTES_RFC4122_UUID; - // camera details memcpy(&_cameraPosition, sourceBuffer, sizeof(_cameraPosition)); sourceBuffer += sizeof(_cameraPosition); diff --git a/libraries/octree/src/OctreeQuery.h b/libraries/octree/src/OctreeQuery.h index acb4b7cb32..800d30b7cd 100644 --- a/libraries/octree/src/OctreeQuery.h +++ b/libraries/octree/src/OctreeQuery.h @@ -57,9 +57,6 @@ public: int getBroadcastData(unsigned char* destinationBuffer); int parseData(const QByteArray& packet); - QUuid& getUUID() { return _uuid; } - void setUUID(const QUuid& uuid) { _uuid = uuid; } - // getters for camera details const glm::vec3& getCameraPosition() const { return _cameraPosition; } const glm::quat& getCameraOrientation() const { return _cameraOrientation; } @@ -101,8 +98,6 @@ public slots: void setBoundaryLevelAdjust(int boundaryLevelAdjust) { _boundaryLevelAdjust = boundaryLevelAdjust; } protected: - QUuid _uuid; - // camera details for the avatar glm::vec3 _cameraPosition; glm::quat _cameraOrientation; From 4b18e37dfb100020df4ff77939282074d1fc1bd4 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 31 Jan 2014 14:13:05 -0800 Subject: [PATCH 4/4] fix for ttf return in DS, closes #1769 --- libraries/embedded-webserver/src/HTTPManager.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libraries/embedded-webserver/src/HTTPManager.cpp b/libraries/embedded-webserver/src/HTTPManager.cpp index 849bf593cd..a217555a78 100755 --- a/libraries/embedded-webserver/src/HTTPManager.cpp +++ b/libraries/embedded-webserver/src/HTTPManager.cpp @@ -63,7 +63,7 @@ bool HTTPManager::handleHTTPRequest(HTTPConnection* connection, const QString& p QFile localFile(filePath); localFile.open(QIODevice::ReadOnly); - QString localFileString(localFile.readAll()); + QByteArray localFileData = localFile.readAll(); QFileInfo localFileInfo(filePath); @@ -77,6 +77,7 @@ bool HTTPManager::handleHTTPRequest(HTTPConnection* connection, const QString& p int matchPosition = 0; + QString localFileString(localFileData); while ((matchPosition = includeRegExp.indexIn(localFileString, matchPosition)) != -1) { // check if this is a file or vitual include @@ -105,9 +106,11 @@ bool HTTPManager::handleHTTPRequest(HTTPConnection* connection, const QString& p // push the match position forward so we can check the next match matchPosition += includeRegExp.matchedLength(); } + + localFileData = localFileString.toLocal8Bit(); } - connection->respond(HTTPConnection::StatusCode200, localFileString.toLocal8Bit(), + connection->respond(HTTPConnection::StatusCode200, localFileData, qPrintable(mimeDatabase.mimeTypeForFile(filePath).name())); } else {