attempt to fix build errors on windows. #134

This commit is contained in:
Arvid Norberg 2007-08-21 04:46:17 +00:00
parent c946afcfab
commit b8e48c061e
5 changed files with 22 additions and 22 deletions

View File

@ -523,7 +523,7 @@ namespace libtorrent { namespace
if (num_blocks < 1) num_blocks = 1;
assert(num_blocks <= 128);
int min_element = std::numeric_limits<int>::max();
int min_element = (std::numeric_limits<int>::max)();
int best_index = 0;
for (int i = 0; i < 256 - num_blocks + 1; ++i)
{

View File

@ -1903,7 +1903,7 @@ namespace libtorrent
void peer_connection::set_upload_limit(int limit)
{
assert(limit >= -1);
if (limit == -1) limit = std::numeric_limits<int>::max();
if (limit == -1) limit = (std::numeric_limits<int>::max)();
if (limit < 10) limit = 10;
m_upload_limit = limit;
m_bandwidth_limit[upload_channel].throttle(m_upload_limit);
@ -1912,7 +1912,7 @@ namespace libtorrent
void peer_connection::set_download_limit(int limit)
{
assert(limit >= -1);
if (limit == -1) limit = std::numeric_limits<int>::max();
if (limit == -1) limit = (std::numeric_limits<int>::max)();
if (limit < 10) limit = 10;
m_download_limit = limit;
m_bandwidth_limit[download_channel].throttle(m_download_limit);
@ -1930,7 +1930,7 @@ namespace libtorrent
// if we have an infinite ratio, just say we have downloaded
// much more than we have uploaded. And we'll keep uploading.
if (ratio == 0.f)
return std::numeric_limits<size_type>::max();
return (std::numeric_limits<size_type>::max)();
return m_free_upload
+ static_cast<size_type>(m_statistics.total_payload_download() * ratio)
@ -2170,7 +2170,7 @@ namespace libtorrent
+ bias) / break_even_time, double(m_upload_limit));
upload_speed_limit = (std::min)(upload_speed_limit,
(double)std::numeric_limits<int>::max());
(double)(std::numeric_limits<int>::max)());
m_bandwidth_limit[upload_channel].throttle(
(std::min)((std::max)((int)upload_speed_limit, 20)

View File

@ -1982,7 +1982,7 @@ namespace detail
{
assert(limit > 0 || limit == -1);
mutex_t::scoped_lock l(m_mutex);
if (limit <= 0) limit = std::numeric_limits<int>::max();
if (limit <= 0) limit = (std::numeric_limits<int>::max)();
m_max_uploads = limit;
}
@ -1990,7 +1990,7 @@ namespace detail
{
assert(limit > 0 || limit == -1);
mutex_t::scoped_lock l(m_mutex);
if (limit <= 0) limit = std::numeric_limits<int>::max();
if (limit <= 0) limit = (std::numeric_limits<int>::max)();
m_max_connections = limit;
}
@ -1998,7 +1998,7 @@ namespace detail
{
assert(limit > 0 || limit == -1);
mutex_t::scoped_lock l(m_mutex);
if (limit <= 0) limit = std::numeric_limits<int>::max();
if (limit <= 0) limit = (std::numeric_limits<int>::max)();
m_half_open.limit(limit);
}
@ -2036,14 +2036,14 @@ namespace detail
{
mutex_t::scoped_lock l(m_mutex);
int ret = m_bandwidth_manager[peer_connection::upload_channel]->throttle();
return ret == std::numeric_limits<int>::max() ? -1 : ret;
return ret == (std::numeric_limits<int>::max)() ? -1 : ret;
}
int session_impl::download_rate_limit() const
{
mutex_t::scoped_lock l(m_mutex);
int ret = m_bandwidth_manager[peer_connection::download_channel]->throttle();
return ret == std::numeric_limits<int>::max() ? -1 : ret;
return ret == (std::numeric_limits<int>::max)() ? -1 : ret;
}
void session_impl::start_lsd()

View File

@ -199,9 +199,9 @@ namespace libtorrent
, m_connections_initialized(true)
, m_settings(s)
, m_storage_constructor(sc)
, m_max_uploads(std::numeric_limits<int>::max())
, m_max_uploads((std::numeric_limits<int>::max)())
, m_num_uploads(0)
, m_max_connections(std::numeric_limits<int>::max())
, m_max_connections((std::numeric_limits<int>::max)())
{
#ifndef NDEBUG
m_initial_done = 0;
@ -262,9 +262,9 @@ namespace libtorrent
, m_connections_initialized(false)
, m_settings(s)
, m_storage_constructor(sc)
, m_max_uploads(std::numeric_limits<int>::max())
, m_max_uploads((std::numeric_limits<int>::max)())
, m_num_uploads(0)
, m_max_connections(std::numeric_limits<int>::max())
, m_max_connections((std::numeric_limits<int>::max)())
{
#ifndef NDEBUG
m_initial_done = 0;
@ -2459,14 +2459,14 @@ namespace libtorrent
void torrent::set_max_uploads(int limit)
{
assert(limit >= -1);
if (limit <= 0) limit = std::numeric_limits<int>::max();
if (limit <= 0) limit = (std::numeric_limits<int>::max)();
m_max_uploads = limit;
}
void torrent::set_max_connections(int limit)
{
assert(limit >= -1);
if (limit <= 0) limit = std::numeric_limits<int>::max();
if (limit <= 0) limit = (std::numeric_limits<int>::max)();
m_max_connections = limit;
}
@ -2489,7 +2489,7 @@ namespace libtorrent
void torrent::set_upload_limit(int limit)
{
assert(limit >= -1);
if (limit <= 0) limit = std::numeric_limits<int>::max();
if (limit <= 0) limit = (std::numeric_limits<int>::max)();
if (limit < num_peers() * 10) limit = num_peers() * 10;
m_bandwidth_limit[peer_connection::upload_channel].throttle(limit);
}
@ -2497,14 +2497,14 @@ namespace libtorrent
int torrent::upload_limit() const
{
int limit = m_bandwidth_limit[peer_connection::upload_channel].throttle();
if (limit == std::numeric_limits<int>::max()) limit = -1;
if (limit == (std::numeric_limits<int>::max)()) limit = -1;
return limit;
}
void torrent::set_download_limit(int limit)
{
assert(limit >= -1);
if (limit <= 0) limit = std::numeric_limits<int>::max();
if (limit <= 0) limit = (std::numeric_limits<int>::max)();
if (limit < num_peers() * 10) limit = num_peers() * 10;
m_bandwidth_limit[peer_connection::download_channel].throttle(limit);
}
@ -2512,7 +2512,7 @@ namespace libtorrent
int torrent::download_limit() const
{
int limit = m_bandwidth_limit[peer_connection::download_channel].throttle();
if (limit == std::numeric_limits<int>::max()) limit = -1;
if (limit == (std::numeric_limits<int>::max)()) limit = -1;
return limit;
}

View File

@ -510,7 +510,7 @@ namespace libtorrent
// m_piece as buffer.
int piece_size = int(m_piece.size());
int copy_size = (std::min)(std::min(front_request.length - piece_size
int copy_size = (std::min)((std::min)(front_request.length - piece_size
, recv_buffer.left()), int(range_end - range_start - m_received_body));
m_piece.resize(piece_size + copy_size);
assert(copy_size > 0);
@ -568,7 +568,7 @@ namespace libtorrent
&& (m_received_body + recv_buffer.left() >= range_end - range_start))
{
int piece_size = int(m_piece.size());
int copy_size = (std::min)(std::min(m_requests.front().length - piece_size
int copy_size = (std::min)((std::min)(m_requests.front().length - piece_size
, recv_buffer.left()), int(range_end - range_start - m_received_body));
assert(copy_size >= 0);
if (copy_size > 0)