summaryrefslogtreecommitdiffstats
path: root/print.c
diff options
context:
space:
mode:
authorNico Huber <nico.h@gmx.de>2018-12-23 20:03:35 +0100
committerNico Huber <nico.h@gmx.de>2019-07-31 08:26:59 +0000
commit519be66fc59558971dd653afe69ccaf1a633b492 (patch)
tree74f0912de156a86d56111f377db080246e5205e9 /print.c
parentef78de4a21323b8c459337356289218211f2c5ce (diff)
downloadflashrom-519be66fc59558971dd653afe69ccaf1a633b492.tar.gz
flashrom-519be66fc59558971dd653afe69ccaf1a633b492.tar.bz2
flashrom-519be66fc59558971dd653afe69ccaf1a633b492.zip
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>
Diffstat (limited to 'print.c')
-rw-r--r--print.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/print.c b/print.c
index cfe6267b6..2901c5012 100644
--- a/print.c
+++ b/print.c
@@ -19,6 +19,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include <stddef.h>
#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));