mirror of
https://github.com/transmission/transmission
synced 2025-03-03 18:25:35 +00:00
remove unused variable
This commit is contained in:
parent
99e471f05d
commit
3c60fb0ded
1 changed files with 67 additions and 1 deletions
|
@ -340,7 +340,7 @@ int
|
|||
vasprintf( char ** buf, const char * format, va_list ap )
|
||||
{
|
||||
va_list ap2;
|
||||
int ret, used, max;
|
||||
int used, max;
|
||||
|
||||
va_copy( ap2, ap );
|
||||
|
||||
|
@ -695,3 +695,69 @@ tr_wait( uint64_t delay_msec )
|
|||
usleep( 1000 * delay_msec );
|
||||
#endif
|
||||
}
|
||||
|
||||
/***
|
||||
****
|
||||
***/
|
||||
|
||||
int _tr_blockPiece( const tr_torrent_t * tor, int block )
|
||||
{
|
||||
const tr_info_t * inf = &tor->info;
|
||||
return block / ( inf->pieceSize / tor->blockSize );
|
||||
}
|
||||
|
||||
inline int _tr_blockSize( const tr_torrent_t * tor, int block )
|
||||
{
|
||||
const tr_info_t * inf = &tor->info;
|
||||
int dummy;
|
||||
|
||||
if( block != tor->blockCount - 1 ||
|
||||
!( dummy = inf->totalSize % tor->blockSize ) )
|
||||
{
|
||||
return tor->blockSize;
|
||||
}
|
||||
|
||||
return dummy;
|
||||
}
|
||||
|
||||
int _tr_blockPosInPiece( const tr_torrent_t * tor, int block )
|
||||
{
|
||||
const tr_info_t * inf = &tor->info;
|
||||
return tor->blockSize *
|
||||
( block % ( inf->pieceSize / tor->blockSize ) );
|
||||
}
|
||||
|
||||
int _tr_pieceCountBlocks( const tr_torrent_t * tor, int piece )
|
||||
{
|
||||
const tr_info_t * inf = &tor->info;
|
||||
if( piece < inf->pieceCount - 1 ||
|
||||
!( tor->blockCount % ( inf->pieceSize / tor->blockSize ) ) )
|
||||
{
|
||||
return inf->pieceSize / tor->blockSize;
|
||||
}
|
||||
return tor->blockCount % ( inf->pieceSize / tor->blockSize );
|
||||
}
|
||||
|
||||
int _tr_pieceStartBlock( const tr_torrent_t * tor, int piece )
|
||||
{
|
||||
const tr_info_t * inf = &tor->info;
|
||||
return piece * ( inf->pieceSize / tor->blockSize );
|
||||
}
|
||||
|
||||
int _tr_pieceSize( const tr_torrent_t * tor, int piece )
|
||||
{
|
||||
const tr_info_t * inf = &tor->info;
|
||||
if( piece < inf->pieceCount - 1 ||
|
||||
!( inf->totalSize % inf->pieceSize ) )
|
||||
{
|
||||
return inf->pieceSize;
|
||||
}
|
||||
return inf->totalSize % inf->pieceSize;
|
||||
}
|
||||
|
||||
int _tr_block( const tr_torrent_t * tor, int index, int begin )
|
||||
{
|
||||
const tr_info_t * inf = &tor->info;
|
||||
return index * ( inf->pieceSize / tor->blockSize ) +
|
||||
begin / tor->blockSize;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue