From 4026cce22d330d3b9c4b218dd2e19d4f60412e05 Mon Sep 17 00:00:00 2001 From: Paul Selkirk Date: Wed, 11 Oct 2017 17:32:33 -0400 Subject: Cleanup: signed/unsigned mismatches, mostly in loop counters --- projects/hsm/hsm.c | 2 +- projects/hsm/mgmt-cli.c | 6 +++--- projects/hsm/mgmt-keystore.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'projects/hsm') diff --git a/projects/hsm/hsm.c b/projects/hsm/hsm.c index 800edcc..a36c64b 100644 --- a/projects/hsm/hsm.c +++ b/projects/hsm/hsm.c @@ -418,7 +418,7 @@ int main(void) /* Initialize the ibuf queues. */ memset(&ibuf_waiting, 0, sizeof(ibuf_waiting)); memset(&ibuf_ready, 0, sizeof(ibuf_ready)); - for (int i = 0; i < sizeof(ibufs)/sizeof(ibufs[0]); ++i) + for (size_t i = 0; i < sizeof(ibufs)/sizeof(ibufs[0]); ++i) ibuf_put(&ibuf_waiting, &ibufs[i]); /* Create the rpc dispatch worker tasks. */ diff --git a/projects/hsm/mgmt-cli.c b/projects/hsm/mgmt-cli.c index ec9bf8f..ab9cf44 100644 --- a/projects/hsm/mgmt-cli.c +++ b/projects/hsm/mgmt-cli.c @@ -64,8 +64,8 @@ static tcb_t *cli_task; #endif typedef struct { - int ridx; - volatile int widx; + unsigned ridx; + unsigned widx; mgmt_cli_dma_state_t rx_state; uint8_t buf[CLI_UART_RECVBUF_SIZE]; } ringbuf_t; @@ -116,7 +116,7 @@ static void uart_cli_print(struct cli_def *cli __attribute__ ((unused)), const c static ssize_t uart_cli_read(struct cli_def *cli __attribute__ ((unused)), void *buf, size_t count) { - for (int i = 0; i < count; ++i) { + for (size_t i = 0; i < count; ++i) { while (ringbuf_read_char(&uart_ringbuf, (uint8_t *)(buf + i)) == 0) task_sleep(); } diff --git a/projects/hsm/mgmt-keystore.c b/projects/hsm/mgmt-keystore.c index 0104265..9bd9dbf 100644 --- a/projects/hsm/mgmt-keystore.c +++ b/projects/hsm/mgmt-keystore.c @@ -205,7 +205,7 @@ static int show_keys(struct cli_def *cli, const char *title) if (!done) previous_uuid = uuids[sizeof(uuids)/sizeof(*uuids) - 1]; - for (int i = 0; i < n; i++) { + for (unsigned i = 0; i < n; i++) { if ((status = hal_uuid_format(&uuids[i], key_name, sizeof(key_name))) != LIBHAL_OK) { cli_print(cli, "Could not convert key name, skipping: %s", -- cgit v1.2.3