From 1f8ba004f80dfbd661296c667d33ec763692dfac Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Sun, 21 Jul 2019 18:10:39 +0200 Subject: [PATCH] Use default NetworkPacket copy constuctor and assignment operator clazy was complaining that the class had copy constructor but no assignment operator, which is usually suspicious This is a bit of behaviour change though, since now m_payloadTransferInfo is also copied, which before wasn't, not sure if this is actually a good or a bad thing --- core/networkpacket.cpp | 9 --------- core/networkpacket.h | 5 +++-- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/core/networkpacket.cpp b/core/networkpacket.cpp index 010c52f77..ee9f8a36c 100644 --- a/core/networkpacket.cpp +++ b/core/networkpacket.cpp @@ -55,15 +55,6 @@ NetworkPacket::NetworkPacket(const QString& type, const QVariantMap& body) { } -NetworkPacket::NetworkPacket(const NetworkPacket& other) - : m_id(other.m_id) - , m_type(other.m_type) - , m_body(QVariantMap(other.m_body)) - , m_payload(other.m_payload) - , m_payloadSize(other.m_payloadSize) -{ -} - void NetworkPacket::createIdentityPacket(NetworkPacket* np) { KdeConnectConfig* config = KdeConnectConfig::instance(); diff --git a/core/networkpacket.h b/core/networkpacket.h index b059c8b90..3db4eebc5 100644 --- a/core/networkpacket.h +++ b/core/networkpacket.h @@ -48,7 +48,8 @@ public: const static int s_protocolVersion; explicit NetworkPacket(const QString& type = QStringLiteral("empty"), const QVariantMap& body = {}); - NetworkPacket(const NetworkPacket& other); // Copy constructor, required for QMetaType and queued signals + NetworkPacket(const NetworkPacket& other) = default; // Copy constructor, required for QMetaType and queued signals + NetworkPacket &operator=(const NetworkPacket& other) = default; static void createIdentityPacket(NetworkPacket*); @@ -88,7 +89,7 @@ private: QString m_id; QString m_type; QVariantMap m_body; - + QSharedPointer m_payload; qint64 m_payloadSize; QVariantMap m_payloadTransferInfo;