From: guy Date: Fri, 29 Sep 2000 05:05:47 +0000 (+0000) Subject: Declare bitfields as "u_int", not "u_char"; ANSI C doesn't guarantee X-Git-Tag: tcpdump-3.5.1~149 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/6de29a031460967d9b26716a6b7a7369e7713137 Declare bitfields as "u_int", not "u_char"; ANSI C doesn't guarantee that bitfields other than "int" or "unsigned int" are allowed, some compilers warn about them, and, given that the declaration of a bit field says how many bits it is wide, declaring them "u_char" doesn't have any advantage (other than making it a bit clearer, when reading the header, that the bitfields in question are part of a single byte). --- diff --git a/ip.h b/ip.h index 028e9670..9be7544a 100644 --- a/ip.h +++ b/ip.h @@ -1,4 +1,4 @@ -/* @(#) $Header: /tcpdump/master/tcpdump/ip.h,v 1.3 2000-09-29 04:58:33 guy Exp $ (LBL) */ +/* @(#) $Header: /tcpdump/master/tcpdump/ip.h,v 1.4 2000-09-29 05:05:47 guy Exp $ (LBL) */ /* * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. @@ -72,11 +72,11 @@ */ struct ip { #if BYTE_ORDER == LITTLE_ENDIAN - u_char ip_hl:4, /* header length */ + u_int ip_hl:4, /* header length */ ip_v:4; /* version */ #endif #if BYTE_ORDER == BIG_ENDIAN - u_char ip_v:4, /* version */ + u_int ip_v:4, /* version */ ip_hl:4; /* header length */ #endif u_char ip_tos; /* type of service */ @@ -151,11 +151,11 @@ struct ip_timestamp { u_char ipt_len; /* size of structure (variable) */ u_char ipt_ptr; /* index of current entry */ #if BYTE_ORDER == LITTLE_ENDIAN - u_char ipt_flg:4, /* flags, see below */ + u_int ipt_flg:4, /* flags, see below */ ipt_oflw:4; /* overflow counter */ #endif #if BYTE_ORDER == BIG_ENDIAN - u_char ipt_oflw:4, /* overflow counter */ + u_int ipt_oflw:4, /* overflow counter */ ipt_flg:4; /* flags, see below */ #endif union ipt_timestamp { diff --git a/tcp.h b/tcp.h index 0addc8a4..c39cce7e 100644 --- a/tcp.h +++ b/tcp.h @@ -1,4 +1,4 @@ -/* @(#) $Header: /tcpdump/master/tcpdump/tcp.h,v 1.2 2000-09-23 08:54:43 guy Exp $ (LBL) */ +/* @(#) $Header: /tcpdump/master/tcpdump/tcp.h,v 1.3 2000-09-29 05:05:48 guy Exp $ (LBL) */ /* * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. @@ -68,11 +68,11 @@ struct tcphdr { tcp_seq th_seq; /* sequence number */ tcp_seq th_ack; /* acknowledgement number */ #if BYTE_ORDER == LITTLE_ENDIAN - u_char th_x2:4, /* (unused) */ + u_int th_x2:4, /* (unused) */ th_off:4; /* data offset */ #endif #if BYTE_ORDER == BIG_ENDIAN - u_char th_off:4, /* data offset */ + u_int th_off:4, /* data offset */ th_x2:4; /* (unused) */ #endif u_char th_flags;