From b80f3fdec93c50febde946ee7b742c091f1e93d0 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Tue, 8 Jun 2021 22:47:43 +0200 Subject: [PATCH] Fix Clang 11 finds (#1880) --- .clang-tidy | 2 -- esphome/components/as3935_spi/as3935_spi.cpp | 2 +- esphome/components/rf_bridge/rf_bridge.cpp | 4 ++-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index ceb51884a5..1202d12c27 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -20,11 +20,9 @@ Checks: >- -cert-oop57-cpp, -cert-str34-c, -clang-analyzer-core.CallAndMessage, - -clang-analyzer-deadcode.DeadStores, -clang-analyzer-optin.*, -clang-analyzer-osx.*, -clang-analyzer-security.*, - -clang-diagnostic-fortify-source, -clang-diagnostic-shadow-field, -cppcoreguidelines-avoid-c-arrays, -cppcoreguidelines-avoid-goto, diff --git a/esphome/components/as3935_spi/as3935_spi.cpp b/esphome/components/as3935_spi/as3935_spi.cpp index 73752a8ee0..54b52b2fd0 100644 --- a/esphome/components/as3935_spi/as3935_spi.cpp +++ b/esphome/components/as3935_spi/as3935_spi.cpp @@ -33,7 +33,7 @@ void SPIAS3935Component::write_register(uint8_t reg, uint8_t mask, uint8_t bits, uint8_t SPIAS3935Component::read_register(uint8_t reg) { uint8_t value = 0; this->enable(); - this->write_byte(reg |= SPI_READ_M); + this->write_byte(reg | SPI_READ_M); value = this->read_byte(); // According to datsheet, the chip select must be written HIGH, LOW, HIGH // to correctly end the READ command. diff --git a/esphome/components/rf_bridge/rf_bridge.cpp b/esphome/components/rf_bridge/rf_bridge.cpp index b284a969b1..a63523917a 100644 --- a/esphome/components/rf_bridge/rf_bridge.cpp +++ b/esphome/components/rf_bridge/rf_bridge.cpp @@ -67,7 +67,7 @@ bool RFBridgeComponent::parse_bridge_byte_(uint8_t byte) { data.length = raw[2]; data.protocol = raw[3]; - char next_byte[2]; + char next_byte[3]; for (uint8_t i = 0; i < data.length - 1; i++) { sprintf(next_byte, "%02X", raw[4 + i]); data.code += next_byte; @@ -85,7 +85,7 @@ bool RFBridgeComponent::parse_bridge_byte_(uint8_t byte) { uint8_t buckets = raw[2] << 1; std::string str; - char next_byte[2]; + char next_byte[3]; for (uint32_t i = 0; i <= at; i++) { sprintf(next_byte, "%02X", raw[i]);