From: Guy Harris Date: Fri, 25 May 2018 01:57:56 +0000 (-0700) Subject: We've done the test and found out the answer, so remove the change. X-Git-Tag: libpcap-1.9-bp~16 X-Git-Url: https://git.tcpdump.org/libpcap/commitdiff_plain/9b242ffef4b45ecd6db368e123ab4bdd8544dd02?ds=inline We've done the test and found out the answer, so remove the change. The reason we were getting warnings about declarations after statements, even with -std=gnu99, is that we were *explicitly requesting them* with -Wdeclaration-after-statement. --- diff --git a/pcap-rpcap.c b/pcap-rpcap.c index d85b0d3d..42f381c8 100644 --- a/pcap-rpcap.c +++ b/pcap-rpcap.c @@ -372,6 +372,7 @@ rpcap_deseraddr(struct rpcap_sockaddr *sockaddrin, struct sockaddr_storage **soc static int pcap_read_nocb_remote(pcap_t *p, struct pcap_pkthdr *pkt_header, u_char **pkt_data) { struct pcap_rpcap *pr = p->priv; /* structure used when doing a remote live capture */ + struct rpcap_header *header; /* general header according to the RPCAP format */ struct rpcap_pkthdr *net_pkt_header; /* header of the packet, from the message */ u_char *net_pkt_data; /* packet data from the message */ uint32 plen; @@ -420,7 +421,7 @@ static int pcap_read_nocb_remote(pcap_t *p, struct pcap_pkthdr *pkt_header, u_ch * We have to define 'header' as a pointer to a larger buffer, * because in case of UDP we have to read all the message within a single call */ - struct rpcap_header *header = (struct rpcap_header *) p->buffer; + header = (struct rpcap_header *) p->buffer; net_pkt_header = (struct rpcap_pkthdr *) ((char *)p->buffer + sizeof(struct rpcap_header)); net_pkt_data = (u_char *)p->buffer + sizeof(struct rpcap_header) + sizeof(struct rpcap_pkthdr);