From 6abd1c50b27b238169145f04d2daa811a825adbd Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 8 Mar 2016 15:45:13 -0800 Subject: [PATCH] remove the inlined writeError in AssetServer --- assignment-client/src/assets/AssetServer.cpp | 3 ++- assignment-client/src/assets/AssetServer.h | 10 ++-------- assignment-client/src/assets/SendAssetTask.cpp | 6 +++--- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/assignment-client/src/assets/AssetServer.cpp b/assignment-client/src/assets/AssetServer.cpp index 59b9e9fc47..13257967ac 100644 --- a/assignment-client/src/assets/AssetServer.cpp +++ b/assignment-client/src/assets/AssetServer.cpp @@ -21,11 +21,12 @@ #include #include +#include + #include "NetworkLogging.h" #include "NodeType.h" #include "SendAssetTask.h" #include "UploadAssetTask.h" -#include const QString ASSET_SERVER_LOGGING_TARGET_NAME = "asset-server"; diff --git a/assignment-client/src/assets/AssetServer.h b/assignment-client/src/assets/AssetServer.h index f8597c3688..094ea58d41 100644 --- a/assignment-client/src/assets/AssetServer.h +++ b/assignment-client/src/assets/AssetServer.h @@ -12,10 +12,10 @@ #ifndef hifi_AssetServer_h #define hifi_AssetServer_h -#include +#include +#include #include -#include #include "AssetUtils.h" #include "ReceivedMessage.h" @@ -60,8 +60,6 @@ private: /// Rename mapping from `oldPath` to `newPath`. Returns true if successful bool renameMapping(const AssetPath& oldPath, const AssetPath& newPath); - static void writeError(NLPacketList* packetList, AssetServerError error); - void performMappingMigration(); Mappings _fileMappings; @@ -71,8 +69,4 @@ private: QThreadPool _taskPool; }; -inline void writeError(NLPacketList* packetList, AssetServerError error) { - packetList->writePrimitive(error); -} - #endif diff --git a/assignment-client/src/assets/SendAssetTask.cpp b/assignment-client/src/assets/SendAssetTask.cpp index 33e1ab0fb8..d2b3c6c256 100644 --- a/assignment-client/src/assets/SendAssetTask.cpp +++ b/assignment-client/src/assets/SendAssetTask.cpp @@ -56,7 +56,7 @@ void SendAssetTask::run() { replyPacketList->writePrimitive(messageID); if (end <= start) { - writeError(replyPacketList.get(), AssetServerError::InvalidByteRange); + replyPacketList->writePrimitive(AssetServerError::InvalidByteRange); } else { QString filePath = _resourcesDir.filePath(QString(hexHash)); @@ -64,7 +64,7 @@ void SendAssetTask::run() { if (file.open(QIODevice::ReadOnly)) { if (file.size() < end) { - writeError(replyPacketList.get(), AssetServerError::InvalidByteRange); + replyPacketList->writePrimitive(AssetServerError::InvalidByteRange); qCDebug(networking) << "Bad byte range: " << hexHash << " " << start << ":" << end; } else { auto size = end - start; @@ -77,7 +77,7 @@ void SendAssetTask::run() { file.close(); } else { qCDebug(networking) << "Asset not found: " << filePath << "(" << hexHash << ")"; - writeError(replyPacketList.get(), AssetServerError::AssetNotFound); + replyPacketList->writePrimitive(AssetServerError::AssetNotFound); } }