some defensive programming. cleanup unused boost include. tighten up boost includes

This commit is contained in:
Arvid Norberg 2013-12-17 23:26:44 +00:00
parent 91c622bec0
commit adb3a5523c
3 changed files with 11 additions and 3 deletions

View File

@ -188,7 +188,10 @@ rule linking ( properties * )
result += <library>/boost/date_time//boost_date_time/<link>shared ;
}
}
result += <include>$(BOOST_ROOT) <define>BOOST_ALL_NO_LIB ;
result += <include>$(BOOST_ROOT)
<define>BOOST_ALL_NO_LIB
<define>BOOST_MULTI_INDEX_DISABLE_SERIALIZATION
;
}
else

View File

@ -3958,11 +3958,17 @@ namespace libtorrent
TORRENT_ASSERT(int(m_recv_buffer.size()) >= m_recv_pos);
TORRENT_ASSERT(m_recv_pos >= size + offset);
TORRENT_ASSERT(offset >= 0);
TORRENT_ASSERT(size >= 0);
if (size > 0)
{
std::memmove(&m_recv_buffer[0] + offset, &m_recv_buffer[0] + offset + size, m_recv_pos - size - offset);
if (m_recv_pos - size - offset > 0)
std::memmove(&m_recv_buffer[0] + offset, &m_recv_buffer[0] + offset + size, m_recv_pos - size - offset);
m_recv_pos -= size;
// defensive. If this actually happens, we would have triggered
// an assert already (if asserts are enabled).
if (m_recv_pos < 0) m_recv_pos = 0;
}
#ifdef TORRENT_DEBUG

View File

@ -30,7 +30,6 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include <cassert>
#include <boost/timer.hpp>
#include <iostream>
#include <vector>
#include <utility>