From 369246d596ca24a9193b730c5aba2ec8837fb134 Mon Sep 17 00:00:00 2001 From: Olivier Matz Date: Fri, 24 Dec 2010 13:52:49 +0100 Subject: [PATCH] cmdline (merge-intel): fix compilation warnings Signed-off-by: Olivier Matz --- src/lib/cmdline.c | 3 ++- src/lib/cmdline_parse.c | 6 ++++-- src/lib/cmdline_parse_etheraddr.c | 7 ++++--- src/lib/cmdline_rdline.c | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/lib/cmdline.c b/src/lib/cmdline.c index bf225e8..4815071 100644 --- a/src/lib/cmdline.c +++ b/src/lib/cmdline.c @@ -49,7 +49,8 @@ /**********************/ void -cmdline_valid_buffer(struct rdline *rdl, const char *buf, unsigned int size) +cmdline_valid_buffer(struct rdline *rdl, const char *buf, + __attribute__((unused)) unsigned int size) { struct cmdline *cl = rdl->opaque; int ret; diff --git a/src/lib/cmdline_parse.c b/src/lib/cmdline_parse.c index aec9e80..d1b01f7 100644 --- a/src/lib/cmdline_parse.c +++ b/src/lib/cmdline_parse.c @@ -288,11 +288,13 @@ cmdline_complete(struct cmdline *cl, const char *buf, int *state, int l; unsigned int nb_completable; unsigned int nb_non_completable; - unsigned int local_state=0; + int local_state = 0; char *help_str; cmdline_parse_ctx_t *ctx = cl->ctx; debug_printf("%s called\n", __FUNCTION__); + memset(&token_hdr, 0, sizeof(token_hdr)); + /* count the number of complete token to parse */ for (i=0 ; buf[i] ; i++) { if (!isblank2(buf[i]) && isblank2(buf[i+1])) @@ -367,7 +369,7 @@ cmdline_complete(struct cmdline *cl, const char *buf, int *state, /* one or several choices starting with the same chars */ if (completion_len > 0) { - if (completion_len + 1 > size) + if ((unsigned)(completion_len + 1) > size) return 0; strcpy(dst, completion_buf); diff --git a/src/lib/cmdline_parse_etheraddr.c b/src/lib/cmdline_parse_etheraddr.c index 94ee7cc..99c4859 100644 --- a/src/lib/cmdline_parse_etheraddr.c +++ b/src/lib/cmdline_parse_etheraddr.c @@ -51,7 +51,8 @@ struct cmdline_token_ops cmdline_token_etheraddr_ops = { #define ETHER_ADDRSTRLEN 18 int -cmdline_parse_etheraddr(cmdline_parse_token_hdr_t *tk, const char *buf, void *res) +cmdline_parse_etheraddr(__attribute__((unused)) cmdline_parse_token_hdr_t *tk, + const char *buf, void *res) { unsigned int token_len = 0; char ether_str[ETHER_ADDRSTRLEN]; @@ -78,8 +79,8 @@ cmdline_parse_etheraddr(cmdline_parse_token_hdr_t *tk, const char *buf, void *re return token_len; } -int cmdline_get_help_etheraddr(cmdline_parse_token_hdr_t *tk, char *dstbuf, - unsigned int size) +int cmdline_get_help_etheraddr(__attribute__((unused)) cmdline_parse_token_hdr_t *tk, + char *dstbuf, unsigned int size) { snprintf(dstbuf, size, "Ethernet address"); return 0; diff --git a/src/lib/cmdline_rdline.c b/src/lib/cmdline_rdline.c index 8e4b2a5..d439be7 100644 --- a/src/lib/cmdline_rdline.c +++ b/src/lib/cmdline_rdline.c @@ -318,7 +318,7 @@ rdline_char_in(struct rdline *rdl, char c) char tmp_buf[BUFSIZ]; int complete_state; int ret; - int tmp_size; + unsigned int tmp_size; if (cmd == CMDLINE_KEY_TAB) complete_state = 0; -- 2.20.1