Fix -Wsign-compare trouble
Mostly by changing to `unsigned` types where applicable, sometimes
`signed` types, and casting as a last resort.
Change-Id: I08895543ffb7a48058bcf91ef6500ca113f2d305
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/30409
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Jacob Garber <jgarber1@ualberta.ca>
diff --git a/fmap.c b/fmap.c
index 31f282f..ca25651 100644
--- a/fmap.c
+++ b/fmap.c
@@ -96,7 +96,7 @@
off_t offset;
bool fmap_found = 0;
- for (offset = 0; offset <= len - sizeof(struct fmap); offset++) {
+ for (offset = 0; offset <= (off_t)(len - sizeof(struct fmap)); offset++) {
if (is_valid_fmap((struct fmap *)&buf[offset])) {
fmap_found = 1;
break;
@@ -178,7 +178,7 @@
}
static int fmap_bsearch_rom(struct fmap **fmap_out, struct flashctx *const flashctx,
- size_t rom_offset, size_t len, int min_stride)
+ size_t rom_offset, size_t len, size_t min_stride)
{
size_t stride, fmap_len = 0;
int ret = 1, fmap_found = 0, check_offset_0 = 1;