obmc-console: Clean up invalid sign comparisons
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I83fae6857620ca2913952bea597c1299dd962620
diff --git a/console-socket.c b/console-socket.c
index b0cd452..461f151 100644
--- a/console-socket.c
+++ b/console-socket.c
@@ -43,7 +43,7 @@
if (rc < 0)
return rc;
- if (rc > (sizeof(addr->sun_path) - 1)) {
+ if ((size_t)rc > (sizeof(addr->sun_path) - 1)) {
errno = 0;
return -1;
}
diff --git a/log-handler.c b/log-handler.c
index 6d31be6..b1128cd 100644
--- a/log-handler.c
+++ b/log-handler.c
@@ -37,7 +37,7 @@
int fd;
size_t size;
size_t maxsize;
- int pagesize;
+ size_t pagesize;
char *log_filename;
char *rotate_filename;
};
diff --git a/test/ringbuffer-test-utils.c b/test/ringbuffer-test-utils.c
index c489f9d..bbe688a 100644
--- a/test/ringbuffer-test-utils.c
+++ b/test/ringbuffer-test-utils.c
@@ -69,7 +69,8 @@
void ringbuffer_dump(struct ringbuffer *rb)
{
struct ringbuffer_consumer *rbc;
- int i, j;
+ size_t i;
+ int j;
printf("---- ringbuffer (%d consumer%s)\n", rb->n_consumers,
rb->n_consumers == 1 ? "" : "s");
diff --git a/test/test-client-escape.c b/test/test-client-escape.c
index 921009c..6567024 100644
--- a/test/test-client-escape.c
+++ b/test/test-client-escape.c
@@ -33,7 +33,7 @@
struct str_esc_state str;
} esc_state;
const char *in[4];
- int n_in;
+ size_t n_in;
const char *exp_out;
int exp_rc;
};
@@ -42,8 +42,8 @@
struct console_client client;
struct test *test;
uint8_t out[4096];
- int cur_in;
- int cur_out;
+ size_t cur_in;
+ size_t cur_out;
};
@@ -219,7 +219,7 @@
int main(void)
{
- int i;
+ size_t i;
for (i = 0; i < ARRAY_SIZE(tests); i++)
run_one_test(i, &tests[i], &ctxs[i]);
diff --git a/test/test-config-parse-logsize.c b/test/test-config-parse-logsize.c
index 157401a..49aef3a 100644
--- a/test/test-config-parse-logsize.c
+++ b/test/test-config-parse-logsize.c
@@ -40,14 +40,15 @@
const size_t num_tests = sizeof(test_data) /
sizeof(struct test_parse_size_unit);
size_t size;
- int i, rc;
+ size_t i;
+ int rc;
for (i = 0; i < num_tests; i++) {
rc = config_parse_logsize(test_data[i].test_str, &size);
if ((rc == -1 && rc != test_data[i].expected_rc) ||
(rc == 0 && test_data[i].expected_size != size)) {
- warn("[%d] Str %s expected size %lu rc %d,"
+ warn("[%zu] Str %s expected size %lu rc %d,"
" got size %lu rc %d\n",
i,
test_data[i].test_str,
diff --git a/test/test-ringbuffer-contained-offset-read.c b/test/test-ringbuffer-contained-offset-read.c
index 5e41c6a..7490f01 100644
--- a/test/test-ringbuffer-contained-offset-read.c
+++ b/test/test-ringbuffer-contained-offset-read.c
@@ -12,7 +12,8 @@
struct ringbuffer_consumer *rbc;
struct ringbuffer *rb;
size_t len;
- int rc, i;
+ size_t i;
+ int rc;
rb = ringbuffer_init(10);
rbc = ringbuffer_consumer_register(rb, ringbuffer_poll_nop, NULL);