mirror of
https://github.com/transmission/transmission
synced 2025-02-03 21:12:05 +00:00
(trunk libT) add more tests to verify r8214
This commit is contained in:
parent
35564b76a4
commit
b3813000e9
1 changed files with 5 additions and 2 deletions
|
@ -403,12 +403,11 @@ tr_torrentInitFilePieces( tr_torrent * tor )
|
|||
/* build the array of first-file hints to give calculatePiecePriority */
|
||||
firstFiles = tr_new( int, inf->pieceCount );
|
||||
for( p=f=0; p<inf->pieceCount; ++p ) {
|
||||
if( inf->files[f].lastPiece < p )
|
||||
while( inf->files[f].lastPiece < p )
|
||||
++f;
|
||||
firstFiles[p] = f;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
/* test to confirm the first-file hints are correct */
|
||||
for( p=0; p<inf->pieceCount; ++p ) {
|
||||
|
@ -417,6 +416,10 @@ tr_torrentInitFilePieces( tr_torrent * tor )
|
|||
assert( inf->files[f].lastPiece >= p );
|
||||
if( f > 0 )
|
||||
assert( inf->files[f-1].lastPiece < p );
|
||||
for( f=0; f<inf->fileCount; ++f )
|
||||
if( pieceHasFile( p, &inf->files[f] ) )
|
||||
break;
|
||||
assert( (int)f == firstFiles[p] );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue