cmdline (merge-intel): fix compilation warnings
authorOlivier Matz <zer0@droids-corp.org>
Fri, 24 Dec 2010 12:52:49 +0000 (13:52 +0100)
committerOlivier Matz <zer0@droids-corp.org>
Sat, 25 Dec 2010 17:58:13 +0000 (18:58 +0100)
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
src/lib/cmdline.c
src/lib/cmdline_parse.c
src/lib/cmdline_parse_etheraddr.c
src/lib/cmdline_rdline.c

index bf225e8..4815071 100644 (file)
@@ -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;
index aec9e80..d1b01f7 100644 (file)
@@ -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);
index 94ee7cc..99c4859 100644 (file)
@@ -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;
index 8e4b2a5..d439be7 100644 (file)
@@ -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;