Changeset 6654714 for lib


Ignore:
Timestamp:
11/15/17 11:59:35 (3 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
cachetimestamps, develop, dpdk-ndag, etsilive, master, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance
Children:
9993cde
Parents:
e844ff2
Message:

Fix various -Waddress-of-packed-member warnings on clang

Most of these fixes are casts to simply hide the issue from the
compiler -- not sure how (or even if) we can fix these properly.

Location:
lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lib/protocols_l3.c

    r5732e9b r6654714  
    682682        uint16_t ethertype;
    683683        uint32_t remaining;
    684         uint16_t *csum_ptr;
     684        char *csum_ptr;
    685685
    686686        uint8_t safety[65536];
     
    699699                        return NULL;
    700700
    701                 csum_ptr = &ip->ip_sum;
     701                csum_ptr = (char *)(&ip->ip_sum);
    702702
    703703                /* I hate memcpys, but this is the only truly safe way to
     
    716716                *csum = ntohs(*csum);
    717717               
    718                 return csum_ptr;
     718                return (uint16_t *)csum_ptr;
    719719        }
    720720
  • lib/protocols_transport.c

    r317e903 r6654714  
    448448        uint32_t sum = 0;
    449449        uint8_t proto = 0;
    450         uint16_t *csum_ptr = NULL;
     450        char *csum_ptr = NULL;
    451451        int plen = 0;
    452452
     
    483483                header = trace_get_payload_from_tcp(tcp, &remaining);
    484484               
    485                 csum_ptr = &tcp->check;
     485                csum_ptr = (char *)(&tcp->check);
    486486
    487487                memcpy(ptr, tcp, tcp->doff * 4);
     
    498498                header = trace_get_payload_from_udp(udp, &remaining);
    499499               
    500                 csum_ptr = &udp->check;
     500                csum_ptr = (char *)(&udp->check);
    501501                memcpy(ptr, udp, sizeof(libtrace_udp_t));
    502502
     
    514514                header = trace_get_payload_from_icmp(icmp, &remaining);
    515515               
    516                 csum_ptr = &icmp->checksum;
     516                csum_ptr = (char *)(&icmp->checksum);
    517517                memcpy(ptr, icmp, sizeof(libtrace_icmp_t));
    518518
     
    543543        //assert(0);
    544544       
    545         return csum_ptr;
     545        return (uint16_t *)csum_ptr;
    546546}
    547547
Note: See TracChangeset for help on using the changeset viewer.