merged changes from RC_1_0

This commit is contained in:
Arvid Norberg 2014-12-01 10:43:34 +00:00
parent fd313fe6bf
commit 4376d26399
6 changed files with 28 additions and 33 deletions

View File

@ -156,6 +156,8 @@ rule linking ( properties * )
&& ( <variant>debug in $(properties)
|| <asserts>on in $(properties)
|| <asserts>production in $(properties)
|| <pool-allocators>debug in $(properties)
|| <allocator>debug in $(properties)
|| <asio-debugging>on in $(properties) )
{
# for backtraces in assertion failures
@ -185,7 +187,9 @@ rule linking ( properties * )
result += <library>/boost/random//boost_random/<link>static ;
}
if <toolset>gcc in $(properties) && <link>shared in $(properties)
if <toolset>gcc in $(properties)
&& ! <target-os>windows in $(properties)
&& <link>shared in $(properties)
{
result += <fpic>on ;
}
@ -266,7 +270,7 @@ rule building ( properties * )
result += <source>src/sha1.cpp ;
}
if ! ( <encryption>off in $(properties) )
if ! <encryption>off in $(properties)
{
result += <source>src/pe_crypto.cpp ;
}

View File

@ -68,18 +68,6 @@ POSSIBILITY OF SUCH DAMAGE.
build, to automatically apply these defines
#endif
// some parts pulled out of stdint.h
// to avoid C99 or C++11 dependency
#if !defined INT64_MAX
#define INT64_MAX 0x7fffffffffffffffLL
#endif
#if !defined INT16_MAX
#define INT16_MAX 32767
#endif
#if !defined INT16_MIN
#define INT16_MIN -32768
#endif
#ifndef _MSC_VER
#ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS 1

View File

@ -2866,7 +2866,7 @@ namespace libtorrent
recv_buffer = m_recv_buffer.get();
int crypto_field = detail::read_int32(recv_buffer.begin);
boost::uint32_t crypto_field = detail::read_uint32(recv_buffer.begin);
#ifdef TORRENT_VERBOSE_LOGGING
peer_log("*** crypto %s : [%s%s ]"
@ -2879,13 +2879,13 @@ namespace libtorrent
{
// select a crypto method
int allowed_encryption = m_settings.get_int(settings_pack::allowed_enc_level);
int crypto_select = crypto_field & allowed_encryption;
boost::uint32_t crypto_select = crypto_field & allowed_encryption;
// when prefer_rc4 is set, keep the most significant bit
// otherwise keep the least significant one
if (m_settings.get_bool(settings_pack::prefer_rc4))
{
int mask = INT_MAX;
boost::uint32_t mask = (std::numeric_limits<boost::uint32_t>::max)();
while (crypto_select & (mask << 1))
{
mask <<= 1;
@ -2894,7 +2894,7 @@ namespace libtorrent
}
else
{
int mask = INT_MAX;
boost::uint32_t mask = (std::numeric_limits<boost::uint32_t>::max)();
while (crypto_select & (mask >> 1))
{
mask >>= 1;

View File

@ -33,6 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/config.hpp"
#include "libtorrent/lazy_entry.hpp"
#include <cstring>
#include <limits> // for numeric_limits
namespace
{
@ -83,14 +84,14 @@ namespace libtorrent
ec = bdecode_errors::expected_string;
return start;
}
if (val > INT64_MAX / 10)
if (val > (std::numeric_limits<boost::int64_t>::max)() / 10)
{
ec = bdecode_errors::overflow;
return start;
}
val *= 10;
int digit = *start - '0';
if (val > INT64_MAX - digit)
if (val > (std::numeric_limits<boost::int64_t>::max)() - digit)
{
ec = bdecode_errors::overflow;
return start;

View File

@ -35,6 +35,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <set>
#include <cctype>
#include <numeric>
#include <limits> // for numeric_limits
#ifdef _MSC_VER
#pragma warning(push, 1)
@ -224,16 +225,16 @@ namespace libtorrent
, m_deleted(false)
, m_pinned(p.flags & add_torrent_params::flag_pinned)
, m_should_be_loaded(true)
, m_last_download(INT16_MIN)
, m_last_download((std::numeric_limits<boost::int16_t>::min)())
, m_num_seeds(0)
, m_last_upload(INT16_MIN)
, m_last_upload((std::numeric_limits<boost::int16_t>::min)())
, m_storage_tick(0)
, m_auto_managed(p.flags & add_torrent_params::flag_auto_managed)
, m_current_gauge_state(no_gauge_state)
, m_moving_storage(false)
, m_inactive(false)
, m_downloaded(0xffffff)
, m_last_scrape(INT16_MIN)
, m_last_scrape((std::numeric_limits<boost::int16_t>::min)())
, m_progress_ppm(0)
, m_use_resume_save_path(p.flags & add_torrent_params::flag_use_resume_save_path)
{
@ -6562,11 +6563,11 @@ namespace libtorrent
int now = m_ses.session_time();
int tmp = rd.dict_find_int_value("last_scrape", -1);
m_last_scrape = tmp == -1 ? INT16_MIN : now - tmp;
m_last_scrape = tmp == -1 ? (std::numeric_limits<boost::int16_t>::min)() : now - tmp;
tmp = rd.dict_find_int_value("last_download", -1);
m_last_download = tmp == -1 ? INT16_MIN : now - tmp;
m_last_download = tmp == -1 ? (std::numeric_limits<boost::int16_t>::min)() : now - tmp;
tmp = rd.dict_find_int_value("last_upload", -1);
m_last_upload = tmp == -1 ? INT16_MIN : now - tmp;
m_last_upload = tmp == -1 ? (std::numeric_limits<boost::int16_t>::min)() : now - tmp;
if (m_use_resume_save_path)
{
@ -11222,7 +11223,7 @@ namespace libtorrent
st->added_time = m_added_time;
st->completed_time = m_completed_time;
st->last_scrape = m_last_scrape == INT16_MIN ? -1
st->last_scrape = m_last_scrape == (std::numeric_limits<boost::int16_t>::min)() ? -1
: clamped_subtract(m_ses.session_time(), m_last_scrape);
st->share_mode = m_share_mode;
@ -11254,9 +11255,9 @@ namespace libtorrent
st->finished_time = finished_time();
st->active_time = active_time();
st->seeding_time = seeding_time();
st->time_since_upload = m_last_upload == INT16_MIN ? -1
st->time_since_upload = m_last_upload == (std::numeric_limits<boost::int16_t>::min)() ? -1
: clamped_subtract(m_ses.session_time(), m_last_upload);
st->time_since_download = m_last_download == INT16_MIN ? -1
st->time_since_download = m_last_download == (std::numeric_limits<boost::int16_t>::min)() ? -1
: clamped_subtract(m_ses.session_time(), m_last_download);
st->storage_mode = (storage_mode_t)m_storage_mode;

View File

@ -41,6 +41,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/invariant_check.hpp"
#include "libtorrent/performance_counters.hpp"
#include <boost/cstdint.hpp>
#include <limits>
#define TORRENT_UTP_LOG 0
#define TORRENT_VERBOSE_UTP_LOG 0
@ -280,7 +281,7 @@ struct utp_socket_impl
{
TORRENT_ASSERT(m_userdata);
for (int i = 0; i != num_delay_hist; ++i)
m_delay_sample_hist[i] = UINT_MAX;
m_delay_sample_hist[i] = (std::numeric_limits<boost::uint32_t>::max)();
}
~utp_socket_impl();
@ -2735,7 +2736,7 @@ bool utp_socket_impl::incoming_packet(boost::uint8_t const* buf, int size
++m_duplicate_acks;
}
boost::uint32_t min_rtt = UINT_MAX;
boost::uint32_t min_rtt = (std::numeric_limits<boost::uint32_t>::max)();
TORRENT_ASSERT(m_outbuf.at((m_acked_seq_nr + 1) & ACK_MASK) || ((m_seq_nr - m_acked_seq_nr) & ACK_MASK) <= 1);
@ -3287,8 +3288,8 @@ void utp_socket_impl::do_ledbat(int acked_bytes, int delay, int in_flight)
}
// make sure we don't wrap the cwnd
if (scaled_gain >= INT64_MAX - m_cwnd)
scaled_gain = INT64_MAX - m_cwnd - 1;
if (scaled_gain >= (std::numeric_limits<boost::int64_t>::max)() - m_cwnd)
scaled_gain = (std::numeric_limits<boost::int64_t>::max)() - m_cwnd - 1;
UTP_LOGV("%8p: do_ledbat delay:%d off_target: %d window_factor:%f target_factor:%f "
"scaled_gain:%f cwnd:%d slow_start:%d\n"