]> The Tcpdump Group git mirrors - tcpdump/commitdiff
CALM FAST/GeoNet: fix Windows compile errors
authorGisle Vanem <[email protected]>
Wed, 3 Jul 2013 16:47:50 +0000 (20:47 +0400)
committerDenis Ovsienko <[email protected]>
Wed, 3 Jul 2013 16:47:50 +0000 (20:47 +0400)
It didn't work out-of-the box because my MSVC (v16 from Visual C
Express 2010) isn't a C99 compiler; you cannot have code ahead of
declarations.

print-calm-fast.c
print-geonet.c

index ba9776ca4f46f5cfd200adabf8920dc7e545e085..9824072b66740e3f70aab9201b8fade12a92bbe8 100644 (file)
 void
 calm_fast_print(netdissect_options *ndo, const u_char *eth, const u_char *bp, u_int length)
 {
-       printf("CALM FAST src:%s; ", etheraddr_string(eth+6));
-
        int srcNwref = bp[0];
        int dstNwref = bp[1];
        length -= 2;
        bp += 2;
 
+       printf("CALM FAST src:%s; ", etheraddr_string(eth+6));
        printf("SrcNwref:%d; ", srcNwref);
        printf("DstNwref:%d; ", dstNwref);
 
index 7cc06229a55bf6d9d134357c534795e718499ca2..dd1d6bd7880c476bda1ed84b506b400837de56c9 100644 (file)
@@ -58,14 +58,18 @@ static const struct tok msg_type_values[] = {
 static void
 print_btp_body(const u_char *bp, u_int length)
 {
+       int version;
+       int msg_type;
+       const char *msg_type_str;
+
        if (length <= 2) {
                return;
        }
 
        // Assuming ItsDpuHeader
-       int version = bp[0];
-       int msg_type = bp[1];
-       const char *msg_type_str = tok2str(msg_type_values, "unknown (%u)", msg_type);
+       version = bp[0];
+       msg_type = bp[1];
+       msg_type_str = tok2str(msg_type_values, "unknown (%u)", msg_type);
 
        printf("; ItsPduHeader v:%d t:%d-%s", version, msg_type, msg_type_str);
 }