Changeset 2397


Ignore:
Timestamp:
Jul 18, 2007, 10:11:47 PM (15 years ago)
Author:
charles
Message:

remove unused variable

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/utils.c

    r2390 r2397  
    341341{
    342342    va_list ap2;
    343     int     ret, used, max;
     343    int     used, max;
    344344
    345345    va_copy( ap2, ap );
     
    696696#endif
    697697}
     698
     699/***
     700****
     701***/
     702
     703int _tr_blockPiece( const tr_torrent_t * tor, int block )
     704{
     705    const tr_info_t * inf = &tor->info;
     706    return block / ( inf->pieceSize / tor->blockSize );
     707}
     708
     709inline int _tr_blockSize( const tr_torrent_t * tor, int block )
     710{
     711    const tr_info_t * inf = &tor->info;
     712    int dummy;
     713
     714    if( block != tor->blockCount - 1 ||
     715        !( dummy = inf->totalSize % tor->blockSize ) )
     716    {
     717        return tor->blockSize;
     718    }
     719
     720    return dummy;
     721}
     722
     723int _tr_blockPosInPiece( const tr_torrent_t * tor, int block )
     724{
     725    const tr_info_t * inf = &tor->info;
     726    return tor->blockSize *
     727        ( block % ( inf->pieceSize / tor->blockSize ) );
     728}
     729
     730int _tr_pieceCountBlocks( const tr_torrent_t * tor, int piece )
     731{
     732    const tr_info_t * inf = &tor->info;
     733    if( piece < inf->pieceCount - 1 ||
     734        !( tor->blockCount % ( inf->pieceSize / tor->blockSize ) ) )
     735    {
     736        return inf->pieceSize / tor->blockSize;
     737    }
     738    return tor->blockCount % ( inf->pieceSize / tor->blockSize );
     739}
     740
     741int _tr_pieceStartBlock( const tr_torrent_t * tor, int piece )
     742{
     743    const tr_info_t * inf = &tor->info;
     744    return piece * ( inf->pieceSize / tor->blockSize );
     745}
     746
     747int _tr_pieceSize( const tr_torrent_t * tor, int piece )
     748{
     749    const tr_info_t * inf = &tor->info;
     750    if( piece < inf->pieceCount - 1 ||
     751        !( inf->totalSize % inf->pieceSize ) )
     752    {
     753        return inf->pieceSize;
     754    }
     755    return inf->totalSize % inf->pieceSize;
     756}
     757
     758int _tr_block( const tr_torrent_t * tor, int index, int begin )
     759{
     760    const tr_info_t * inf = &tor->info;
     761    return index * ( inf->pieceSize / tor->blockSize ) +
     762        begin / tor->blockSize;
     763}
Note: See TracChangeset for help on using the changeset viewer.