[PATCH] lib: fwts_checksum: object sizes should be size_t rather than int

Colin King colin.king at canonical.com
Fri Sep 8 09:33:02 UTC 2017


From: Colin Ian King <colin.king at canonical.com>

Checksum lengths should be on size_t sizes rather than ints.

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/lib/include/fwts_checksum.h | 2 +-
 src/lib/src/fwts_checksum.c     | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/lib/include/fwts_checksum.h b/src/lib/include/fwts_checksum.h
index 6aa21359..f1a6626f 100644
--- a/src/lib/include/fwts_checksum.h
+++ b/src/lib/include/fwts_checksum.h
@@ -22,6 +22,6 @@
 
 #include "fwts.h"
 
-uint8_t fwts_checksum(const uint8_t *data, const int length);
+uint8_t fwts_checksum(const uint8_t *data, const size_t length);
 
 #endif
diff --git a/src/lib/src/fwts_checksum.c b/src/lib/src/fwts_checksum.c
index 27ab8820..f7760a99 100644
--- a/src/lib/src/fwts_checksum.c
+++ b/src/lib/src/fwts_checksum.c
@@ -23,9 +23,9 @@
  *  fwts_checksum()
  *	checksum a uint8_t * buffer
  */
-uint8_t fwts_checksum(const uint8_t *data, const int length)
+uint8_t fwts_checksum(const uint8_t *data, const size_t length)
 {
-	int 	i;
+	size_t i;
 	uint8_t checksum = 0;
 
 	for (i = 0; i < length; i++)
-- 
2.14.1




More information about the fwts-devel mailing list