Skip to content

Commit

Permalink
Use default NetworkPacket copy constuctor and assignment operator
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tsdgeos committed Jul 21, 2019
1 parent 8d939e1 commit 1f8ba00
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
9 changes: 0 additions & 9 deletions core/networkpacket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
5 changes: 3 additions & 2 deletions core/networkpacket.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ class KDECONNECTCORE_EXPORT NetworkPacket
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*);

Expand Down Expand Up @@ -88,7 +89,7 @@ class KDECONNECTCORE_EXPORT NetworkPacket
QString m_id;
QString m_type;
QVariantMap m_body;

QSharedPointer<QIODevice> m_payload;
qint64 m_payloadSize;
QVariantMap m_payloadTransferInfo;
Expand Down

0 comments on commit 1f8ba00

Please sign in to comment.