1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-18 23:03:34 +03:00

Remove warnings, errors during host tests in CI (#8358)

* Remove warnings, errors during host tests in CI

Debug strings often included format parameters which did not exactly match
the passed in format parameters, resulting in warnings in the host test build
process like
````
/home/runner/work/Arduino/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp:107:20: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 3 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
  107 |         DEBUG_WIFI("[AP] SSID length %u, too long or missing!\n", ssid_len);
      |                                                                   ~~~~~~~~
      |                                                                   |
      |                                                                   size_t {aka long unsigned int}
````

Fix by applying casting or PRxxx macros as appropriate.

Also, fix one debug message which was trying to use a `String` as a `char *`:
````
/home/runner/work/Arduino/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiMulti.cpp: In member function ‘wl_status_t ESP8266WiFiMulti::connectWiFiMulti(uint32_t)’:
/home/runner/work/Arduino/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiMulti.cpp:331:34: warning: format ‘%s’ expects argument of type ‘char*’, but argument 3 has type ‘String’ [-Wformat=]
  331 |                 DEBUG_WIFI_MULTI("[WIFIM] Connecting %s\n", ssid);
````

* Clean up SpeedTest.ino host build
This commit is contained in:
Earle F. Philhower, III
2021-11-02 14:41:03 -07:00
committed by GitHub
parent 3f5a76cc26
commit 7d971fa45b
12 changed files with 21 additions and 21 deletions

View File

@ -75,12 +75,12 @@ void ESP8266WiFiClass::printDiag(Print& p) {
char ssid[33]; //ssid can be up to 32chars, => plus null term
memcpy(ssid, conf.ssid, sizeof(conf.ssid));
ssid[32] = 0; //nullterm in case of 32 char ssid
p.printf_P(PSTR("SSID (%d): %s\n"), strlen(ssid), ssid);
p.printf_P(PSTR("SSID (%zu): %s\n"), strlen(ssid), ssid);
char passphrase[65];
memcpy(passphrase, conf.password, sizeof(conf.password));
passphrase[64] = 0;
p.printf_P(PSTR("Passphrase (%d): %s\n"), strlen(passphrase), passphrase);
p.printf_P(PSTR("Passphrase (%zu): %s\n"), strlen(passphrase), passphrase);
p.print(F("BSSID set: "));
p.println(conf.bssid_set);

View File

@ -104,13 +104,13 @@ bool ESP8266WiFiAPClass::softAP(const char* ssid, const char* psk, int channel,
size_t ssid_len = ssid ? strlen(ssid) : 0;
if(ssid_len == 0 || ssid_len > 32) {
DEBUG_WIFI("[AP] SSID length %u, too long or missing!\n", ssid_len);
DEBUG_WIFI("[AP] SSID length %zu, too long or missing!\n", ssid_len);
return false;
}
size_t psk_len = psk ? strlen(psk) : 0;
if(psk_len > 0 && (psk_len > 64 || psk_len < 8)) {
DEBUG_WIFI("[AP] fail psk length %u, too long or short!\n", psk_len);
DEBUG_WIFI("[AP] fail psk length %zu, too long or short!\n", psk_len);
return false;
}

View File

@ -328,7 +328,7 @@ wl_status_t ESP8266WiFiMulti::connectWiFiMulti(uint32_t connectTimeoutMs)
// Check SSID
if (ssid == entry.ssid) {
DEBUG_WIFI_MULTI("[WIFIM] Connecting %s\n", ssid);
DEBUG_WIFI_MULTI("[WIFIM] Connecting %s\n", ssid.c_str());
// Connect to WiFi
WiFi.begin(ssid, entry.passphrase, channel, bssid);
@ -361,7 +361,7 @@ wl_status_t ESP8266WiFiMulti::connectWiFiMulti(uint32_t connectTimeoutMs)
}
}
DEBUG_WIFI_MULTI("[WIFIM] Could not connect\n", ssid);
DEBUG_WIFI_MULTI("[WIFIM] Could not connect\n");
// Could not connect to any WiFi network
return WL_CONNECT_FAILED;