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-oop57-cpp,
-cert-str34-c, -cert-str34-c,
-clang-analyzer-core.CallAndMessage, -clang-analyzer-core.CallAndMessage,
-clang-analyzer-deadcode.DeadStores,
-clang-analyzer-optin.*, -clang-analyzer-optin.*,
-clang-analyzer-osx.*, -clang-analyzer-osx.*,
-clang-analyzer-security.*, -clang-analyzer-security.*,
-clang-diagnostic-fortify-source,
-clang-diagnostic-shadow-field, -clang-diagnostic-shadow-field,
-cppcoreguidelines-avoid-c-arrays, -cppcoreguidelines-avoid-c-arrays,
-cppcoreguidelines-avoid-goto, -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 SPIAS3935Component::read_register(uint8_t reg) {
uint8_t value = 0; uint8_t value = 0;
this->enable(); this->enable();
this->write_byte(reg |= SPI_READ_M); this->write_byte(reg | SPI_READ_M);
value = this->read_byte(); value = this->read_byte();
// According to datsheet, the chip select must be written HIGH, LOW, HIGH // According to datsheet, the chip select must be written HIGH, LOW, HIGH
// to correctly end the READ command. // 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.length = raw[2];
data.protocol = raw[3]; data.protocol = raw[3];
char next_byte[2]; char next_byte[3];
for (uint8_t i = 0; i < data.length - 1; i++) { for (uint8_t i = 0; i < data.length - 1; i++) {
sprintf(next_byte, "%02X", raw[4 + i]); sprintf(next_byte, "%02X", raw[4 + i]);
data.code += next_byte; data.code += next_byte;
@ -85,7 +85,7 @@ bool RFBridgeComponent::parse_bridge_byte_(uint8_t byte) {
uint8_t buckets = raw[2] << 1; uint8_t buckets = raw[2] << 1;
std::string str; std::string str;
char next_byte[2]; char next_byte[3];
for (uint32_t i = 0; i <= at; i++) { for (uint32_t i = 0; i <= at; i++) {
sprintf(next_byte, "%02X", raw[i]); sprintf(next_byte, "%02X", raw[i]);