(trunk libT) #4048 "use bitsets instead of bitfield in tr_completion" -- done.

Excuse the sprawl. Much of this didn't fit into self-contained commits.
This commit is contained in:
Jordan Lee
2011-02-23 03:54:04 +00:00
parent 6754258823
commit 2b9db3c242
19 changed files with 813 additions and 655 deletions

View File

@@ -561,10 +561,11 @@ addField( const tr_torrent * tor, tr_benc * d, const char * key )
else if( tr_streq( key, keylen, "peersSendingToUs" ) )
tr_bencDictAddInt( d, key, st->peersSendingToUs );
else if( tr_streq( key, keylen, "pieces" ) ) {
const tr_bitfield * pieces = tr_cpPieceBitfield( &tor->completion );
char * str = tr_base64_encode( pieces->bits, pieces->byteCount, NULL );
tr_bitfield * bf = tr_cpCreatePieceBitfield( &tor->completion );
char * str = tr_base64_encode( bf->bits, bf->byteCount, NULL );
tr_bencDictAddStr( d, key, str!=NULL ? str : "" );
tr_free( str );
tr_bitfieldFree( bf );
}
else if( tr_streq( key, keylen, "pieceCount" ) )
tr_bencDictAddInt( d, key, inf->pieceCount );