From 519be66fc59558971dd653afe69ccaf1a633b492 Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Sun, 23 Dec 2018 20:03:35 +0100 Subject: 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 Reviewed-on: https://review.coreboot.org/c/flashrom/+/30409 Tested-by: build bot (Jenkins) Reviewed-by: Jacob Garber --- print.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'print.c') diff --git a/print.c b/print.c index cfe6267b6..2901c5012 100644 --- a/print.c +++ b/print.c @@ -19,6 +19,7 @@ #include #include #include +#include #include "flash.h" #include "programmer.h" @@ -314,20 +315,20 @@ static int print_supported_chips(void) #if CONFIG_INTERNAL == 1 static void print_supported_chipsets(void) { - int i, chipsetcount = 0; + unsigned int i, chipsetcount = 0; const struct penable *c = chipset_enables; - int maxvendorlen = strlen("Vendor") + 1; - int maxchipsetlen = strlen("Chipset") + 1; + size_t maxvendorlen = strlen("Vendor") + 1; + size_t maxchipsetlen = strlen("Chipset") + 1; for (c = chipset_enables; c->vendor_name != NULL; c++) { chipsetcount++; - maxvendorlen = max(maxvendorlen, strlen(c->vendor_name)); - maxchipsetlen = max(maxchipsetlen, strlen(c->device_name)); + maxvendorlen = MAX(maxvendorlen, strlen(c->vendor_name)); + maxchipsetlen = MAX(maxchipsetlen, strlen(c->device_name)); } maxvendorlen++; maxchipsetlen++; - msg_ginfo("Supported chipsets (total: %d):\n\n", chipsetcount); + msg_ginfo("Supported chipsets (total: %u):\n\n", chipsetcount); msg_ginfo("Vendor"); for (i = strlen("Vendor"); i < maxvendorlen; i++) @@ -354,12 +355,12 @@ static void print_supported_chipsets(void) static void print_supported_boards_helper(const struct board_info *boards, const char *devicetype) { - int i; + unsigned int i; unsigned int boardcount_good = 0, boardcount_bad = 0, boardcount_nt = 0; const struct board_match *e = board_matches; const struct board_info *b = boards; - int maxvendorlen = strlen("Vendor") + 1; - int maxboardlen = strlen("Board") + 1; + size_t maxvendorlen = strlen("Vendor") + 1; + size_t maxboardlen = strlen("Board") + 1; for (b = boards; b->vendor != NULL; b++) { maxvendorlen = max(maxvendorlen, strlen(b->vendor)); -- cgit v1.2.3