1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 01:03:01 +00:00

(trunk libT) dead code removal -- the buffer & buflen arguments to tr_ioTestPiece() were unused

This commit is contained in:
Charles Kerr 2010-02-23 06:05:18 +00:00
parent 8973806d44
commit f1221f958f
3 changed files with 7 additions and 24 deletions

View file

@ -290,23 +290,15 @@ tr_ioWrite( tr_torrent * tor,
static tr_bool
recalculateHash( tr_torrent * tor,
tr_piece_index_t pieceIndex,
void * buffer,
size_t buflen,
uint8_t * setme )
{
size_t bytesLeft;
uint32_t offset = 0;
tr_bool success = TRUE;
uint8_t stackbuf[MAX_STACK_ARRAY_SIZE];
uint8_t buffer[MAX_STACK_ARRAY_SIZE];
const size_t buflen = MAX_STACK_ARRAY_SIZE;
SHA_CTX sha;
/* fallback buffer */
if( ( buffer == NULL ) || ( buflen < 1 ) )
{
buffer = stackbuf;
buflen = sizeof( stackbuf );
}
assert( tor != NULL );
assert( pieceIndex < tor->info.pieceCount );
assert( buffer != NULL );
@ -334,13 +326,10 @@ recalculateHash( tr_torrent * tor,
}
tr_bool
tr_ioTestPiece( tr_torrent * tor,
tr_piece_index_t pieceIndex,
void * buffer,
size_t buflen )
tr_ioTestPiece( tr_torrent * tor, tr_piece_index_t piece )
{
uint8_t hash[SHA_DIGEST_LENGTH];
return recalculateHash( tor, pieceIndex, buffer, buflen, hash )
&& !memcmp( hash, tor->info.pieces[pieceIndex].hash, SHA_DIGEST_LENGTH );
return recalculateHash( tor, piece, hash )
&& !memcmp( hash, tor->info.pieces[piece].hash, SHA_DIGEST_LENGTH );
}

View file

@ -52,15 +52,9 @@ int tr_ioWrite( struct tr_torrent * tor,
/**
* @brief Test to see if the piece matches its metainfo's SHA1 checksum.
*
* @param optionalBuffer if calling tr_ioTestPiece() repeatedly, you can
* get best performance by providing a buffer with
* tor->info.pieceSize bytes.
*/
tr_bool tr_ioTestPiece( tr_torrent * tor,
tr_piece_index_t piece,
void * optionalBuffer,
size_t optionalBufferLen );
tr_piece_index_t piece );
/**

View file

@ -1335,7 +1335,7 @@ peerCallbackFunc( void * vpeer, void * vevent, void * vt )
if( tr_cpPieceIsComplete( &tor->completion, e->pieceIndex ) )
{
const tr_piece_index_t p = e->pieceIndex;
const tr_bool ok = tr_ioTestPiece( tor, p, NULL, 0 );
const tr_bool ok = tr_ioTestPiece( tor, p );
if( !ok )
{