mirror of
https://github.com/transmission/transmission.git
synced 2026-05-08 09:39:08 +01:00
(trunk libT) fix bitset crash. add bitset.h to the automake file.
This commit is contained in:
@@ -63,6 +63,7 @@ noinst_HEADERS = \
|
||||
bandwidth.h \
|
||||
bencode.h \
|
||||
bitfield.h \
|
||||
bitset.h \
|
||||
blocklist.h \
|
||||
clients.h \
|
||||
ConvertUTF.h \
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
#ifndef TR_BITSET_H
|
||||
#define TR_BITSET_H 1
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "transmission.h"
|
||||
#include "bitfield.h"
|
||||
|
||||
@@ -46,8 +48,14 @@ tr_bitsetReserve( tr_bitset * b, size_t size )
|
||||
{
|
||||
if( b->bitfield.bitCount < size )
|
||||
{
|
||||
tr_bitfield * tmp = tr_bitfieldDup( &b->bitfield );
|
||||
|
||||
tr_bitfieldDestruct( &b->bitfield );
|
||||
tr_bitfieldConstruct( &b->bitfield, size );
|
||||
assert( b->bitfield.byteCount >= tmp->byteCount );
|
||||
memcpy( &b->bitfield.bits, tmp->bits, tmp->byteCount );
|
||||
|
||||
tr_bitfieldFree( tmp );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,6 +123,7 @@ tr_bitsetAdd( tr_bitset * b, int i )
|
||||
int ret = 0;
|
||||
if( !b->haveAll ) {
|
||||
b->haveNone = 0;
|
||||
tr_bitsetReserve( b, i );
|
||||
ret = tr_bitfieldAdd( &b->bitfield, i );
|
||||
}
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user