From 746b79d17e988c47ad49f8b2f3691f0163113208 Mon Sep 17 00:00:00 2001 From: John Date: Sun, 4 Jun 2023 08:11:51 +0200 Subject: [PATCH] fix previous commit --- src/ebusd/bushandler.cpp | 4 ++-- src/lib/ebus/symbol.h | 26 ++++++++++++-------------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/ebusd/bushandler.cpp b/src/ebusd/bushandler.cpp index 3c968f5c..535337f6 100644 --- a/src/ebusd/bushandler.cpp +++ b/src/ebusd/bushandler.cpp @@ -1179,8 +1179,8 @@ bool BusHandler::addSeenAddress(symbol_t address) { void BusHandler::messageCompleted() { const char* prefix = m_currentRequest ? "sent" : "received"; // do an explicit copy here in case being called by another thread - const MasterSymbolString command = m_currentRequest ? m_currentRequest->m_master : m_command; - SlaveSymbolString response = m_response; + const MasterSymbolString command(m_currentRequest ? m_currentRequest->m_master : m_command); + const SlaveSymbolString response(m_response); symbol_t srcAddress = command[0], dstAddress = command[1]; if (srcAddress == dstAddress) { logError(lf_bus, "invalid self-addressed message from %2.2x", srcAddress); diff --git a/src/lib/ebus/symbol.h b/src/lib/ebus/symbol.h index bae2b2c2..4fa6902c 100755 --- a/src/lib/ebus/symbol.h +++ b/src/lib/ebus/symbol.h @@ -370,6 +370,12 @@ class MasterSymbolString : public SymbolString { */ MasterSymbolString() : SymbolString(true) {} + /** + * Copy constructor. + * @param str the @a MasterSymbolString to copy from. + */ + MasterSymbolString(const MasterSymbolString& str) : SymbolString(str) {} + MasterSymbolString& operator=(const MasterSymbolString& other) { this->m_data = other.m_data; this->m_isMaster = true; @@ -381,13 +387,6 @@ class MasterSymbolString : public SymbolString { this->m_isMaster = true; return *this; } - - private: - /** - * Copy constructor. - * @param str the @a MasterSymbolString to copy from. - */ - MasterSymbolString(const MasterSymbolString& str) : SymbolString(str) {} }; @@ -401,6 +400,12 @@ class SlaveSymbolString : public SymbolString { */ SlaveSymbolString() : SymbolString(false) {} + /** + * Copy constructor. + * @param str the @a SlaveSymbolString to copy from. + */ + SlaveSymbolString(const SlaveSymbolString& str) : SymbolString(str) {} + SlaveSymbolString& operator=(const SlaveSymbolString& other) { this->m_data = other.m_data; this->m_isMaster = false; @@ -412,13 +417,6 @@ class SlaveSymbolString : public SymbolString { this->m_isMaster = false; return *this; } - - private: - /** - * Copy constructor. - * @param str the @a SlaveSymbolString to copy from. - */ - SlaveSymbolString(const SlaveSymbolString& str) : SymbolString(str) {} };