[MQTT] Fixes from cppcheck scan
This commit is contained in:
parent
f394912c92
commit
cb0cf75c99
2 changed files with 3 additions and 6 deletions
|
@ -96,7 +96,6 @@ int16_t MQTTClient::connect(const char* host, const char* clientId, const char*
|
||||||
packet[pos++] = (passwordLen & 0xFF00) >> 8;;
|
packet[pos++] = (passwordLen & 0xFF00) >> 8;;
|
||||||
packet[pos++] = passwordLen & 0x00FF;
|
packet[pos++] = passwordLen & 0x00FF;
|
||||||
memcpy(packet + pos, password, passwordLen);
|
memcpy(packet + pos, password, passwordLen);
|
||||||
pos += passwordLen;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// create TCP connection
|
// create TCP connection
|
||||||
|
@ -198,7 +197,6 @@ int16_t MQTTClient::publish(const char* topic, const char* message) {
|
||||||
// payload
|
// payload
|
||||||
// message
|
// message
|
||||||
memcpy(packet + pos, message, messageLen);
|
memcpy(packet + pos, message, messageLen);
|
||||||
pos += messageLen;
|
|
||||||
|
|
||||||
// send MQTT packet
|
// send MQTT packet
|
||||||
int16_t state = _tl->send(packet, 1 + encodedBytes + remainingLength);
|
int16_t state = _tl->send(packet, 1 + encodedBytes + remainingLength);
|
||||||
|
@ -314,7 +312,6 @@ int16_t MQTTClient::unsubscribe(const char* topicFilter) {
|
||||||
packet[pos++] = (topicFilterLen & 0xFF00) >> 8;;
|
packet[pos++] = (topicFilterLen & 0xFF00) >> 8;;
|
||||||
packet[pos++] = topicFilterLen & 0x00FF;
|
packet[pos++] = topicFilterLen & 0x00FF;
|
||||||
memcpy(packet + pos, topicFilter, topicFilterLen);
|
memcpy(packet + pos, topicFilter, topicFilterLen);
|
||||||
pos += topicFilterLen;
|
|
||||||
|
|
||||||
// send MQTT packet
|
// send MQTT packet
|
||||||
int16_t state = _tl->send(packet, 1 + encodedBytes + remainingLength);
|
int16_t state = _tl->send(packet, 1 + encodedBytes + remainingLength);
|
||||||
|
|
|
@ -39,7 +39,7 @@ class MQTTClient {
|
||||||
|
|
||||||
\param tl Pointer to the wireless module providing TransportLayer communication.
|
\param tl Pointer to the wireless module providing TransportLayer communication.
|
||||||
*/
|
*/
|
||||||
MQTTClient(TransportLayer* tl, uint16_t port = 1883);
|
explicit MQTTClient(TransportLayer* tl, uint16_t port = 1883);
|
||||||
|
|
||||||
// basic methods
|
// basic methods
|
||||||
|
|
||||||
|
@ -135,8 +135,8 @@ class MQTTClient {
|
||||||
uint16_t _port;
|
uint16_t _port;
|
||||||
uint16_t _packetId;
|
uint16_t _packetId;
|
||||||
|
|
||||||
size_t encodeLength(uint32_t len, uint8_t* encoded);
|
static size_t encodeLength(uint32_t len, uint8_t* encoded);
|
||||||
uint32_t decodeLength(uint8_t* encoded);
|
static uint32_t decodeLength(uint8_t* encoded);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue