1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-12 00:02:21 +01:00

Activate some clang-tidy checks (#1884)

This commit is contained in:
Otto Winter
2021-06-10 13:04:40 +02:00
committed by GitHub
parent eb9bd69405
commit 360effcb72
109 changed files with 458 additions and 422 deletions

View File

@@ -200,7 +200,7 @@ bool WiFiComponent::wifi_apply_hostname_() {
return ret;
}
bool WiFiComponent::wifi_sta_connect_(WiFiAP ap) {
bool WiFiComponent::wifi_sta_connect_(const WiFiAP &ap) {
// enable STA
if (!this->wifi_mode_(true, {}))
return false;
@@ -209,8 +209,8 @@ bool WiFiComponent::wifi_sta_connect_(WiFiAP ap) {
struct station_config conf {};
memset(&conf, 0, sizeof(conf));
strcpy(reinterpret_cast<char *>(conf.ssid), ap.get_ssid().c_str());
strcpy(reinterpret_cast<char *>(conf.password), ap.get_password().c_str());
strncpy(reinterpret_cast<char *>(conf.ssid), ap.get_ssid().c_str(), sizeof(conf.ssid));
strncpy(reinterpret_cast<char *>(conf.password), ap.get_password().c_str(), sizeof(conf.password));
if (ap.get_bssid().has_value()) {
conf.bssid_set = 1;
@@ -688,7 +688,7 @@ bool WiFiComponent::wifi_start_ap_(const WiFiAP &ap) {
return false;
struct softap_config conf {};
strcpy(reinterpret_cast<char *>(conf.ssid), ap.get_ssid().c_str());
strncpy(reinterpret_cast<char *>(conf.ssid), ap.get_ssid().c_str(), sizeof(conf.ssid));
conf.ssid_len = static_cast<uint8>(ap.get_ssid().size());
conf.channel = ap.get_channel().value_or(1);
conf.ssid_hidden = ap.get_hidden();
@@ -700,7 +700,7 @@ bool WiFiComponent::wifi_start_ap_(const WiFiAP &ap) {
*conf.password = 0;
} else {
conf.authmode = AUTH_WPA2_PSK;
strcpy(reinterpret_cast<char *>(conf.password), ap.get_password().c_str());
strncpy(reinterpret_cast<char *>(conf.password), ap.get_password().c_str(), sizeof(conf.password));
}
ETS_UART_INTR_DISABLE();