forward port piece_block patch from RC_1_0

This commit is contained in:
arvidn 2015-11-07 18:50:54 -05:00
parent 06f702b21a
commit a48cb785d0
3 changed files with 6 additions and 8 deletions

View File

@ -78,6 +78,7 @@
1.0.7 release
* fix support for torrents with > 500'000 pieces
* fix ip filter bug when banning peers
* fix IPv6 IP address resolution in URLs
* introduce run-time check for torrent info-sections beeing too large

View File

@ -79,15 +79,13 @@ namespace libtorrent
static const piece_block invalid;
piece_block() {}
piece_block(boost::uint32_t p_index, boost::uint16_t b_index)
piece_block(int p_index, int b_index)
: piece_index(p_index)
, block_index(b_index)
{
TORRENT_ASSERT(p_index < (1 << 19));
TORRENT_ASSERT(b_index < (1 << 13));
}
boost::uint32_t piece_index:19;
boost::uint32_t block_index:13;
int piece_index;
int block_index;
bool operator<(piece_block const& b) const
{
@ -838,8 +836,7 @@ namespace libtorrent
#ifdef TORRENT_OPTIMIZE_MEMORY_USAGE
enum { max_pieces = piece_pos::we_have_index - 1 };
#else
// still limited by piece_block
enum { max_pieces = (1 << 19) - 2 };
enum { max_pieces = (std::numeric_limits<int>::max)() - 1 };
#endif
};

View File

@ -68,7 +68,7 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent
{
const piece_block piece_block::invalid(0x7FFFF, 0x1FFF);
const piece_block piece_block::invalid((std::numeric_limits<int>::max)(), (std::numeric_limits<int>::max)());
piece_picker::piece_picker()
: m_seeds(0)