fix unsigned comparison warnings

This commit is contained in:
Arvid Norberg 2012-05-03 01:51:56 +00:00
parent 7094b02f06
commit 86b4c78871
2 changed files with 20 additions and 19 deletions

View File

@ -2909,9 +2909,10 @@ namespace libtorrent
TORRENT_ASSERT(!m_disconnecting);
TORRENT_ASSERT(t->valid_metadata());
TORRENT_ASSERT(block.piece_index >= 0);
TORRENT_ASSERT(block.block_index != piece_block::invalid.block_index);
TORRENT_ASSERT(block.piece_index != piece_block::invalid.piece_index);
TORRENT_ASSERT(int(block.piece_index) < t->torrent_file().num_pieces());
TORRENT_ASSERT(block.block_index >= 0);
TORRENT_ASSERT(int(block.block_index) < t->torrent_file().piece_size(block.piece_index));
TORRENT_ASSERT(!t->picker().is_requested(block) || (t->picker().num_peers(block) > 0));
TORRENT_ASSERT(!t->have_piece(block.piece_index));
@ -3048,9 +3049,9 @@ namespace libtorrent
TORRENT_ASSERT(t->valid_metadata());
TORRENT_ASSERT(block.piece_index >= 0);
TORRENT_ASSERT(block.block_index != piece_block::invalid.block_index);
TORRENT_ASSERT(block.piece_index != piece_block::invalid.piece_index);
TORRENT_ASSERT(int(block.piece_index) < t->torrent_file().num_pieces());
TORRENT_ASSERT(block.block_index >= 0);
TORRENT_ASSERT(int(block.block_index) < t->torrent_file().piece_size(block.piece_index));
// if all the peers that requested this block has been

View File

@ -2046,8 +2046,8 @@ namespace libtorrent
bool piece_picker::is_requested(piece_block block) const
{
TORRENT_ASSERT(block.piece_index >= 0);
TORRENT_ASSERT(block.block_index >= 0);
TORRENT_ASSERT(block.block_index != piece_block::invalid.block_index);
TORRENT_ASSERT(block.piece_index != piece_block::invalid.piece_index);
TORRENT_ASSERT(block.piece_index < m_piece_map.size());
if (m_piece_map[block.piece_index].downloading == 0) return false;
@ -2060,8 +2060,8 @@ namespace libtorrent
bool piece_picker::is_downloaded(piece_block block) const
{
TORRENT_ASSERT(block.piece_index >= 0);
TORRENT_ASSERT(block.block_index >= 0);
TORRENT_ASSERT(block.block_index != piece_block::invalid.block_index);
TORRENT_ASSERT(block.piece_index != piece_block::invalid.piece_index);
TORRENT_ASSERT(block.piece_index < m_piece_map.size());
if (m_piece_map[block.piece_index].index == piece_pos::we_have_index) return true;
@ -2075,8 +2075,8 @@ namespace libtorrent
bool piece_picker::is_finished(piece_block block) const
{
TORRENT_ASSERT(block.piece_index >= 0);
TORRENT_ASSERT(block.block_index >= 0);
TORRENT_ASSERT(block.block_index != piece_block::invalid.block_index);
TORRENT_ASSERT(block.piece_index != piece_block::invalid.piece_index);
TORRENT_ASSERT(block.piece_index < m_piece_map.size());
if (m_piece_map[block.piece_index].index == piece_pos::we_have_index) return true;
@ -2092,8 +2092,8 @@ namespace libtorrent
{
TORRENT_ASSERT(peer == 0 || static_cast<policy::peer*>(peer)->in_use);
TORRENT_ASSERT(state != piece_picker::none);
TORRENT_ASSERT(block.piece_index >= 0);
TORRENT_ASSERT(block.block_index >= 0);
TORRENT_ASSERT(block.block_index != piece_block::invalid.block_index);
TORRENT_ASSERT(block.piece_index != piece_block::invalid.piece_index);
TORRENT_ASSERT(block.piece_index < m_piece_map.size());
TORRENT_ASSERT(int(block.block_index) < blocks_in_piece(block.piece_index));
TORRENT_ASSERT(!m_piece_map[block.piece_index].have());
@ -2150,8 +2150,8 @@ namespace libtorrent
int piece_picker::num_peers(piece_block block) const
{
TORRENT_ASSERT(block.piece_index >= 0);
TORRENT_ASSERT(block.block_index >= 0);
TORRENT_ASSERT(block.block_index != piece_block::invalid.block_index);
TORRENT_ASSERT(block.piece_index != piece_block::invalid.piece_index);
TORRENT_ASSERT(block.piece_index < m_piece_map.size());
TORRENT_ASSERT(int(block.block_index) < blocks_in_piece(block.piece_index));
@ -2186,8 +2186,8 @@ namespace libtorrent
TORRENT_ASSERT(peer == 0 || static_cast<policy::peer*>(peer)->in_use);
TORRENT_ASSERT(block.piece_index >= 0);
TORRENT_ASSERT(block.block_index >= 0);
TORRENT_ASSERT(block.block_index != piece_block::invalid.block_index);
TORRENT_ASSERT(block.piece_index != piece_block::invalid.piece_index);
TORRENT_ASSERT(block.piece_index < m_piece_map.size());
TORRENT_ASSERT(int(block.block_index) < blocks_in_piece(block.piece_index));
@ -2389,7 +2389,7 @@ namespace libtorrent
if (i == m_downloads.end()) return 0;
TORRENT_ASSERT(block.block_index >= 0);
TORRENT_ASSERT(block.block_index != piece_block::invalid.block_index);
TORRENT_ASSERT(i->info[block.block_index].piece_index == block.piece_index);
if (i->info[block.block_index].state == block_info::state_none)
@ -2410,8 +2410,8 @@ namespace libtorrent
TORRENT_ASSERT(peer == 0 || static_cast<policy::peer*>(peer)->in_use);
TORRENT_ASSERT(block.piece_index >= 0);
TORRENT_ASSERT(block.block_index >= 0);
TORRENT_ASSERT(block.block_index != piece_block::invalid.block_index);
TORRENT_ASSERT(block.piece_index != piece_block::invalid.piece_index);
TORRENT_ASSERT(block.piece_index < m_piece_map.size());
TORRENT_ASSERT(int(block.block_index) < blocks_in_piece(block.piece_index));