Ignore:
Timestamp:
Dec 10, 2009, 4:54:48 AM (12 years ago)
Author:
charles
Message:

(trunk libT) #2655: "1.80b1 crash in peer-mgr.c's getPeersToClose()" -- fixed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/bitfield.c

    r9671 r9700  
    160160
    161161tr_bitfield*
    162 tr_bitfieldOr( tr_bitfield *       a,
    163                const tr_bitfield * b )
    164 {
    165     uint8_t * ait;
    166     const uint8_t *aend, *bit, *bend;
    167 
    168     for( ait = a->bits, aend = ait + a->byteCount,
    169          bit = b->bits, bend = bit + b->byteCount;
    170          ait != aend && bit != bend; )
    171     {
     162tr_bitfieldOr( tr_bitfield * a, const tr_bitfield * b )
     163{
     164    uint8_t * ait = a->bits;
     165    const uint8_t * aend = ait + a->byteCount;
     166    const uint8_t * bit = b->bits;
     167    const uint8_t * bend = bit + b->byteCount;
     168
     169    while( ait!=aend && bit!=bend )
    172170        *ait++ |= *bit++;
    173     }
    174171
    175172    return a;
     
    178175/* set 'a' to all the flags that were in 'a' but not 'b' */
    179176void
    180 tr_bitfieldDifference( tr_bitfield *       a,
    181                        const tr_bitfield * b )
    182 {
    183     uint8_t *      ait;
    184     const uint8_t *aend, *bit;
    185 
    186     assert( a->byteCount == b->byteCount );
    187 
    188     for( ait = a->bits, bit = b->bits, aend = ait + a->byteCount;
    189          ait != aend; )
     177tr_bitfieldDifference( tr_bitfield * a, const tr_bitfield * b )
     178{
     179    uint8_t * ait = a->bits;
     180    const uint8_t * aend = ait + a->byteCount;
     181    const uint8_t * bit = b->bits;
     182    const uint8_t * bend = bit + b->byteCount;
     183
     184    while( ait!=aend && bit!=bend )
    190185        *ait++ &= ~( *bit++ );
    191186}
Note: See TracChangeset for help on using the changeset viewer.