fix build issue, some warnings

This commit is contained in:
Arvid Norberg 2015-05-17 23:32:13 +00:00
parent b480f40a98
commit 71ee44ae5e
14 changed files with 44 additions and 39 deletions

14
Jamfile
View File

@ -717,7 +717,7 @@ ED25519_SOURCES =
verify
;
local usage-requirements =
local usage-requirements =
<include>./include
<include>./include/libtorrent
<include>/usr/sfw/include
@ -795,10 +795,10 @@ lib torrent
headers = [ path.glob-tree include/libtorrent : *.hpp ] ;
package.install install
: <install-source-root>libtorrent
<install-no-version-symlinks>on
:
: torrent
: $(headers)
;
: <install-source-root>libtorrent
<install-no-version-symlinks>on
:
: torrent
: $(headers)
;

View File

@ -418,11 +418,11 @@ namespace libtorrent
aux::session_settings const& settings() const;
aux::session_interface& session() { return m_ses; }
void set_sequential_download(bool sd);
bool is_sequential_download() const
{ return m_sequential_download || m_auto_sequential; }
void queue_up();
void queue_down();
void set_queue_position(int p);

View File

@ -62,7 +62,7 @@ namespace libtorrent
if (!m_alerts[m_generation].empty())
return m_alerts[m_generation].front();
// this call can be interrupted prematurely by other signals
m_condition.wait_for(lock, max_wait);
if (!m_alerts[m_generation].empty())

View File

