From 5bed51e584c6bebdf2dc66ba319234250c8e6018 Mon Sep 17 00:00:00 2001 From: Masaki Muranaka Date: Sat, 9 Mar 2013 00:35:58 +0900 Subject: Don't use int. It decreases portability. Use size_t as array index and length. It avoids overflow in the extreme situations. --- src/crc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/crc.c') diff --git a/src/crc.c b/src/crc.c index 70fa60dfb..db852f6cb 100644 --- a/src/crc.c +++ b/src/crc.c @@ -18,9 +18,10 @@ #define CRC_CARRY_BIT (1 << 24) uint16_t -calc_crc_16_ccitt(const uint8_t *src, uint32_t nbytes, uint16_t crc) +calc_crc_16_ccitt(const uint8_t *src, size_t nbytes, uint16_t crc) { - uint32_t ibyte, ibit; + size_t ibyte; + uint32_t ibit; uint32_t crcwk = crc << 8; for (ibyte = 0; ibyte < nbytes; ibyte++) { -- cgit v1.2.3