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
This commit is contained in:
Albert Astals Cid 2019-07-21 18:10:39 +02:00
parent 8d939e130f
commit 1f8ba004f8
2 changed files with 3 additions and 11 deletions

View file

@ -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();

View file

@ -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<QIODevice> m_payload;
qint64 m_payloadSize;
QVariantMap m_payloadTransferInfo;