[AX25] Fixes from cppcheck scan

This commit is contained in:
jgromes 2020-07-04 15:23:57 +02:00
parent 75f2db6509
commit 36d4167161
2 changed files with 11 additions and 12 deletions

View file

@ -74,8 +74,7 @@ int16_t AX25Frame::setRepeaters(char** repeaterCallsigns, uint8_t* repeaterSSIDs
}
// check repeater configuration
if(!(((repeaterCallsigns == NULL) && (repeaterSSIDs == NULL) && (numRepeaters == 0)) ||
((repeaterCallsigns != NULL) && (repeaterSSIDs != NULL) && (numRepeaters != 0)))) {
if((repeaterCallsigns == NULL) || (repeaterSSIDs == NULL)) {
return(ERR_INVALID_NUM_REPEATERS);
}
for(uint16_t i = 0; i < numRepeaters; i++) {
@ -390,8 +389,8 @@ int16_t AX25Client::sendFrame(AX25Frame* frame) {
https://creativecommons.org/licenses/by-sa/4.0/
*/
uint16_t AX25Client::getFrameCheckSequence(uint8_t* buff, size_t len) {
uint8_t outBit = 0;
uint16_t mask = 0x0000;
uint8_t outBit;
uint16_t mask;
uint16_t shiftReg = CRC_CCITT_INIT;
for(size_t i = 0; i < len; i++) {

View file

@ -266,7 +266,7 @@ class AX25Client {
\param phy Pointer to the wireless module providing PhysicalLayer communication.
*/
AX25Client(PhysicalLayer* phy);
explicit AX25Client(PhysicalLayer* phy);
#if !defined(RADIOLIB_EXCLUDE_AFSK)
/*!
@ -274,7 +274,7 @@ class AX25Client {
\param audio Pointer to the AFSK instance providing audio.
*/
AX25Client(AFSKClient* audio);
explicit AX25Client(AFSKClient* audio);
#endif
// basic methods
@ -324,13 +324,13 @@ class AX25Client {
void* _audio;
#endif
char _srcCallsign[AX25_MAX_CALLSIGN_LEN + 1];
uint8_t _srcSSID;
uint16_t _preambleLen;
char _srcCallsign[AX25_MAX_CALLSIGN_LEN + 1] = {0, 0, 0, 0, 0, 0, 0};
uint8_t _srcSSID = 0;
uint16_t _preambleLen = 0;
uint16_t getFrameCheckSequence(uint8_t* buff, size_t len);
uint8_t flipBits(uint8_t b);
uint16_t flipBits16(uint16_t i);
static uint16_t getFrameCheckSequence(uint8_t* buff, size_t len);
static uint8_t flipBits(uint8_t b);
static uint16_t flipBits16(uint16_t i);
};
#endif