fix cppcheck warnings

This commit is contained in:
arvidn 2015-07-11 10:36:13 -04:00
parent bb058aa081
commit 2b05b1c85c
2 changed files with 5 additions and 5 deletions

View File

@ -3496,8 +3496,7 @@ namespace libtorrent
continue; continue;
} }
cached_piece_entry* pe = m_disk_cache.find_piece(j); cached_piece_entry* pe = m_disk_cache.add_dirty_block(j);
pe = m_disk_cache.add_dirty_block(j);
if (pe == NULL) if (pe == NULL)
{ {

View File

@ -862,9 +862,10 @@ namespace libtorrent
if (on_parole()) ret |= piece_picker::on_parole if (on_parole()) ret |= piece_picker::on_parole
| piece_picker::prioritize_partials; | piece_picker::prioritize_partials;
// only one of rarest_first and sequential can be set. // only one of rarest_first and sequential can be set. i.e. the sum of
TORRENT_ASSERT((ret & piece_picker::rarest_first) ? 1 : 0 // whether the bit is set or not may only be 0 or 1 (never 2)
+ (ret & piece_picker::sequential) ? 1 : 0 <= 1); TORRENT_ASSERT(((ret & piece_picker::rarest_first) ? 1 : 0)
+ ((ret & piece_picker::sequential) ? 1 : 0) <= 1);
return ret; return ret;
} }