Skip to content

Commit 61aa6fe

Browse files
authored
fix LoadStoreAlignment error
1 parent ffab661 commit 61aa6fe

File tree

10 files changed

+10
-30
lines changed

10 files changed

+10
-30
lines changed

src/AsyncMqttClient/Packets/Out/OutPacket.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ OutPacket::OutPacket()
66
: next(nullptr)
77
, timeout(0)
88
, noTries(0)
9-
, _released(true) {}
9+
, _released(true)
10+
, _packetId(0) {}
1011

1112
OutPacket::~OutPacket() {}
1213

@@ -19,7 +20,7 @@ uint8_t OutPacket::packetType() const {
1920
}
2021

2122
uint16_t OutPacket::packetId() const {
22-
return 0;
23+
return _packetId;
2324
}
2425

2526
uint8_t OutPacket::qos() const {
@@ -33,11 +34,11 @@ void OutPacket::release() {
3334
_released = true;
3435
}
3536

36-
uint16_t OutPacket::_packetId = 0;
37+
uint16_t OutPacket::_nextPacketId = 0;
3738

3839
uint16_t OutPacket::_getNextPacketId() {
39-
if (++_packetId == 0) {
40-
++_packetId;
40+
if (++_nextPacketId == 0) {
41+
++_nextPacketId;
4142
}
42-
return _packetId;
43+
return _nextPacketId;
4344
}

src/AsyncMqttClient/Packets/Out/OutPacket.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class OutPacket {
1515
virtual size_t size() const = 0;
1616
virtual bool released() const;
1717
uint8_t packetType() const;
18-
virtual uint16_t packetId() const;
18+
uint16_t packetId() const;
1919
uint8_t qos() const;
2020
void release();
2121

@@ -27,8 +27,9 @@ class OutPacket {
2727
protected:
2828
static uint16_t _getNextPacketId();
2929
bool _released;
30+
uint16_t _packetId;
3031

3132
private:
32-
static uint16_t _packetId;
33+
static uint16_t _nextPacketId;
3334
};
3435
} // namespace AsyncMqttClientInternals

src/AsyncMqttClient/Packets/Out/PubAck.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,3 @@ bool PubAckOutPacket::released() const {
2828
}
2929
return true;
3030
}
31-
32-
uint16_t PubAckOutPacket::packetId() const {
33-
return _packetId;
34-
}

src/AsyncMqttClient/Packets/Out/PubAck.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@ class PubAckOutPacket : public OutPacket {
1313
size_t size() const;
1414

1515
bool released() const override;
16-
uint16_t packetId() const override;
1716

1817
private:
1918
uint8_t _data[4];
20-
uint16_t _packetId;
2119
};
2220
} // namespace AsyncMqttClientInternals

src/AsyncMqttClient/Packets/Out/Publish.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ size_t PublishOutPacket::size() const {
6666
return _data.size();
6767
}
6868

69-
uint16_t PublishOutPacket::packetId() const {
70-
return _packetId;
71-
}
72-
7369
void PublishOutPacket::setDup() {
7470
_data[0] |= AsyncMqttClientInternals::HeaderFlag.PUBLISH_DUP;
7571
}

src/AsyncMqttClient/Packets/Out/Publish.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ class PublishOutPacket : public OutPacket {
1414
PublishOutPacket(const char* topic, uint8_t qos, bool retain, const char* payload, size_t length);
1515
const uint8_t* data(size_t index = 0) const;
1616
size_t size() const;
17-
uint16_t packetId() const override;
1817

1918
void setDup(); // you cannot unset dup
2019

src/AsyncMqttClient/Packets/Out/Subscribe.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,3 @@ const uint8_t* SubscribeOutPacket::data(size_t index) const {
4747
size_t SubscribeOutPacket::size() const {
4848
return _data.size();
4949
}
50-
51-
uint16_t SubscribeOutPacket::packetId() const {
52-
return _packetId;
53-
}

src/AsyncMqttClient/Packets/Out/Subscribe.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ class SubscribeOutPacket : public OutPacket {
1515
const uint8_t* data(size_t index = 0) const;
1616
size_t size() const;
1717

18-
uint16_t packetId() const;
19-
2018
private:
2119
std::vector<uint8_t> _data;
2220
uint16_t _packetId;

src/AsyncMqttClient/Packets/Out/Unsubscribe.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,3 @@ const uint8_t* UnsubscribeOutPacket::data(size_t index) const {
4040
size_t UnsubscribeOutPacket::size() const {
4141
return _data.size();
4242
}
43-
44-
uint16_t UnsubscribeOutPacket::packetId() const {
45-
return _packetId;
46-
}

src/AsyncMqttClient/Packets/Out/Unsubscribe.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,5 @@ class UnsubscribeOutPacket : public OutPacket {
1919

2020
private:
2121
std::vector<uint8_t> _data;
22-
uint16_t _packetId;
2322
};
2423
} // namespace AsyncMqttClientInternals

0 commit comments

Comments
 (0)