Ignore:
Timestamp:
Jan 14, 2007, 12:00:21 PM (15 years ago)
Author:
titer
Message:

Merge io branch into trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/completion.c

    r1197 r1356  
    8686
    8787/* Pieces */
     88int tr_cpPieceHasAllBlocks( tr_completion_t * cp, int piece )
     89{
     90    tr_torrent_t * tor = cp->tor;
     91    int startBlock  = tr_pieceStartBlock( piece );
     92    int endBlock    = startBlock + tr_pieceCountBlocks( piece );
     93    int i;
     94
     95    for( i = startBlock; i < endBlock; i++ )
     96    {
     97        if( !tr_bitfieldHas( cp->blockBitfield, i ) )
     98        {
     99            return 0;
     100        }
     101    }   
     102    return 1;
     103}
    88104int tr_cpPieceIsComplete( tr_completion_t * cp, int piece )
    89105{
     
    109125
    110126    tr_bitfieldAdd( cp->pieceBitfield, piece );
     127}
     128
     129void tr_cpPieceRem( tr_completion_t * cp, int piece )
     130{
     131    tr_torrent_t * tor = cp->tor;
     132    int startBlock, endBlock, i;
     133
     134    startBlock = tr_pieceStartBlock( piece );
     135    endBlock   = startBlock + tr_pieceCountBlocks( piece );
     136    for( i = startBlock; i < endBlock; i++ )
     137    {
     138        tr_cpBlockRem( cp, i );
     139    }
     140
     141    tr_bitfieldRem( cp->pieceBitfield, piece );
    111142}
    112143
Note: See TracChangeset for help on using the changeset viewer.