]> git.ipfire.org Git - thirdparty/ulogd2.git/commitdiff
cleanup: fix compilation warning related to signed and unsigned comparisons
authorEric Leblond <eric@inl.fr>
Thu, 31 Jul 2008 08:41:57 +0000 (10:41 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 31 Jul 2008 08:41:57 +0000 (10:41 +0200)
This patch fixes the warning related to signed and unsigned comparaison.

Signed-off-by: Eric Leblond <eric@inl.fr>
filter/raw2packet/ulogd_raw2packet_BASE.c
filter/ulogd_filter_MARK.c
filter/ulogd_filter_PWSNIFF.c
libipulog/libipulog.c
src/conffile.c
src/ulogd.c
util/db.c

index 7c6fd26c464195666da54f363f48c336a04ddfad..e61d904f07292988c320255ee96b42ee2e4a1aec 100644 (file)
@@ -694,7 +694,7 @@ static int _interp_iphdr(struct ulogd_pluginstance *pi, u_int32_t len)
                GET_VALUE(pi->input.keys, INKEY_RAW_PCKT).ptr;
        void *nexthdr = (u_int32_t *)iph + iph->ihl;
 
-       if (len < sizeof(struct iphdr) || len <= iph->ihl * 4)
+       if (len < sizeof(struct iphdr) || len <= (u_int32_t)(iph->ihl * 4))
                return ULOGD_IRET_OK;
        len -= iph->ihl * 4;
 
index ff31fe57579d292988869771340462828b34c546..98f5dae6a3d6c306a308c96440bbd03ddfb5af3b 100644 (file)
@@ -74,14 +74,14 @@ static int interp_mark(struct ulogd_pluginstance *pi)
        if (pp_is_valid(inp, KEY_CT_MARK)) {
                if ((GET_VALUE(inp, KEY_CT_MARK).ui32 &
                        pi->config_kset->ces[MARK_MASK].u.value) !=
-                       pi->config_kset->ces[MARK_MARK].u.value
+                       (u_int32_t) pi->config_kset->ces[MARK_MARK].u.value
                   ) {
                        return ULOGD_IRET_STOP;
                }
        } else if (pp_is_valid(inp, KEY_OOB_MARK)) {
                if ((GET_VALUE(inp, KEY_OOB_MARK).ui32 &
                        pi->config_kset->ces[MARK_MASK].u.value) !=
-                       pi->config_kset->ces[MARK_MARK].u.value
+                       (u_int32_t) pi->config_kset->ces[MARK_MARK].u.value
                   ) {
                        return ULOGD_IRET_STOP;
                }
index 290e4cb615f0f1b17d3fa3d9dc6edb222d72821a..3cbafb69e752ef209737837e2c6817bf08878744 100644 (file)
@@ -66,7 +66,8 @@ static int interp_pwsniff(struct ulogd_pluginstance *pi)
        struct tcphdr *tcph;    
        unsigned int tcplen;
        unsigned char  *ptr, *begp, *pw_begp, *endp, *pw_endp;
-       int len, pw_len, i, cont = 0;
+       int len, pw_len, cont = 0;
+       unsigned int i;
 
        if (!IS_VALID(pi->input.keys[0]))
                return ULOGD_IRET_STOP;
index 6b7ea355885b1da04b696c41f0f9b1a622cbc17b..2f58ea61b9a2b7b01353eaff326061d3f6542b64 100644 (file)
@@ -96,7 +96,7 @@ ipulog_netlink_recvfrom(const struct ipulog_handle *h,
                return -1;
        }
        nlh = (struct nlmsghdr *)buf;
-       if (nlh->nlmsg_flags & MSG_TRUNC || status > len) {
+       if (nlh->nlmsg_flags & MSG_TRUNC || (size_t) status > len) {
                ipulog_errno = IPULOG_ERR_TRUNC;
                return -1;
        }
index 72afb8e6cf10d1a19314cb9b3231678fe7f1c524..0c1a2a4e109e490477417b4e71c9bdae0c31b359 100644 (file)
@@ -112,7 +112,7 @@ int config_parse_file(const char *section, struct config_keyset *kset)
        char *args;
        int err = 0;
        int found = 0;
-       int i;
+       unsigned int i;
        char linebuf[LINE_LEN+1];
        char *line = linebuf;
 
@@ -147,7 +147,7 @@ int config_parse_file(const char *section, struct config_keyset *kset)
        /* Parse this section until next section */
        while (fgets(line, LINE_LEN, cfile))
        {
-               int i;
+               unsigned int i;
                char wordbuf[LINE_LEN];
                char *wordend;
                
index 33d58ee94be1e1f8d30b629982f427a2886b9b1a..429f4729cf4a8cfdaae5c9b9fb48c33caa38c747 100644 (file)
@@ -204,7 +204,7 @@ int ulogd_wildcard_inputkeys(struct ulogd_pluginstance *upi)
 
        /* second pass: copy key names */
        llist_for_each_entry(pi_cur, &stack->list, list) {
-               int i;
+               unsigned int i;
 
                for (i = 0; i < pi_cur->plugin->output.num_keys; i++)
                        upi->input.keys[index++] = pi_cur->output.keys[i];
@@ -280,7 +280,7 @@ char *type_to_string(int type)
 
 void get_plugin_infos(struct ulogd_plugin *me)
 {
-       int i;
+       unsigned int i;
        printf("Name: %s\n", me->name);
        if (me->config_kset) {
                printf("Config options:\n");
@@ -453,7 +453,7 @@ static void ulogd_clean_results(struct ulogd_pluginstance *pi)
 
        /* iterate through plugin stack */
        llist_for_each_entry(cur, &pi->stack->list, list) {
-               int i;
+               unsigned int i;
                
                /* iterate through input keys of pluginstance */
                for (i = 0; i < cur->output.num_keys; i++) {
@@ -598,7 +598,7 @@ find_okey_in_stack(char *name,
        struct ulogd_pluginstance *pi;
 
        llist_for_each_entry_reverse(pi, &start->list, list) {
-               int i;
+               unsigned int i;
 
                if ((void *)&pi->list == &stack->list)
                        return NULL;
@@ -666,7 +666,7 @@ create_stack_resolve_keys(struct ulogd_pluginstance_stack *stack)
                        }
                        /* no need to match keys */
                } else {
-                       int j;
+                       unsigned int j;
 
                        /* not the last one in the stack */
                        if (!(pi_cur->plugin->input.type &
index 9b4da8d28243cfb5b7ba9ea697cb3aff478978c2..8e9dde675b2e2231480dd504207ff1856b97685b 100644 (file)
--- a/util/db.c
+++ b/util/db.c
@@ -63,7 +63,7 @@ static int sql_createstmt(struct ulogd_pluginstance *upi)
 {
        struct db_instance *mi = (struct db_instance *) upi->private;
        unsigned int size;
-       int i;
+       unsigned int i;
        char *table = table_ce(upi->config_kset).u.string;
        char *procedure = procedure_ce(upi->config_kset).u.string;
 
@@ -223,7 +223,7 @@ static int _init_db(struct ulogd_pluginstance *upi)
 static int __interp_db(struct ulogd_pluginstance *upi)
 {
        struct db_instance *di = (struct db_instance *) &upi->private;
-       int i;
+       unsigned int i;
 
        di->stmt_ins = di->stmt_val;