[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 // check repeater configuration
if(!(((repeaterCallsigns == NULL) && (repeaterSSIDs == NULL) && (numRepeaters == 0)) || if((repeaterCallsigns == NULL) || (repeaterSSIDs == NULL)) {
((repeaterCallsigns != NULL) && (repeaterSSIDs != NULL) && (numRepeaters != 0)))) {
return(ERR_INVALID_NUM_REPEATERS); return(ERR_INVALID_NUM_REPEATERS);
} }
for(uint16_t i = 0; i < numRepeaters; i++) { 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/ https://creativecommons.org/licenses/by-sa/4.0/
*/ */
uint16_t AX25Client::getFrameCheckSequence(uint8_t* buff, size_t len) { uint16_t AX25Client::getFrameCheckSequence(uint8_t* buff, size_t len) {
uint8_t outBit = 0; uint8_t outBit;
uint16_t mask = 0x0000; uint16_t mask;
uint16_t shiftReg = CRC_CCITT_INIT; uint16_t shiftReg = CRC_CCITT_INIT;
for(size_t i = 0; i < len; i++) { 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. \param phy Pointer to the wireless module providing PhysicalLayer communication.
*/ */
AX25Client(PhysicalLayer* phy); explicit AX25Client(PhysicalLayer* phy);
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !defined(RADIOLIB_EXCLUDE_AFSK)
/*! /*!
@ -274,7 +274,7 @@ class AX25Client {
\param audio Pointer to the AFSK instance providing audio. \param audio Pointer to the AFSK instance providing audio.
*/ */
AX25Client(AFSKClient* audio); explicit AX25Client(AFSKClient* audio);
#endif #endif
// basic methods // basic methods
@ -324,13 +324,13 @@ class AX25Client {
void* _audio; void* _audio;
#endif #endif
char _srcCallsign[AX25_MAX_CALLSIGN_LEN + 1]; char _srcCallsign[AX25_MAX_CALLSIGN_LEN + 1] = {0, 0, 0, 0, 0, 0, 0};
uint8_t _srcSSID; uint8_t _srcSSID = 0;
uint16_t _preambleLen; uint16_t _preambleLen = 0;
uint16_t getFrameCheckSequence(uint8_t* buff, size_t len); static uint16_t getFrameCheckSequence(uint8_t* buff, size_t len);
uint8_t flipBits(uint8_t b); static uint8_t flipBits(uint8_t b);
uint16_t flipBits16(uint16_t i); static uint16_t flipBits16(uint16_t i);
}; };
#endif #endif