[MQTT] Fixes from cppcheck scan

pull/163/head
jgromes 2020-07-04 15:32:32 +02:00
rodzic f394912c92
commit cb0cf75c99
2 zmienionych plików z 3 dodań i 6 usunięć

Wyświetl plik

@ -96,7 +96,6 @@ int16_t MQTTClient::connect(const char* host, const char* clientId, const char*
packet[pos++] = (passwordLen & 0xFF00) >> 8;;
packet[pos++] = passwordLen & 0x00FF;
memcpy(packet + pos, password, passwordLen);
pos += passwordLen;
}
// create TCP connection
@ -198,7 +197,6 @@ int16_t MQTTClient::publish(const char* topic, const char* message) {
// payload
// message
memcpy(packet + pos, message, messageLen);
pos += messageLen;
// send MQTT packet
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 & 0x00FF;
memcpy(packet + pos, topicFilter, topicFilterLen);
pos += topicFilterLen;
// send MQTT packet
int16_t state = _tl->send(packet, 1 + encodedBytes + remainingLength);

Wyświetl plik

@ -39,7 +39,7 @@ class MQTTClient {
\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
@ -135,8 +135,8 @@ class MQTTClient {
uint16_t _port;
uint16_t _packetId;
size_t encodeLength(uint32_t len, uint8_t* encoded);
uint32_t decodeLength(uint8_t* encoded);
static size_t encodeLength(uint32_t len, uint8_t* encoded);
static uint32_t decodeLength(uint8_t* encoded);
};
#endif