Skip to content

Commit 0b2100b

Browse files
committed
Remove use of copy constructor
Building as debug for ARMC6 fails with: call to implicitly-deleted copy constructor of 'Countdown' This is because MQTTSNClient.h is making use of the copy constructor on line 645 and other places with code such as: Timer connect_timer = Timer(command_timeout_ms); This patch fixes that problem by replacing the code which is using the constructor with code directly calling the constructor.
1 parent 17cfb20 commit 0b2100b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

paho_mqtt-sn_embedded_c/MQTTSNClient/src/MQTTSNClient.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ template<class Network, class Timer, int a, int b>
483483
int MQTTSN::Client<Network, Timer, a, b>::yield(unsigned long timeout_ms)
484484
{
485485
int rc = SUCCESS;
486-
Timer timer = Timer();
486+
Timer timer;
487487

488488
timer.countdown_ms(timeout_ms);
489489
while (!timer.expired())
@@ -610,7 +610,7 @@ int MQTTSN::Client<Network, Timer, MAX_PACKET_SIZE, b>::keepalive()
610610
if (!ping_outstanding)
611611
{
612612
MQTTSNString clientid = MQTTSNString_initializer;
613-
Timer timer = Timer(1000);
613+
Timer timer(1000);
614614
int len = MQTTSNSerialize_pingreq(sendbuf, MAX_PACKET_SIZE, clientid);
615615
if (len > 0 && (rc = sendPacket(len, timer)) == SUCCESS) // send the ping packet
616616
ping_outstanding = true;
@@ -642,7 +642,7 @@ int MQTTSN::Client<Network, Timer, a, b>::waitfor(int packet_type, Timer& timer)
642642
template<class Network, class Timer, int MAX_PACKET_SIZE, int b>
643643
int MQTTSN::Client<Network, Timer, MAX_PACKET_SIZE, b>::connect(MQTTSNPacket_connectData& options)
644644
{
645-
Timer connect_timer = Timer(command_timeout_ms);
645+
Timer connect_timer(command_timeout_ms);
646646
int rc = FAILURE;
647647
int len = 0;
648648

@@ -709,7 +709,7 @@ template<class Network, class Timer, int MAX_PACKET_SIZE, int MAX_MESSAGE_HANDLE
709709
int MQTTSN::Client<Network, Timer, MAX_PACKET_SIZE, MAX_MESSAGE_HANDLERS>::subscribe(MQTTSN_topicid& topicFilter, enum QoS qos, messageHandler messageHandler)
710710
{
711711
int rc = FAILURE;
712-
Timer timer = Timer(command_timeout_ms);
712+
Timer timer(command_timeout_ms);
713713
int len = 0;
714714

715715
if (!isconnected)
@@ -775,7 +775,7 @@ template<class Network, class Timer, int MAX_PACKET_SIZE, int MAX_MESSAGE_HANDLE
775775
int MQTTSN::Client<Network, Timer, MAX_PACKET_SIZE, MAX_MESSAGE_HANDLERS>::unsubscribe(MQTTSN_topicid& topicFilter)
776776
{
777777
int rc = FAILURE;
778-
Timer timer = Timer(command_timeout_ms);
778+
Timer timer(command_timeout_ms);
779779
int len = 0;
780780

781781
if (!isconnected)
@@ -854,7 +854,7 @@ template<class Network, class Timer, int MAX_PACKET_SIZE, int b>
854854
int MQTTSN::Client<Network, Timer, MAX_PACKET_SIZE, b>::publish(MQTTSN_topicid& topic, void* payload, size_t payloadlen, unsigned short& id, enum QoS qos, bool retained)
855855
{
856856
int rc = FAILURE;
857-
Timer timer = Timer(command_timeout_ms);
857+
Timer timer(command_timeout_ms);
858858
int len = 0;
859859

860860
if (!isconnected)
@@ -908,7 +908,7 @@ template<class Network, class Timer, int MAX_PACKET_SIZE, int b>
908908
int MQTTSN::Client<Network, Timer, MAX_PACKET_SIZE, b>::disconnect(unsigned short duration)
909909
{
910910
int rc = FAILURE;
911-
Timer timer = Timer(command_timeout_ms); // we might wait for incomplete incoming publishes to complete
911+
Timer timer(command_timeout_ms); // we might wait for incomplete incoming publishes to complete
912912
int int_duration = (duration == 0) ? -1 : (int)duration;
913913
int len = MQTTSNSerialize_disconnect(sendbuf, MAX_PACKET_SIZE, int_duration);
914914
if (len > 0)

0 commit comments

Comments
 (0)