Changeset 1338

Show
Ignore:
Timestamp:
02/04/08 16:32:01 (9 months ago)
Author:
spa1
Message:

Some fixes to deal with errors and warnings that appear with old gcc - e.g. 2.95

  • Added 'static' to functions that are only used internally
  • Moved variable declarations to the start of the code block, before any actual code
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libpacketdump/eth_2054.c

    r1212 r1338  
    2020 * attempt to decode. 
    2121 */ 
    22 char *format_hrd(struct arphdr *arp, char *hrd) { 
     22static char *format_hrd(struct arphdr *arp, char *hrd) { 
    2323        static char buffer[1024] = {0,}; 
    2424        int i; 
     
    5050 * attempt to decode. 
    5151 */ 
    52 char *format_pro(struct arphdr *arp, char *pro) { 
     52static char *format_pro(struct arphdr *arp, char *pro) { 
    5353        static char buffer[1024] = {0,}; 
    5454        int i; 
  • trunk/libpacketdump/ip_6.c

    r1219 r1338  
    2222void decode(int link_type,char *packet,unsigned len) 
    2323{ 
     24        unsigned char *pkt = NULL; 
     25        unsigned char type,optlen,*data; 
     26        int plen, i; 
    2427        libtrace_tcp_t *tcp = (libtrace_tcp_t *)packet; 
    2528        printf(" TCP:"); 
     
    6972        DISPLAYS(check," Checksum %i"); 
    7073        DISPLAYS(urg_ptr," Urgent %i"); 
    71         unsigned char *pkt = (unsigned char*)packet+sizeof(*tcp); 
    72         int plen = (len-sizeof *tcp) < (tcp->doff*4-sizeof(*tcp))?(len-sizeof(*tcp)):(tcp->doff*4-sizeof *tcp); 
    73         unsigned char type,optlen,*data; 
     74        pkt = (unsigned char*)packet+sizeof(*tcp); 
     75        plen = (len-sizeof *tcp) < (tcp->doff*4-sizeof(*tcp))?(len-sizeof(*tcp)):(tcp->doff*4-sizeof *tcp); 
    7476        while(trace_get_next_option(&pkt,&plen,&type,&optlen,&data)) { 
    7577                printf("\n TCP: "); 
     
    9294                        case 5: 
    9395                                printf("SACK Information"); 
    94                                 int i; 
    9596                                i=0; 
    9697                                while(i+8<optlen) { 
  • trunk/libpacketdump/link_4.c

    r1300 r1338  
    9999} __attribute__ ((__packed__)) ieee80211_payload; 
    100100 
    101 char *macaddr(uint8_t mac[]) { 
     101static char *macaddr(uint8_t mac[]) { 
    102102        static char ether_buf[18] = {0, }; 
    103103        trace_ether_ntoa(mac, ether_buf); 
     
    724724         
    725725        if (len > hdrlen) { 
    726                 pld = (ieee80211_payload *) ((char *)pkt + hdrlen) ; 
    727726                int payload_offset = 0; 
    728727                uint16_t ethertype = 0; 
     728                pld = (ieee80211_payload *) ((char *)pkt + hdrlen) ; 
    729729                if (ntohs(pld->ethertype) == 0xaaaa) { 
    730730                        /* 802.11 payload contains an 802.2 LLC/SNAP header */