cppchecker overflow integer warning

This commit is contained in:
iceman1001 2021-03-05 10:21:25 +01:00
commit 928c0e4162

View file

@ -41,7 +41,7 @@
// defaults to 2000ms // defaults to 2000ms
#ifndef FWT_TIMEOUT_14B #ifndef FWT_TIMEOUT_14B
# define FWT_TIMEOUT_14B 35312 # define FWT_TIMEOUT_14B 35312U
#endif #endif
// 1 tick == 1/13.56 mhz // 1 tick == 1/13.56 mhz
@ -178,7 +178,7 @@ static void CodeIso14443bAsTag(const uint8_t *cmd, int len) {
// Send TR1. // Send TR1.
// 10-11 ETU * 4times samples ONES // 10-11 ETU * 4times samples ONES
for (i = 0; i < 20; i++) { for (i = 0; i < 10; i++) {
SEND4STUFFBIT(1); SEND4STUFFBIT(1);
} }
@ -321,7 +321,7 @@ static void Demod14bInit(uint8_t *data, uint16_t max_len) {
* @param timeout is in frame wait time, fwt, measured in ETUs * @param timeout is in frame wait time, fwt, measured in ETUs
*/ */
static void iso14b_set_timeout(uint32_t timeout) { static void iso14b_set_timeout(uint32_t timeout) {
#define MAX_TIMEOUT 40542464 // 13560000Hz * 1000ms / (2^32-1) * (8*16) #define MAX_TIMEOUT 40542464U // 13560000Hz * 1000ms / (2^32-1) * (8*16)
if (timeout > MAX_TIMEOUT) if (timeout > MAX_TIMEOUT)
timeout = MAX_TIMEOUT; timeout = MAX_TIMEOUT;