fix some cppcheck warnings

This commit is contained in:
Mike Kinney
2022-01-24 07:00:14 +00:00
parent 8a79ede285
commit b3210f6c2c
20 changed files with 82 additions and 45 deletions

View File

@@ -20,9 +20,9 @@ class CryptoEngine
{
protected:
/** Our per packet nonce */
uint8_t nonce[16];
uint8_t nonce[16] = {0};
CryptoKey key;
CryptoKey key = {};
public:
virtual ~CryptoEngine() {}

View File

@@ -45,7 +45,7 @@ class PhoneAPI
/// We temporarily keep the nodeInfo here between the call to available and getFromRadio
const NodeInfo *nodeInfoForPhone = NULL;
ToRadio toRadioScratch; // this is a static scratch object, any data must be copied elsewhere before returning
ToRadio toRadioScratch = {0}; // this is a static scratch object, any data must be copied elsewhere before returning
/// Use to ensure that clients don't get confused about old messages from the radio
uint32_t config_nonce = 0;
@@ -86,7 +86,7 @@ class PhoneAPI
protected:
/// Our fromradio packet while it is being assembled
FromRadio fromRadioScratch;
FromRadio fromRadioScratch = {};
/** the last msec we heard from the client on the other side of this link */
uint32_t lastContactMsec = 0;

View File

@@ -9,7 +9,7 @@
*/
class RF95Interface : public RadioLibInterface
{
RadioLibRF95 *lora; // Either a RFM95 or RFM96 depending on what was stuffed on this board
RadioLibRF95 *lora = NULL; // Either a RFM95 or RFM96 depending on what was stuffed on this board
public:
RF95Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, SPIClass &spi);
@@ -63,4 +63,4 @@ class RF95Interface : public RadioLibInterface
private:
/** Some boards require GPIO control of tx vs rx paths */
void setTransmitEnable(bool txon);
};
};

View File

@@ -95,7 +95,7 @@ class RadioLibInterface : public RadioInterface, protected concurrency::Notified
PhysicalLayer *iface;
/// are _trying_ to receive a packet currently (note - we might just be waiting for one)
bool isReceiving;
bool isReceiving = false;
public:
/** Our ISR code currently needs this to find our active instance
@@ -183,4 +183,4 @@ class RadioLibInterface : public RadioInterface, protected concurrency::Notified
virtual void addReceiveMetadata(MeshPacket *mp) = 0;
virtual void setStandby() = 0;
};
};

View File

@@ -35,7 +35,7 @@ class StreamAPI : public PhoneAPI, protected concurrency::OSThread
*/
Stream *stream;
uint8_t rxBuf[MAX_STREAM_BUF_SIZE];
uint8_t rxBuf[MAX_STREAM_BUF_SIZE] = {0};
size_t rxPtr = 0;
/// time of last rx, used, to slow down our polling if we haven't heard from anyone
@@ -81,5 +81,5 @@ class StreamAPI : public PhoneAPI, protected concurrency::OSThread
bool canWrite = true;
/// Subclasses can use this scratch buffer if they wish
uint8_t txBuf[MAX_STREAM_BUF_SIZE];
};
uint8_t txBuf[MAX_STREAM_BUF_SIZE] = {0};
};