Changeset 8692


Ignore:
Timestamp:
Jun 14, 2009, 7:17:10 PM (13 years ago)
Author:
charles
Message:

(trunk libT) silence a gcc 4.4 warning: "dereferencing type-punned pointer will break strict-aliasing rules"

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/peer-msgs.c

    r8685 r8692  
    544544    if( addr->type == TR_AF_INET )
    545545    {
    546         uint8_t w[SHA_DIGEST_LENGTH + 4];
     546        uint8_t w[SHA_DIGEST_LENGTH + 4], *walk=w;
    547547        uint8_t x[SHA_DIGEST_LENGTH];
    548548
    549         *(uint32_t*)w = ntohl( htonl( addr->addr.addr4.s_addr ) & 0xffffff00 );   /* (1) */
    550         memcpy( w + 4, infohash, SHA_DIGEST_LENGTH );                /* (2) */
    551         tr_sha1( x, w, sizeof( w ), NULL );                          /* (3) */
     549        uint32_t ui32 = ntohl( htonl( addr->addr.addr4.s_addr ) & 0xffffff00 );   /* (1) */
     550        memcpy( w, &ui32, sizeof( uint32_t ) );
     551        walk += sizeof( uint32_t );
     552        memcpy( walk, infohash, SHA_DIGEST_LENGTH );                 /* (2) */
     553        walk += SHA_DIGEST_LENGTH;
     554        tr_sha1( x, w, walk-w, NULL );                               /* (3) */
     555        assert( sizeof( w ) == walk-w );
    552556
    553557        while( setSize<desiredSetSize )
Note: See TracChangeset for help on using the changeset viewer.