applied (slightly modified) patches from Allen Zhao in an attempt to make it build on vc7

This commit is contained in:
Arvid Norberg 2006-01-07 13:48:14 +00:00
parent 3888b5232f
commit 04ad901577
3 changed files with 13 additions and 8 deletions

View File

@ -154,7 +154,7 @@ namespace libtorrent
stat statistics() const { return m_stat; }
size_type bytes_left() const;
boost::tuple<size_type, size_type> bytes_done() const;
boost::tuples::tuple<size_type, size_type> bytes_done() const;
void pause();
void resume();

View File

@ -66,6 +66,9 @@ POSSIBILITY OF SUCH DAMAGE.
using namespace libtorrent;
using namespace boost::posix_time;
using boost::tuples::tuple;
using boost::tuples::get;
using boost::tuples::make_tuple;
// PROFILING CODE
@ -479,20 +482,20 @@ namespace libtorrent
// if we don't have the metadata yet, we
// cannot tell how big the torrent is.
if (!valid_metadata()) return -1;
return m_torrent_file.total_size() - boost::get<0>(bytes_done());
return m_torrent_file.total_size() - get<0>(bytes_done());
}
// the first value is the total number of bytes downloaded
// the second value is the number of bytes of those that haven't
// been filtered as not wanted we have downloaded
boost::tuple<size_type, size_type> torrent::bytes_done() const
tuple<size_type, size_type> torrent::bytes_done() const
{
if (!valid_metadata()) return 0;
if (!valid_metadata()) return tuple<size_type, size_type>(0,0);
assert(m_picker.get());
if (m_torrent_file.num_pieces() == 0)
return boost::tuple<size_type, size_type>(0,0);
return tuple<size_type, size_type>(0,0);
const int last_piece = m_torrent_file.num_pieces() - 1;
size_type wanted_done = (m_num_pieces - m_picker->num_have_filtered())
@ -578,7 +581,7 @@ namespace libtorrent
if (!m_picker->is_filtered(i->first.piece_index))
wanted_done += i->second;
}
return boost::make_tuple(total_done, wanted_done);
return make_tuple(total_done, wanted_done);
}
void torrent::piece_failed(int index)

View File

@ -47,6 +47,8 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/torrent.hpp"
using namespace libtorrent;
using boost::tuples::make_tuple;
using boost::tuples::tuple;
namespace
{
@ -366,7 +368,7 @@ namespace libtorrent
namespace
{
boost::tuple<std::string, std::string, int, std::string>
tuple<std::string, std::string, int, std::string>
parse_url_components(std::string url)
{
std::string hostname; // hostname only
@ -413,7 +415,7 @@ namespace libtorrent
}
start = end;
return boost::make_tuple(protocol, hostname, port
return make_tuple(protocol, hostname, port
, std::string(start, url.end()));
}
}