merge windows fix from RC_0_16

This commit is contained in:
Arvid Norberg 2012-04-02 03:32:26 +00:00
parent 6fc580e0cb
commit 21b51afd5f
3 changed files with 7 additions and 3 deletions

View File

@ -595,7 +595,11 @@ namespace libtorrent
mutable bool m_dirty; mutable bool m_dirty;
public: public:
#if TORRENT_COMPACT_PICKER
enum { max_pieces = piece_pos::we_have_index - 1 }; enum { max_pieces = piece_pos::we_have_index - 1 };
#else
enum { max_pieces = INT_MAX };
#endif
}; };
} }

View File

@ -88,7 +88,7 @@ struct average_accumulator
{ {
int ret; int ret;
if (m_num_samples == 0) ret = 0; if (m_num_samples == 0) ret = 0;
else ret = m_sample_sum / m_num_samples; else ret = int(m_sample_sum / m_num_samples);
m_num_samples = 0; m_num_samples = 0;
m_sample_sum = 0; m_sample_sum = 0;
return ret; return ret;

View File

@ -94,14 +94,14 @@ void test_running_torrent(boost::intrusive_ptr<torrent_info> info, size_type fil
{ {
h.piece_priority(0, 1); h.piece_priority(0, 1);
st = h.status(); st = h.status();
TEST_CHECK(st.pieces[0] == false); TEST_CHECK(st.pieces.size() > 0 && st.pieces[0] == false);
std::vector<char> piece(info->piece_length()); std::vector<char> piece(info->piece_length());
for (int i = 0; i < int(piece.size()); ++i) for (int i = 0; i < int(piece.size()); ++i)
piece[i] = (i % 26) + 'A'; piece[i] = (i % 26) + 'A';
h.add_piece(0, &piece[0]); h.add_piece(0, &piece[0]);
test_sleep(10000); test_sleep(10000);
st = h.status(); st = h.status();
TEST_CHECK(st.pieces[0] == true); TEST_CHECK(st.pieces.size() > 0 && st.pieces[0] == true);
std::cout << "reading piece 0" << std::endl; std::cout << "reading piece 0" << std::endl;
h.read_piece(0); h.read_piece(0);