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:
parent
4230cd7786
commit
66d60160b3
1 changed files with 4 additions and 2 deletions
|
@ -50,6 +50,10 @@ countRange( const tr_bitfield * b, size_t begin, size_t end )
|
|||
const int first_byte = begin >> 3u;
|
||||
const int last_byte = ( end - 1 ) >> 3u;
|
||||
|
||||
if( !b->bit_count )
|
||||
return 0;
|
||||
|
||||
assert( begin < end );
|
||||
assert( b->bits != NULL );
|
||||
|
||||
if( first_byte == last_byte )
|
||||
|
@ -97,8 +101,6 @@ countRange( const tr_bitfield * b, size_t begin, size_t end )
|
|||
size_t
|
||||
tr_bitfieldCountRange( const tr_bitfield * b, size_t begin, size_t end )
|
||||
{
|
||||
assert( begin < end );
|
||||
|
||||
if( tr_bitfieldHasAll( b ) )
|
||||
return end - begin;
|
||||
|
||||
|
|
Loading…
Reference in a new issue