Changeset 2399


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

sync with r2397

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/utils.h

    r2348 r2399  
    8686
    8787#define tr_blockPiece(a) _tr_blockPiece(tor,a)
    88 static inline int _tr_blockPiece( const tr_torrent_t * tor, int block )
    89 {
    90     const tr_info_t * inf = &tor->info;
    91     return block / ( inf->pieceSize / tor->blockSize );
    92 }
     88int _tr_blockPiece( const tr_torrent_t * tor, int block );
    9389
    9490#define tr_blockSize(a) _tr_blockSize(tor,a)
    95 static inline int _tr_blockSize( const tr_torrent_t * tor, int block )
    96 {
    97     const tr_info_t * inf = &tor->info;
    98     int dummy;
    99 
    100     if( block != tor->blockCount - 1 ||
    101         !( dummy = inf->totalSize % tor->blockSize ) )
    102     {
    103         return tor->blockSize;
    104     }
    105 
    106     return dummy;
    107 }
     91int _tr_blockSize( const tr_torrent_t * tor, int block );
    10892
    10993#define tr_blockPosInPiece(a) _tr_blockPosInPiece(tor,a)
    110 static inline int _tr_blockPosInPiece( const tr_torrent_t * tor, int block )
    111 {
    112     const tr_info_t * inf = &tor->info;
    113     return tor->blockSize *
    114         ( block % ( inf->pieceSize / tor->blockSize ) );
    115 }
     94int _tr_blockPosInPiece( const tr_torrent_t * tor, int block );
    11695
    11796#define tr_pieceCountBlocks(a) _tr_pieceCountBlocks(tor,a)
    118 static inline int _tr_pieceCountBlocks( const tr_torrent_t * tor, int piece )
    119 {
    120     const tr_info_t * inf = &tor->info;
    121     if( piece < inf->pieceCount - 1 ||
    122         !( tor->blockCount % ( inf->pieceSize / tor->blockSize ) ) )
    123     {
    124         return inf->pieceSize / tor->blockSize;
    125     }
    126     return tor->blockCount % ( inf->pieceSize / tor->blockSize );
    127 }
     97int _tr_pieceCountBlocks( const tr_torrent_t * tor, int piece );
    12898
    12999#define tr_pieceStartBlock(a) _tr_pieceStartBlock(tor,a)
    130 static inline int _tr_pieceStartBlock( const tr_torrent_t * tor, int piece )
    131 {
    132     const tr_info_t * inf = &tor->info;
    133     return piece * ( inf->pieceSize / tor->blockSize );
    134 }
     100int _tr_pieceStartBlock( const tr_torrent_t * tor, int piece );
    135101
    136102#define tr_pieceSize(a) _tr_pieceSize(tor,a)
    137 static inline int _tr_pieceSize( const tr_torrent_t * tor, int piece )
    138 {
    139     const tr_info_t * inf = &tor->info;
    140     if( piece < inf->pieceCount - 1 ||
    141         !( inf->totalSize % inf->pieceSize ) )
    142     {
    143         return inf->pieceSize;
    144     }
    145     return inf->totalSize % inf->pieceSize;
    146 }
     103int _tr_pieceSize( const tr_torrent_t * tor, int piece );
    147104
    148105#define tr_block(a,b) _tr_block(tor,a,b)
    149 static inline int _tr_block( const tr_torrent_t * tor, int index, int begin )
    150 {
    151     const tr_info_t * inf = &tor->info;
    152     return index * ( inf->pieceSize / tor->blockSize ) +
    153         begin / tor->blockSize;
    154 }
     106int _tr_block( const tr_torrent_t * tor, int index, int begin );
    155107
    156108/***
Note: See TracChangeset for help on using the changeset viewer.