Cpp-check warnings cleanup (#3014)

* cpp-check warnings cleanup

* Supressions and more fixes
pull/3015/head^2
Ben Meadors 2023-12-14 07:35:46 -06:00 zatwierdzone przez GitHub
rodzic 9f85279e74
commit 4720b2874f
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
9 zmienionych plików z 16 dodań i 15 usunięć

Wyświetl plik

@ -42,7 +42,7 @@ namespace concurrency
class AccelerometerThread : public concurrency::OSThread
{
public:
AccelerometerThread(ScanI2C::DeviceType type = ScanI2C::DeviceType::NONE) : OSThread("AccelerometerThread")
explicit AccelerometerThread(ScanI2C::DeviceType type) : OSThread("AccelerometerThread")
{
if (accelerometer_found.port == ScanI2C::I2CPort::NO_I2C) {
LOG_DEBUG("AccelerometerThread disabling due to no sensors found\n");

Wyświetl plik

@ -10,7 +10,7 @@ namespace concurrency
class AmbientLightingThread : public concurrency::OSThread
{
public:
AmbientLightingThread(ScanI2C::DeviceType type) : OSThread("AmbientLightingThread")
explicit AmbientLightingThread(ScanI2C::DeviceType type) : OSThread("AmbientLightingThread")
{
// Uncomment to test module
// moduleConfig.ambient_lighting.led_state = true;

Wyświetl plik

@ -402,11 +402,8 @@ bool Power::analogInit()
*/
bool Power::setup()
{
bool found = axpChipInit();
bool found = axpChipInit() || analogInit();
if (!found) {
found = analogInit();
}
enabled = found;
low_voltage_counter = 0;

Wyświetl plik

@ -21,7 +21,7 @@ class PowerFSMThread : public OSThread
/// If we are in power state we force the CPU to wake every 10ms to check for serial characters (we don't yet wake
/// cpu for serial rx - FIXME)
const auto state = powerFSM.getState();
const State *state = powerFSM.getState();
canSleep = (state != &statePOWER) && (state != &stateSERIAL);
if (powerStatus->getHasUSB()) {

Wyświetl plik

@ -184,7 +184,7 @@ void Channels::onConfigChanged()
{
// Make sure the phone hasn't mucked anything up
for (int i = 0; i < channelFile.channels_count; i++) {
meshtastic_Channel &ch = fixupChannel(i);
const meshtastic_Channel &ch = fixupChannel(i);
if (ch.role == meshtastic_Channel_Role_PRIMARY)
primaryIndex = i;

Wyświetl plik

@ -39,10 +39,11 @@
*/
char *strnstr(const char *s, const char *find, size_t slen)
{
char c, sc;
size_t len;
char c;
if ((c = *find++) != '\0') {
char sc;
size_t len;
len = strlen(find);
do {
do {

Wyświetl plik

@ -118,7 +118,7 @@ uint32_t NeighborInfoModule::collectNeighborInfo(meshtastic_NeighborInfo *neighb
int num_neighbors = cleanUpNeighbors();
for (int i = 0; i < num_neighbors; i++) {
meshtastic_Neighbor *dbEntry = getNeighborByIndex(i);
const meshtastic_Neighbor *dbEntry = getNeighborByIndex(i);
if ((neighborInfo->neighbors_count < MAX_NUM_NEIGHBORS) && (dbEntry->node_id != my_node_id)) {
neighborInfo->neighbors[neighborInfo->neighbors_count].node_id = dbEntry->node_id;
neighborInfo->neighbors[neighborInfo->neighbors_count].snr = dbEntry->snr;
@ -146,7 +146,7 @@ size_t NeighborInfoModule::cleanUpNeighbors()
// Find neighbors to remove
std::vector<int> indices_to_remove;
for (int i = 0; i < num_neighbors; i++) {
meshtastic_Neighbor *dbEntry = getNeighborByIndex(i);
const meshtastic_Neighbor *dbEntry = getNeighborByIndex(i);
// We will remove a neighbor if we haven't heard from them in twice the broadcast interval
if ((now - dbEntry->last_rx_time > dbEntry->node_broadcast_interval_secs * 2) && (dbEntry->node_id != my_node_id)) {
indices_to_remove.push_back(i);

Wyświetl plik

@ -519,10 +519,10 @@ std::string MQTT::meshPacketToJson(meshtastic_MeshPacket *mp)
// the created jsonObj is immutable after creation, so
// we need to do the heavy lifting before assembling it.
std::string msgType;
JSONObject msgPayload;
JSONObject jsonObj;
if (mp->which_payload_variant == meshtastic_MeshPacket_decoded_tag) {
JSONObject msgPayload;
switch (mp->decoded.portnum) {
case meshtastic_PortNum_TEXT_MESSAGE_APP: {
msgType = "text";

Wyświetl plik

@ -50,4 +50,7 @@ virtualCallInConstructor
passedByValue:*/RedirectablePrint.h
internalAstError:*/CrossPlatformCryptoEngine.cpp
uninitMemberVar:*/AudioThread.h
uninitMemberVar:*/AudioThread.h
// False positive
constVariableReference:*/Channels.cpp
constParameterPointer:*/unishox2.c