From d6321cac04ad1ce0d16d075320a0db04ee9a4103 Mon Sep 17 00:00:00 2001
From: Grigoris Pavlakis <gregory.pavlakis@gmail.com>
Date: Mon, 25 Mar 2019 17:09:51 +0000
Subject: [PATCH] Convert call-by-value to call-by-reference

---
 inc/Services/FunctionManagementService.hpp | 2 +-
 src/Services/FunctionManagementService.cpp | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/inc/Services/FunctionManagementService.hpp b/inc/Services/FunctionManagementService.hpp
index 21920adf..a4973dd5 100644
--- a/inc/Services/FunctionManagementService.hpp
+++ b/inc/Services/FunctionManagementService.hpp
@@ -67,7 +67,7 @@ public:
 	 * int, for testing purposes.
 	 * @param msg A TC[8,1] message
 	 */
-	int call(Message msg);
+	int call(Message& msg);
 
 	/**
 	 * Includes a new function in the pointer map. This enables it to be called by way of a valid
diff --git a/src/Services/FunctionManagementService.cpp b/src/Services/FunctionManagementService.cpp
index 8cf94b79..c727e00d 100644
--- a/src/Services/FunctionManagementService.cpp
+++ b/src/Services/FunctionManagementService.cpp
@@ -30,11 +30,12 @@
  * }
  */
 
-int FunctionManagementService::call(Message msg) {
+int FunctionManagementService::call(Message& msg) {
 	/**
 	 * @todo: Add test for message and service type using the ErrorHandler
 	 * @todo: Convert all functions to void (use error reports for tests instead of return numbers)
 	 */
+	msg.resetRead();
 	ErrorHandler::assertInternal(msg.messageType == 1 && msg.serviceType == 8,
 	                             ErrorHandler::InternalErrorType::UnacceptablePacket);
 
-- 
GitLab