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

View File

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

View File

@ -72,6 +72,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/natpmp.hpp" #include "libtorrent/natpmp.hpp"
#include "libtorrent/upnp.hpp" #include "libtorrent/upnp.hpp"
#include "libtorrent/magnet_uri.hpp" #include "libtorrent/magnet_uri.hpp"
#include "libtorrent/lazy_entry.hpp"
#ifdef TORRENT_PROFILE_CALLS #ifdef TORRENT_PROFILE_CALLS
#include <boost/unordered_map.hpp> #include <boost/unordered_map.hpp>

View File

@ -122,12 +122,12 @@ int print_failures()
return tests_failure; 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; using namespace libtorrent;
s.post_session_stats(); 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 alert const* a = wait_for_alert(s, session_stats_alert::alert_type
, "get_counters()"); , "get_counters()");

View File

@ -58,7 +58,7 @@ EXPORT libtorrent::address rand_v6();
EXPORT libtorrent::tcp::endpoint rand_tcp_ep(); EXPORT libtorrent::tcp::endpoint rand_tcp_ep();
EXPORT libtorrent::udp::endpoint rand_udp_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( EXPORT libtorrent::alert const* wait_for_alert(
libtorrent::session& ses, int type, char const* name = ""); 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"); 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"])); fprintf(stderr, "allowed_upload_slots: %d\n", int(cnt["ses.num_unchoke_slots"]));
TEST_EQUAL(cnt["ses.num_unchoke_slots"], 1); TEST_EQUAL(cnt["ses.num_unchoke_slots"], 1);

View File

@ -146,7 +146,7 @@ void test_enc_handler(libtorrent::crypto_plugin* a, libtorrent::crypto_plugin* b
#endif #endif
for (int rep = 0; rep < repcount; ++rep) 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* buf = new char[buf_len];
char* cmp_buf = new char[buf_len]; char* cmp_buf = new char[buf_len];

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, file_size * 2);
TEST_EQUAL(st.total_wanted_done, 0); 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) if (!st.is_seeding)
{ {
TEST_EQUAL(h.file_priorities()[0], 0); TEST_EQUAL(h.file_priorities()[0], 0);
@ -261,7 +261,7 @@ int test_main()
for (int i = 0; i < fp.size(); ++i) for (int i = 0; i < fp.size(); ++i)
sum += fp[i]; sum += fp[i];
TEST_EQUAL(sum, fs.piece_size(idx)); TEST_EQUAL(int(sum), fs.piece_size(idx));
} }
} }

View File

@ -160,7 +160,7 @@ void test_transfer(lt::session& ses, boost::shared_ptr<torrent_info> torrent_fil
} }
peer_disconnects = 0; 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) for (int i = 0; i < 40; ++i)
{ {

View File

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