Changeset 9562


Ignore:
Timestamp:
Nov 25, 2009, 4:12:55 AM (13 years ago)
Author:
charles
Message:

(trunk libT) more work on magnet links.

Location:
trunk/libtransmission
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/bitfield.c

    r9559 r9562  
    163163               const tr_bitfield * b )
    164164{
    165     uint8_t *      ait;
    166     const uint8_t *aend, *bit;
    167 
    168     assert( a->byteCount == b->byteCount );
    169 
    170     for( ait = a->bits, bit = b->bits, aend = ait + a->byteCount;
    171          ait != aend; )
     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    {
    172172        *ait++ |= *bit++;
     173    }
    173174
    174175    return a;
  • trunk/libtransmission/bitset.h

    r9558 r9562  
    1717#ifndef TR_BITSET_H
    1818#define TR_BITSET_H 1
    19 
    20 #include <assert.h>
    2119
    2220#include "transmission.h"
     
    5351        tr_bitfieldDestruct( &b->bitfield );
    5452        tr_bitfieldConstruct( &b->bitfield, size );
    55         assert( b->bitfield.byteCount >= tmp->byteCount );
    56         memcpy( &b->bitfield.bits, tmp->bits, tmp->byteCount );
     53        memcpy( b->bitfield.bits, tmp->bits, tmp->byteCount );
    5754
    5855        tr_bitfieldFree( tmp );
     
    6562    if( b->haveAll ) return TRUE;
    6663    if( b->haveNone ) return FALSE;
     64    if( nth >= b->bitfield.bitCount ) return FALSE;
    6765    return tr_bitfieldHasFast( &b->bitfield, nth );
    6866}
     
    7371    if( b->haveAll ) return TRUE;
    7472    if( b->haveNone ) return FALSE;
     73    if( nth >= b->bitfield.bitCount ) return FALSE;
    7574    return tr_bitfieldHas( &b->bitfield, nth );
    7675}
     
    124123    if( !b->haveAll ) {
    125124        b->haveNone = 0;
    126         tr_bitsetReserve( b, i );
     125        tr_bitsetReserve( b, i+1 );
    127126        ret = tr_bitfieldAdd( &b->bitfield, i );
    128127    }
Note: See TracChangeset for help on using the changeset viewer.