Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset c9ebbe71 in mainline


Ignore:
Timestamp:
2010-11-14T11:50:58Z (11 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master
Children:
fb04cba8
Parents:
71e3289
Message:

Fix invalid aliasing in nettest (gcc 4.4.2 warning).

Location:
uspace/app
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/nettest1/nettest1.c

    r71e3289 rc9ebbe71  
    287287int main(int argc, char *argv[])
    288288{
    289 
    290         socklen_t max_length;
    291         uint8_t *address_data[sizeof(struct sockaddr_in6)];
    292         struct sockaddr_in *address_in;
    293         struct sockaddr_in6 *address_in6;
     289        struct sockaddr_in address_in;
     290        struct sockaddr_in6 address_in6;
    294291        uint8_t *address_start;
    295292
     
    300297
    301298        int rc;
    302 
    303         max_length = sizeof(address_data);
    304         address = (struct sockaddr *) address_data;
    305         address_in = (struct sockaddr_in *) address;
    306         address_in6 = (struct sockaddr_in6 *) address;
    307299
    308300        sockets = 10;
     
    334326
    335327        /* Prepare the address buffer */
    336         bzero(address_data, max_length);
    337328
    338329        switch (family) {
    339330        case PF_INET:
    340                 address_in->sin_family = AF_INET;
    341                 address_in->sin_port = htons(port);
    342                 address_start = (uint8_t *) &address_in->sin_addr.s_addr;
    343                 addrlen = sizeof(struct sockaddr_in);
     331                address_in.sin_family = AF_INET;
     332                address_in.sin_port = htons(port);
     333                address = (struct sockaddr *) &address_in;
     334                addrlen = sizeof(address_in);
     335                address_start = (uint8_t *) &address_in.sin_addr.s_addr;
    344336                break;
    345337        case PF_INET6:
    346                 address_in6->sin6_family = AF_INET6;
    347                 address_in6->sin6_port = htons(port);
    348                 address_start = (uint8_t *) &address_in6->sin6_addr.s6_addr;
    349                 addrlen = sizeof(struct sockaddr_in6);
     338                address_in6.sin6_family = AF_INET6;
     339                address_in6.sin6_port = htons(port);
     340                address = (struct sockaddr *) &address_in6;
     341                addrlen = sizeof(address_in6);
     342                address_start = (uint8_t *) &address_in6.sin6_addr.s6_addr;
    350343                break;
    351344        default:
  • uspace/app/nettest2/nettest2.c

    r71e3289 rc9ebbe71  
    223223int main(int argc, char *argv[])
    224224{
    225         socklen_t max_length;
    226         uint8_t address_data[sizeof(struct sockaddr_in6)];
    227225        struct sockaddr *address;
    228         struct sockaddr_in *address_in;
    229         struct sockaddr_in6 *address_in6;
     226        struct sockaddr_in address_in;
     227        struct sockaddr_in6 address_in6;
    230228        socklen_t addrlen;
    231229        uint8_t *address_start;
     
    247245        port = 7;
    248246
    249         max_length = sizeof(address_data);
    250         address = (struct sockaddr *) address_data;
    251         address_in = (struct sockaddr_in *) address;
    252         address_in6 = (struct sockaddr_in6 *) address;
    253 
    254247        /*
    255248         * Parse the command line arguments.
     
    279272
    280273        /* Prepare the address buffer */
    281         bzero(address_data, max_length);
    282274
    283275        switch (family) {
    284276        case PF_INET:
    285                 address_in->sin_family = AF_INET;
    286                 address_in->sin_port = htons(port);
    287                 address_start = (uint8_t *) &address_in->sin_addr.s_addr;
    288                 addrlen = sizeof(struct sockaddr_in);
     277                address_in.sin_family = AF_INET;
     278                address_in.sin_port = htons(port);
     279                address = (struct sockaddr *) &address_in;
     280                addrlen = sizeof(address_in);
     281                address_start = (uint8_t *) &address_in.sin_addr.s_addr;
    289282                break;
    290283        case PF_INET6:
    291                 address_in6->sin6_family = AF_INET6;
    292                 address_in6->sin6_port = htons(port);
    293                 address_start = (uint8_t *) &address_in6->sin6_addr.s6_addr;
    294                 addrlen = sizeof(struct sockaddr_in6);
     284                address_in6.sin6_family = AF_INET6;
     285                address_in6.sin6_port = htons(port);
     286                address = (struct sockaddr *) &address_in6;
     287                addrlen = sizeof(address_in6);
     288                address_start = (uint8_t *) &address_in6.sin6_addr.s6_addr;
    295289                break;
    296290        default:
Note: See TracChangeset for help on using the changeset viewer.