1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 09:37:56 +00:00

(trunk libT) fix bitfield.c assertion failure reported by Rolcol

This commit is contained in:
Jordan Lee 2011-03-29 16:39:30 +00:00
parent 4230cd7786
commit 66d60160b3

View file

@ -50,6 +50,10 @@ countRange( const tr_bitfield * b, size_t begin, size_t end )
const int first_byte = begin >> 3u; const int first_byte = begin >> 3u;
const int last_byte = ( end - 1 ) >> 3u; const int last_byte = ( end - 1 ) >> 3u;
if( !b->bit_count )
return 0;
assert( begin < end );
assert( b->bits != NULL ); assert( b->bits != NULL );
if( first_byte == last_byte ) if( first_byte == last_byte )
@ -97,8 +101,6 @@ countRange( const tr_bitfield * b, size_t begin, size_t end )
size_t size_t
tr_bitfieldCountRange( const tr_bitfield * b, size_t begin, size_t end ) tr_bitfieldCountRange( const tr_bitfield * b, size_t begin, size_t end )
{ {
assert( begin < end );
if( tr_bitfieldHasAll( b ) ) if( tr_bitfieldHasAll( b ) )
return end - begin; return end - begin;