From 09b201101478e6e1c858fc4ef4f859d88a2b8a49 Mon Sep 17 00:00:00 2001 From: Alexey Kardashevskiy Date: Wed, 27 Jan 2021 19:38:12 +1100 Subject: libnvram: Compile with -Wextra -Wextra enables a bunch of rather useful checks which this fixes. Signed-off-by: Alexey Kardashevskiy --- lib/libnvram/envvar.c | 13 ++++++------- lib/libnvram/nvram.c | 13 ++++++------- lib/libnvram/nvram.h | 10 +++++----- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/lib/libnvram/envvar.c b/lib/libnvram/envvar.c index ee943fc..d413e97 100644 --- a/lib/libnvram/envvar.c +++ b/lib/libnvram/envvar.c @@ -46,7 +46,7 @@ static int get_past_env_pos(partition_t part, char *envvar, int evlen) * @param evlen string length of the envvar parameter * @return pointer to temporary string containing the value of envvar */ -char *nvram_get_env(partition_t part, char *envvar, int evlen) +char *nvram_get_env(partition_t part, char *envvar, unsigned evlen) { static char temp[256+1]; int len, offset; @@ -100,10 +100,9 @@ static int find_last_envvar(partition_t part) return -1; } -int nvram_add_env(partition_t part, char *envvar, int evlen, char *value, int vallen) +int nvram_add_env(partition_t part, char *envvar, unsigned evlen, char *value, unsigned vallen) { - int freespace, last, len, offset; - unsigned int i; + unsigned i, freespace, last, len, offset; /* Find offset where we can write */ last = find_last_envvar(part); @@ -132,7 +131,7 @@ int nvram_add_env(partition_t part, char *envvar, int evlen, char *value, int va return 0; } -int nvram_del_env(partition_t part, char *envvar, int evlen) +int nvram_del_env(partition_t part, char *envvar, unsigned evlen) { int last, current, pos, i; char *buffer; @@ -168,10 +167,10 @@ int nvram_del_env(partition_t part, char *envvar, int evlen) return 0; } -int nvram_set_env(partition_t part, char *envvar, int evlen, char *value, int vallen) +int nvram_set_env(partition_t part, char *envvar, unsigned evlen, char *value, unsigned vallen) { char *oldvalue, *buffer; - int last, current, buffersize, i; + unsigned last, current, buffersize, i; DEBUG("nvram_set_env %lx[%lx]: %p=>%p\n", part.addr, part.len, envvar, value); diff --git a/lib/libnvram/nvram.c b/lib/libnvram/nvram.c index 99deb2a..6d145d7 100644 --- a/lib/libnvram/nvram.c +++ b/lib/libnvram/nvram.c @@ -163,7 +163,7 @@ nvram_access(uint64_t, 64, qword) * @return pointer to temporary buffer */ -char *get_nvram_buffer(int len) +char *get_nvram_buffer(unsigned len) { if(len>NVRAM_LENGTH) return NULL; @@ -271,7 +271,7 @@ static uint8_t calc_partition_header_checksum(int offset) static int calc_used_nvram_space(void) { - int walk, len; + unsigned walk, len; for (walk=0; walk