iterator fixes (to avoid triggering safe iterator asserts)

This commit is contained in:
Arvid Norberg 2008-01-19 18:12:02 +00:00
parent 5ff6708b3d
commit 365b8c07c6
2 changed files with 8 additions and 4 deletions

View File

@ -222,10 +222,13 @@ struct bandwidth_manager
TORRENT_ASSERT(current_quota == m_current_quota);
typename queue_t::const_iterator j = m_queue.begin();
++j;
for (typename queue_t::const_iterator i = m_queue.begin()
, end(m_queue.end()); i != end && j != end; ++i, ++j)
TORRENT_ASSERT(i->priority >= j->priority);
if (j != m_queue.end())
{
++j;
for (typename queue_t::const_iterator i = m_queue.begin()
, end(m_queue.end()); i != end && j != end; ++i, ++j)
TORRENT_ASSERT(i->priority >= j->priority);
}
}
#endif

View File

@ -2681,6 +2681,7 @@ namespace libtorrent
for (int c = 0; c < 2; ++c)
{
queue_t::const_iterator j = m_bandwidth_queue[c].begin();
if (j == m_bandwidth_queue[c].end()) continue;
++j;
for (queue_t::const_iterator i = m_bandwidth_queue[c].begin()
, end(m_bandwidth_queue[c].end()); i != end && j != end; ++i, ++j)