(trunk libT) undo all the test commits for #2533 from r9445 through r9451. The problem appears to be an llvm issue, reported upstream @ apple dev center bug #7353773

This commit is contained in:
Charles Kerr 2009-10-31 00:54:03 +00:00
parent e777fefd63
commit 3a75050be4
1 changed files with 4 additions and 30 deletions

View File

@ -1045,7 +1045,6 @@ fileBytesCompleted( const tr_torrent * tor, tr_file_index_t index )
{
uint64_t total = 0;
const tr_file * f = &tor->info.files[index];
fprintf( stderr, "in fileBytesCompleted for file #%d\n", (int)index );
if( f->length )
{
@ -1055,13 +1054,11 @@ fprintf( stderr, "in fileBytesCompleted for file #%d\n", (int)index );
if( firstBlock == lastBlock )
{
fprintf( stderr, "file fits in a single block\n" );
if( tr_cpBlockIsCompleteFast( &tor->completion, firstBlock ) )
total = f->length;
}
else
{
//uint32_t i;
tr_block_index_t i;
/* the first block */
@ -1071,7 +1068,6 @@ fprintf( stderr, "file fits in a single block\n" );
/* the middle blocks */
if( f->firstPiece == f->lastPiece )
{
fprintf( stderr, "f->firstPiece == f->lastPiece\n" );
for( i=firstBlock+1; i<lastBlock; ++i )
if( tr_cpBlockIsCompleteFast( &tor->completion, i ) )
total += tor->blockSize;
@ -1086,28 +1082,16 @@ fprintf( stderr, "f->firstPiece == f->lastPiece\n" );
+ tr_torPieceCountBlocks( tor, f->firstPiece ) - 1;
/* the rest of the first piece */
fprintf( stderr, "looping on the rest of the first piece\n" );
fprintf( stderr, "firstBlock is %"PRIu64"\n", (uint64_t)firstBlock );
fprintf( stderr, "lastBlock is %"PRIu64"\n", (uint64_t)lastBlock );
fprintf( stderr, "lastBlockOfFirstPiece is %"PRIu64"\n", (uint64_t)lastBlockOfFirstPiece );
//for( i=firstBlock+1; i<lastBlock && i<=lastBlockOfFirstPiece; ++i ) {
for( i=firstBlock+1; i<lastBlock && i<=lastBlockOfFirstPiece; ) {
fprintf( stderr, "looping on i(1): %"PRIu64"\n", i );
// if( tr_cpBlockIsCompleteFast( &tor->completion, i ) ) {
// ++b;
// }
++i;
fprintf( stderr, "looping on i(2): %"PRIu64"\n", i );
}
for( i=firstBlock+1; i<lastBlock && i<=lastBlockOfFirstPiece; ++i )
if( tr_cpBlockIsCompleteFast( &tor->completion, i ) )
++b;
/* the middle pieces */
fprintf( stderr, "looking at the middle pieces\n" );
if( f->firstPiece + 1 < f->lastPiece )
for( i=f->firstPiece+1; i<f->lastPiece; ++i )
b += tor->blockCountInPiece - tr_cpMissingBlocksInPiece( &tor->completion, i );
/* the rest of the last piece */
fprintf( stderr, "looping on the rest of the last piece\n" );
for( i=firstBlockOfLastPiece; i<lastBlock; ++i )
if( tr_cpBlockIsCompleteFast( &tor->completion, i ) )
++b;
@ -1121,7 +1105,6 @@ fprintf( stderr, "looping on the rest of the last piece\n" );
total += ( f->offset + f->length ) - ( tor->blockSize * lastBlock );
}
}
fprintf( stderr, "finished fileBytesCompleted for file #%d\n", (int)index );
return total;
}
@ -1135,27 +1118,18 @@ tr_torrentFiles( const tr_torrent * tor,
tr_file_stat * files = tr_new0( tr_file_stat, n );
tr_file_stat * walk = files;
const tr_bool isSeed = tor->completeness == TR_SEED;
static int numCalls = 0;
fprintf( stderr, "entering tr_torrentFiles for the %d time\n", ++numCalls );
assert( tr_isTorrent( tor ) );
for( i=0; i<n; ++i, ++walk )
{
fprintf( stderr, "looking at file #%d of %d\n", (int)i, (int)n );
for( i=0; i<n; ++i, ++walk ) {
const uint64_t b = isSeed ? tor->info.files[i].length : fileBytesCompleted( tor, i );
fprintf( stderr, "file has %"PRIu64" out of %"PRIu64" bytes\n", b, tor->info.files[i].length );
walk->bytesCompleted = b;
walk->progress = tr_getRatio( b, tor->info.files[i].length );
fprintf( stderr, "walk->progress is %f\n", walk->progress );
}
if( fileCount )
*fileCount = n;
fprintf( stderr, "tr_torrentFiles finished\n" );
return files;
}