@ -531,7 +531,7 @@ void node::send_single_refresh(udp::endpoint const& ep, int bucket
node_id target = generate_secret_id() & ~mask;
target |= m_id & mask;
// create a dummy traversal_algorithm
// create a dummy traversal_algorithm
// this is unfortunately necessary for the observer
// to free itself from the pool when it's being released
boost::intrusive_ptr<traversal_algorithm> algo(

View File

@ -31,6 +31,7 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdlib.h> // free and calloc
#include <new> // for bad_alloc
#include "libtorrent/packet_buffer.hpp"
#include "libtorrent/assert.hpp"
#include "libtorrent/invariant_check.hpp"

View File

@ -72,6 +72,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/natpmp.hpp"
#include "libtorrent/upnp.hpp"
#include "libtorrent/magnet_uri.hpp"
#include "libtorrent/lazy_entry.hpp"
#ifdef TORRENT_PROFILE_CALLS
#include <boost/unordered_map.hpp>
@ -876,7 +877,7 @@ namespace libtorrent
std::vector<char> buf;
bencode(std::back_inserter(buf), data);
sha1_hash ret = hasher(&buf[0], buf.size()).final();
#ifndef TORRENT_DISABLE_DHT
TORRENT_ASYNC_CALL2(dht_put_item, data, ret);
#endif
@ -1046,7 +1047,7 @@ namespace libtorrent
apply_settings(pack);
}
proxy_settings session::i2p_proxy() const
{
proxy_settings ret;

View File

@ -122,12 +122,12 @@ int print_failures()
return tests_failure;
}
std::map<std::string, boost::uint64_t> get_counters(libtorrent::session& s)
std::map<std::string, boost::int64_t> get_counters(libtorrent::session& s)
{
using namespace libtorrent;
s.post_session_stats();
std::map<std::string, boost::uint64_t> ret;
std::map<std::string, boost::int64_t> ret;
alert const* a = wait_for_alert(s, session_stats_alert::alert_type
, "get_counters()");

View File

@ -58,7 +58,7 @@ EXPORT libtorrent::address rand_v6();
EXPORT libtorrent::tcp::endpoint rand_tcp_ep();
EXPORT libtorrent::udp::endpoint rand_udp_ep();
EXPORT std::map<std::string, boost::uint64_t> get_counters(libtorrent::session& s);
EXPORT std::map<std::string, boost::int64_t> get_counters(libtorrent::session& s);
EXPORT libtorrent::alert const* wait_for_alert(
libtorrent::session& ses, int type, char const* name = "");

View File

@ -94,7 +94,7 @@ void test_swarm()
boost::tie(tor1, tor2, tor3) = setup_transfer(&ses1, &ses2, &ses3, true, false, true, "_unchoke");
std::map<std::string, boost::uint64_t> cnt = get_counters(ses1);
std::map<std::string, boost::int64_t> cnt = get_counters(ses1);
fprintf(stderr, "allowed_upload_slots: %d\n", int(cnt["ses.num_unchoke_slots"]));
TEST_EQUAL(cnt["ses.num_unchoke_slots"], 1);

View File

@ -46,7 +46,7 @@ POSSIBILITY OF SUCH DAMAGE.
char const* pe_policy(boost::uint8_t policy)
{
using namespace libtorrent;
if (policy == settings_pack::pe_disabled) return "disabled";
else if (policy == settings_pack::pe_enabled) return "enabled";
else if (policy == settings_pack::pe_forced) return "forced";
@ -56,11 +56,11 @@ char const* pe_policy(boost::uint8_t policy)
void display_settings(libtorrent::settings_pack const& s)
{
using namespace libtorrent;
fprintf(stderr, "out_enc_policy - %s\tin_enc_policy - %s\n"
, pe_policy(s.get_int(settings_pack::out_enc_policy))
, pe_policy(s.get_int(settings_pack::in_enc_policy)));
fprintf(stderr, "enc_level - %s\t\tprefer_rc4 - %s\n"
, s.get_int(settings_pack::allowed_enc_level) == settings_pack::pe_plaintext ? "plaintext"
: s.get_int(settings_pack::allowed_enc_level) == settings_pack::pe_rc4 ? "rc4"
@ -85,7 +85,7 @@ void test_transfer(libtorrent::settings_pack::enc_policy policy
lt::session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48800, 49000), "0.0.0.0", 0);
lt::session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49800, 50000), "0.0.0.0", 0);
settings_pack s;
s.set_int(settings_pack::out_enc_policy, settings_pack::pe_enabled);
s.set_int(settings_pack::in_enc_policy, settings_pack::pe_enabled);
s.set_int(settings_pack::allowed_enc_level, settings_pack::pe_both);
@ -108,7 +108,7 @@ void test_transfer(libtorrent::settings_pack::enc_policy policy
using boost::tuples::ignore;
boost::tie(tor1, tor2, ignore) = setup_transfer(&ses1, &ses2, 0, true, false, true
, "_pe", 16 * 1024, 0, false, 0, true);
, "_pe", 16 * 1024, 0, false, 0, true);
fprintf(stderr, "waiting for transfer to complete\n");
@ -123,7 +123,7 @@ void test_transfer(libtorrent::settings_pack::enc_policy policy
}
TEST_CHECK(tor2.status().is_seeding);
if (tor2.status().is_seeding) fprintf(stderr, "done\n");
if (tor2.status().is_seeding) fprintf(stderr, "done\n");
ses1.remove_torrent(tor1);
ses2.remove_torrent(tor2);
@ -146,13 +146,13 @@ void test_enc_handler(libtorrent::crypto_plugin* a, libtorrent::crypto_plugin* b
#endif
for (int rep = 0; rep < repcount; ++rep)
{
std::size_t buf_len = rand() % (512 * 1024);
int buf_len = rand() % (512 * 1024);
char* buf = new char[buf_len];
char* cmp_buf = new char[buf_len];
std::generate(buf, buf + buf_len, &std::rand);
std::memcpy(cmp_buf, buf, buf_len);
using namespace boost::asio;
std::vector<mutable_buffer> iovec;
iovec.push_back(mutable_buffer(buf, buf_len));
@ -169,7 +169,7 @@ void test_enc_handler(libtorrent::crypto_plugin* a, libtorrent::crypto_plugin* b
TEST_EQUAL(consume, 0);
TEST_EQUAL(produce, buf_len);
TEST_EQUAL(packet_size, 0);
iovec.push_back(mutable_buffer(buf, buf_len));
b->encrypt(iovec);
TEST_CHECK(!std::equal(buf, buf + buf_len, cmp_buf));
@ -184,7 +184,7 @@ void test_enc_handler(libtorrent::crypto_plugin* a, libtorrent::crypto_plugin* b
TEST_EQUAL(consume, 0);
TEST_EQUAL(produce, buf_len);
TEST_EQUAL(packet_size, 0);
delete[] buf;
delete[] cmp_buf;
}
@ -207,10 +207,10 @@ int test_main()
for (int rep = 0; rep < repcount; ++rep)
{
dh_key_exchange DH1, DH2;
DH1.compute_secret(DH2.get_local_key());
DH2.compute_secret(DH1.get_local_key());
TEST_CHECK(std::equal(DH1.get_secret(), DH1.get_secret() + 96, DH2.get_secret()));
}
@ -231,7 +231,7 @@ int test_main()
rc42.set_incoming_key(&test1_key[0], 20);
rc42.set_outgoing_key(&test2_key[0], 20);
test_enc_handler(&rc41, &rc42);
#ifdef TORRENT_USE_VALGRIND
const int timeout = 10;
#else

View File

@ -90,7 +90,7 @@ void test_running_torrent(boost::shared_ptr<torrent_info> info, boost::int64_t f
TEST_EQUAL(st.total_wanted, file_size * 2);
TEST_EQUAL(st.total_wanted_done, 0);
TEST_EQUAL(h.file_priorities().size(), info->num_files());
TEST_EQUAL(int(h.file_priorities().size()), info->num_files());
if (!st.is_seeding)
{
TEST_EQUAL(h.file_priorities()[0], 0);
@ -261,7 +261,7 @@ int test_main()
for (int i = 0; i < fp.size(); ++i)
sum += fp[i];
TEST_EQUAL(sum, fs.piece_size(idx));
TEST_EQUAL(int(sum), fs.piece_size(idx));
}
}

View File

@ -133,7 +133,7 @@ int test_main()
using namespace libtorrent;
test_transfer();
error_code ec;
remove_all("./tmp1_utp", ec);
remove_all("./tmp2_utp", ec);

View File

@ -105,7 +105,7 @@ void test_transfer(lt::session& ses, boost::shared_ptr<torrent_info> torrent_fil
, keepalive ? "yes" : "no");
int proxy_port = 0;
if (proxy)
{
proxy_port = start_proxy(proxy);
@ -160,7 +160,7 @@ void test_transfer(lt::session& ses, boost::shared_ptr<torrent_info> torrent_fil
}
peer_disconnects = 0;
std::map<std::string, boost::uint64_t> cnt = get_counters(ses);
std::map<std::string, boost::int64_t> cnt = get_counters(ses);
for (int i = 0; i < 40; ++i)
{
@ -395,7 +395,7 @@ int EXPORT run_http_suite(int proxy, char const* protocol, bool test_url_seed
test_transfer(ses, torrent_file, proxy, port, protocol, test_url_seed
, chunked_encoding, test_ban, keepalive);
if (test_url_seed && test_rename)
{
torrent_file->rename_file(0, combine_path(save_path, combine_path("torrent_dir", "renamed_test1")));

View File

@ -24,8 +24,11 @@ def update_file(name):
f.close()
open(name, 'w+').write(subst)
for i in glob.glob('src/*.cpp') + glob.glob('include/libtorrent/*.hpp') + \
glob.glob('include/libtorrent/kademlia/*.hpp') + glob.glob('src/kademlia/*.cpp') + \
for i in glob.glob('src/*.cpp') + \
glob.glob('include/libtorrent/*.hpp') + \
glob.glob('include/libtorrent/extensions/*.hpp') + \
glob.glob('include/libtorrent/kademlia/*.hpp') + \
glob.glob('src/kademlia/*.cpp') + \
['COPYING', 'LICENSE']:
update_file(i)