[ESP8266] Fixes from cppchekc scan

This commit is contained in:
jgromes 2020-07-04 14:15:23 +02:00
parent e3fb895969
commit 7a8cde1d38
2 changed files with 9 additions and 9 deletions

View file

@ -83,9 +83,9 @@ int16_t ESP8266::join(const char* ssid, const char* password) {
int16_t ESP8266::openTransportConnection(const char* host, const char* protocol, uint16_t port, uint16_t tcpKeepAlive) { int16_t ESP8266::openTransportConnection(const char* host, const char* protocol, uint16_t port, uint16_t tcpKeepAlive) {
char portStr[6]; char portStr[6];
sprintf(portStr, "%d", port); sprintf(portStr, "%u", port);
char tcpKeepAliveStr[6]; char tcpKeepAliveStr[6];
sprintf(tcpKeepAliveStr, "%d", tcpKeepAlive); sprintf(tcpKeepAliveStr, "%u", tcpKeepAlive);
// build AT command // build AT command
const char* atStr = "AT+CIPSTART=\""; const char* atStr = "AT+CIPSTART=\"";
@ -132,7 +132,7 @@ int16_t ESP8266::closeTransportConnection() {
int16_t ESP8266::send(const char* data) { int16_t ESP8266::send(const char* data) {
// build AT command // build AT command
char lenStr[12]; char lenStr[12];
sprintf(lenStr, "%d", strlen(data)); sprintf(lenStr, "%u", (uint16_t)strlen(data));
const char* atStr = "AT+CIPSEND="; const char* atStr = "AT+CIPSEND=";
#ifdef RADIOLIB_STATIC_ONLY #ifdef RADIOLIB_STATIC_ONLY
char cmd[RADIOLIB_STATIC_ARRAY_SIZE]; char cmd[RADIOLIB_STATIC_ARRAY_SIZE];

View file

@ -48,12 +48,12 @@ class ESP8266: public TransportLayer {
int16_t join(const char* ssid, const char* password); int16_t join(const char* ssid, const char* password);
// transport layer methods (implementations of purely virtual methods in TransportLayer class) // transport layer methods (implementations of purely virtual methods in TransportLayer class)
int16_t openTransportConnection(const char* host, const char* protocol, uint16_t port, uint16_t tcpKeepAlive = 0); int16_t openTransportConnection(const char* host, const char* protocol, uint16_t port, uint16_t tcpKeepAlive = 0) override;
int16_t closeTransportConnection(); int16_t closeTransportConnection() override;
int16_t send(const char* data); int16_t send(const char* data) override;
int16_t send(uint8_t* data, uint32_t len); int16_t send(uint8_t* data, uint32_t len) override;
size_t receive(uint8_t* data, size_t len, uint32_t timeout = 10000); size_t receive(uint8_t* data, size_t len, uint32_t timeout = 10000) override;
size_t getNumBytes(uint32_t timeout = 10000, size_t minBytes = 10); size_t getNumBytes(uint32_t timeout = 10000, size_t minBytes = 10) override;
#ifndef RADIOLIB_GODMODE #ifndef RADIOLIB_GODMODE
private: private: