dissector: icmpv6: Fix compiler warnings
authorTobias Klauser <tklauser@distanz.ch>
Mon, 12 Aug 2013 19:30:01 +0000 (12 21:30 +0200)
committerTobias Klauser <tklauser@distanz.ch>
Mon, 12 Aug 2013 19:32:37 +0000 (12 21:32 +0200)
Fix the following compiler warnings that occur when building with "-W
-Wall -Wextra":

proto_icmpv6.c: In function ‘dissect_icmpv6_mcast_rec’:
proto_icmpv6.c:326:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
proto_icmpv6.c: In function ‘dissect_neighb_disc_ops_15’:
proto_icmpv6.c:537:41: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
proto_icmpv6.c:542:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
proto_icmpv6.c: In function ‘dissect_neighb_disc_ops_16’:
proto_icmpv6.c:604:41: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
proto_icmpv6.c: In function ‘dissect_neighb_disc_ops_17’:
proto_icmpv6.c:650:40: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
proto_icmpv6.c

index 77c89b1..ada5fdd 100644 (file)
@@ -22,7 +22,7 @@
 #include "pkt_buff.h"
 #include "built_in.h"
 
-#define icmpv6_code_range_valid(code, sarr)    ((code) < array_size((sarr)))
+#define icmpv6_code_range_valid(code, sarr)    ((size_t) (code) < array_size((sarr)))
 
 struct icmpv6_general_hdr {
        uint8_t h_type;
@@ -539,7 +539,7 @@ static int8_t dissect_neighb_disc_ops_15(struct pkt_buff *pkt,
                icmpv6_neighb_disc_ops_15_name[
                icmp_neighb_disc_15->name_type - 1] : "Unknown",
                icmp_neighb_disc_15->name_type);
-       if (pad_len > len) {
+       if (pad_len > (size_t) len) {
                tprintf("Pad Len (%zu, invalid)\n%s", pad_len,
                        colorize_start_full(black, red)
                        "Skip Option" colorize_end());