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

(trunk libT) more work on magnet links.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.