Skip to content

Commit

Permalink
Merge pull request #404 from pennam/wifis3-warnings
Browse files Browse the repository at this point in the history
 Reduce WiFiS3 warnings
  • Loading branch information
pennam authored Nov 28, 2024
2 parents 8bb82e1 + 75bbb30 commit 04d998d
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 9 deletions.
4 changes: 4 additions & 0 deletions libraries/WiFiS3/src/Modem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ bool ModemClass::passthrough(const uint8_t *data, size_t size) {
/* -------------------------------------------------------------------------- */
void ModemClass::write_nowait(const string &cmd, string &str, const char * fmt, ...) {
/* -------------------------------------------------------------------------- */
(void)cmd;
(void)str;

va_list va;
va_start (va, fmt);
vsnprintf((char *)tx_buff, MAX_BUFF_SIZE, fmt, va);
Expand Down Expand Up @@ -318,6 +321,7 @@ ModemClass::ParseResult ModemClass::buf_read(const string &prompt, string &data_
if(c == '\n') {
state = at_parse_state_t::Res;
}
/* fall through */

/*
* break is volountary not present, to cover for cases where the response status is in the
Expand Down
1 change: 0 additions & 1 deletion libraries/WiFiS3/src/WiFi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const char* CWifi::firmwareVersion() {
/* -------------------------------------------------------------------------- */
uint32_t CWifi::firmwareVersionU32() {
/* -------------------------------------------------------------------------- */
uint8_t ret[4];
string res = "";
modem.begin();
if(modem.write(string(PROMPT(_FWVERSION_U32)), res, CMD_READ(_FWVERSION_U32))) {
Expand Down
4 changes: 2 additions & 2 deletions libraries/WiFiS3/src/WiFiClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ int WiFiClient::_read() {

if(modem.write(string(PROMPT(_CLIENTRECEIVE)),res, "%s%d,%d\r\n" , CMD_WRITE(_CLIENTRECEIVE), _sock, size)) {
if(res.size() > 0) {
for(int i = 0, rv = 0; i < size && i < res.size(); i++) {
for(uint32_t i = 0, rv = 0; i < size && i < res.size(); i++) {
rx_buffer->store((uint8_t)res[i]);
rv++;
}
Expand Down Expand Up @@ -168,7 +168,7 @@ int WiFiClient::read(uint8_t *buf, size_t size) {
int rv = 0;
bool go_on = true;
if(_sock >= 0 && rx_buffer != nullptr) {
for(int i = 0; i < size && go_on; i++) {
for(size_t i = 0; i < size && go_on; i++) {
bool is_read = false;
*(buf+i) = rx_buffer->read(&is_read);
if(is_read) {
Expand Down
3 changes: 1 addition & 2 deletions libraries/WiFiS3/src/WiFiClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,13 @@ class WiFiClient : public Client {

protected:
int _sock;
bool destroy_at_distructor;
int _connectionTimeout = 0;
void getSocket();
static constexpr uint32_t RX_BUFFER_DIM = 1024;
std::shared_ptr<FifoBuffer<uint8_t,RX_BUFFER_DIM>> rx_buffer;
int _read();
void read_if_needed(size_t s);
bool destroy_at_distructor;


};

Expand Down
1 change: 1 addition & 0 deletions libraries/WiFiS3/src/WiFiFileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ size_t WiFiFileSystem::writefile(const char* name, const char* data, size_t size
if(modem.passthrough((uint8_t *)data, size)) {
return size;
}
return 0;
}

/* -------------------------------------------------------------------------- */
Expand Down
4 changes: 2 additions & 2 deletions libraries/WiFiS3/src/WiFiSSLClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ int WiFiSSLClient::_read() {
modem.read_using_size();
if(modem.write(string(PROMPT(_SSLCLIENTRECEIVE)),res, "%s%d,%d\r\n" , CMD_WRITE(_SSLCLIENTRECEIVE), _sock, size)) {
if(res.size() > 0) {
for(int i = 0, rv = 0; i < size && i < res.size(); i++) {
for(uint32_t i = 0, rv = 0; i < size && i < res.size(); i++) {
rx_buffer->store((uint8_t)res[i]);
rv++;
}
Expand Down Expand Up @@ -185,7 +185,7 @@ int WiFiSSLClient::read(uint8_t *buf, size_t size) {
read_if_needed(size);
int rv = 0;
bool go_on = true;
for(int i = 0; i < size && go_on; i++) {
for(size_t i = 0; i < size && go_on; i++) {
bool is_read = false;
*(buf+i) = rx_buffer->read(&is_read);
if(is_read) {
Expand Down
4 changes: 2 additions & 2 deletions libraries/WiFiS3/src/WiFiUdp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ int WiFiUDP::_read() {
modem.read_using_size();
if(modem.write(string(PROMPT(_UDPREAD)),res, "%s%d,%d\r\n" , CMD_WRITE(_UDPREAD), _sock, size)) {
if(res.size() > 0) {
for(int i = 0, rv = 0; i < size && i < res.size(); i++) {
for(uint32_t i = 0, rv = 0; i < size && i < res.size(); i++) {
rx_buffer.store((uint8_t)res[i]);
rv++;
}
Expand Down Expand Up @@ -218,7 +218,7 @@ int WiFiUDP::read(unsigned char* buf, size_t size) {
read_if_needed(size);
int rv = 0;
bool go_on = true;
for(int i = 0; i < size && go_on; i++) {
for(size_t i = 0; i < size && go_on; i++) {
bool is_read = false;
*(buf+i) = rx_buffer.read(&is_read);
if(is_read) {
Expand Down

0 comments on commit 04d998d

Please sign in to comment.