supress cppcheck false warnings

This commit is contained in:
Nicu Hodos 2025-10-08 17:24:54 +02:00
parent 55213b9e87
commit ecac0a3d81
3 changed files with 6 additions and 7 deletions

View File

@ -25,7 +25,7 @@ struct PollinSwitch : Switch {
: Switch(nullptr, [group, channel]{
// copy id from string into a new pointer, to avoid memory leaks
return (new string{Protocol_1::buildId(group, channel)})->c_str();
}()), group(group), channel(channel) {
}()), group(group), channel(channel) { // cppcheck-suppress [selfInitialization]
if (!name) name = (new string{string(man).append(" ").append(id)})->c_str();
mainDevice = &DeviceConfig::create(id).withName(name).withManufacturer(man).withArea(area).withParent(gatewayDevice);
withStateTopic();
@ -41,8 +41,8 @@ struct PollinSwitch : Switch {
};
struct EasyHomeSwitch : Switch {
uint32_t on[8] = { 4326554, 4537114, 4767530, 4972714 };
uint32_t off[8] = { 4483146, 4626810, 4661562, 4819642 };
uint32_t on[8] = { 4326554, 4537114, 4767530, 4972714, 0, 0, 0, 0 };
uint32_t off[8] = { 4483146, 4626810, 4661562, 4819642, 0, 0, 0, 0 };
EasyHomeSwitch(const char remotePosition, uint32_t on[4], uint32_t off[4], const char* name = nullptr, const char* area = nullptr)
: Switch(nullptr, [remotePosition] {
@ -50,8 +50,8 @@ struct EasyHomeSwitch : Switch {
(*uId) += tolower(remotePosition);
return uId->c_str();
}()) {
memcpy(&this->on[4], on, 4 * sizeof(uint32_t));
memcpy(&this->off[4], off, 4 * sizeof(uint32_t));
memcpy(&this->on[4], on, 4 * sizeof(uint32_t)); // cppcheck-suppress [overlappingWriteFunction]
memcpy(&this->off[4], off, 4 * sizeof(uint32_t)); // cppcheck-suppress [overlappingWriteFunction]
if (!name) {
auto n = new string("Easy Home ");
(*n) += remotePosition;

View File

@ -21,7 +21,7 @@ lib_deps =
https://git.hodos.ro/libraries/serial-reader.git@^1.0.0
build_flags = -D DEBUG_RAW=0
check_tool = cppcheck
check_flags = --enable=all cppcheck: --suppress=*:*/.pio/*
check_flags = --enable=all cppcheck: --suppress=*:*/.pio/* --inline-suppr
check_skip_packages = yes
[env:huzzah]

View File

@ -1,4 +1,3 @@
#include <Arduino.h>
#include <RCSwitch.h>
#include <SerialReader.h>
#include "pins.h"