[CRC] Fixed issues found by cppcheck
This commit is contained in:
parent
356e8c8546
commit
330f4e8fe1
2 changed files with 8 additions and 8 deletions
|
@ -4,7 +4,7 @@ RadioLibCRC::RadioLibCRC() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t RadioLibCRC::checksum(uint8_t* buff, size_t len) {
|
uint32_t RadioLibCRC::checksum(const uint8_t* buff, size_t len) {
|
||||||
uint32_t crc = this->init;
|
uint32_t crc = this->init;
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
for(size_t i = 0; i < 8*len; i++) {
|
for(size_t i = 0; i < 8*len; i++) {
|
||||||
|
|
|
@ -21,32 +21,32 @@ class RadioLibCRC {
|
||||||
/*!
|
/*!
|
||||||
\brief CRC size in bits.
|
\brief CRC size in bits.
|
||||||
*/
|
*/
|
||||||
uint8_t size;
|
uint8_t size = 8;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief CRC polynomial.
|
\brief CRC polynomial.
|
||||||
*/
|
*/
|
||||||
uint32_t poly;
|
uint32_t poly = 0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Initial value.
|
\brief Initial value.
|
||||||
*/
|
*/
|
||||||
uint32_t init;
|
uint32_t init = 0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Final XOR value.
|
\brief Final XOR value.
|
||||||
*/
|
*/
|
||||||
uint32_t out;
|
uint32_t out = 0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Whether to reflect input bytes.
|
\brief Whether to reflect input bytes.
|
||||||
*/
|
*/
|
||||||
bool refIn;
|
bool refIn = false;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Whether to reflect the result.
|
\brief Whether to reflect the result.
|
||||||
*/
|
*/
|
||||||
bool refOut;
|
bool refOut = false;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Default constructor.
|
\brief Default constructor.
|
||||||
|
@ -59,7 +59,7 @@ class RadioLibCRC {
|
||||||
\param len Size of the buffer in bytes.
|
\param len Size of the buffer in bytes.
|
||||||
\returns The resulting checksum.
|
\returns The resulting checksum.
|
||||||
*/
|
*/
|
||||||
uint32_t checksum(uint8_t* buff, size_t len);
|
uint32_t checksum(const uint8_t* buff, size_t len);
|
||||||
};
|
};
|
||||||
|
|
||||||
// the global singleton
|
// the global singleton
|
||||||
|
|
Loading…
Add table
Reference in a new issue