Fix Clang 11 finds (#1880)

This commit is contained in:
Stefan Agner 2021-06-08 22:47:43 +02:00 committed by GitHub
parent 0426be9280
commit b80f3fdec9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 5 deletions

View File

@ -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,

View File

@ -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.

View File

@ -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]);