forked from premiere/premiere-libtorrent
some msvc fixes
This commit is contained in:
parent
d9813ca56d
commit
84849f3afd
|
@ -53,7 +53,7 @@ namespace libtorrent
|
|||
class piece_manager;
|
||||
struct cached_piece_entry;
|
||||
struct bdecode_node;
|
||||
struct torrent_info;
|
||||
class torrent_info;
|
||||
|
||||
struct block_cache_reference
|
||||
{
|
||||
|
|
|
@ -53,15 +53,16 @@ namespace libtorrent
|
|||
// This function can can be used to extract a string describing a client
|
||||
// version from its peer-id. It will recognize most clients that have this
|
||||
// kind of identification in the peer-id.
|
||||
TORRENT_DEPRECATED_EXPORT std::string identify_client(const peer_id& p)
|
||||
TORRENT_DEPRECATED;
|
||||
TORRENT_DEPRECATED_EXPORT TORRENT_DEPRECATED
|
||||
std::string identify_client(const peer_id& p);
|
||||
|
||||
// Returns an optional fingerprint if any can be identified from the peer
|
||||
// id. This can be used to automate the identification of clients. It will
|
||||
// not be able to identify peers with non- standard encodings. Only Azureus
|
||||
// style, Shadow's style and Mainline style.
|
||||
TORRENT_DEPRECATED_EXPORT boost::optional<fingerprint>
|
||||
client_fingerprint(peer_id const& p) TORRENT_DEPRECATED;
|
||||
TORRENT_DEPRECATED_EXPORT TORRENT_DEPRECATED
|
||||
boost::optional<fingerprint>
|
||||
client_fingerprint(peer_id const& p);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -176,12 +176,12 @@ public:
|
|||
|
||||
struct count_peers
|
||||
{
|
||||
int& count;
|
||||
count_peers(int& c): count(c) {}
|
||||
int* count;
|
||||
count_peers(int* c): count(c) {}
|
||||
void operator()(std::pair<libtorrent::dht::node_id
|
||||
, libtorrent::dht::torrent_entry> const& t)
|
||||
{
|
||||
count += t.second.peers.size();
|
||||
*count += t.second.peers.size();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -218,7 +218,7 @@ public:
|
|||
int num_peers() const
|
||||
{
|
||||
int ret = 0;
|
||||
std::for_each(m_map.begin(), m_map.end(), count_peers(ret));
|
||||
std::for_each(m_map.begin(), m_map.end(), count_peers(&ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,11 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#ifdef WIN32
|
||||
#include <windows.h> // fot SetErrorMode
|
||||
#include <io.h> // for _dup and _dup2
|
||||
|
||||
#define dup _dup
|
||||
#define dup2 _dup2
|
||||
|
||||
#endif
|
||||
|
||||
using namespace libtorrent;
|
||||
|
|
|
@ -149,7 +149,5 @@ TORRENT_TEST(auto_unchoke)
|
|||
remove_all("./tmp1_unchoke", ec);
|
||||
remove_all("./tmp2_unchoke", ec);
|
||||
remove_all("./tmp3_unchoke", ec);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -282,7 +282,5 @@ TORRENT_TEST(checking)
|
|||
test_checking(read_only_files);
|
||||
test_checking(incomplete_files);
|
||||
test_checking(corrupt_files);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -795,7 +795,5 @@ TORRENT_TEST(fast_extension)
|
|||
test_multiple_have_all();
|
||||
test_dont_have();
|
||||
test_invalid_metadata_requests();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -244,6 +244,5 @@ TORRENT_TEST(http_parser)
|
|||
|
||||
stop_web_server();
|
||||
std::remove("test_file");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -109,8 +109,6 @@ TORRENT_TEST(lsd)
|
|||
remove_all("./tmp1_lsd", ec);
|
||||
remove_all("./tmp2_lsd", ec);
|
||||
remove_all("./tmp3_lsd", ec);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -232,7 +232,5 @@ TORRENT_TEST(metadata_extension)
|
|||
remove_all("tmp2", ec);
|
||||
|
||||
#endif // TORRENT_NO_DEPRECATE
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -252,7 +252,5 @@ TORRENT_TEST(test_pe_crypto)
|
|||
#else
|
||||
fprintf(stderr, "PE test not run because it's disabled\n");
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -112,6 +112,5 @@ TORRENT_TEST(peer_class)
|
|||
pool.decref(id1);
|
||||
TEST_CHECK(pool.at(id2) == NULL);
|
||||
TEST_CHECK(pool.at(id1) == NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -160,11 +160,9 @@ TORRENT_TEST(pex)
|
|||
remove_all("tmp1_pex", ec);
|
||||
remove_all("tmp2_pex", ec);
|
||||
remove_all("tmp3_pex", ec);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
TORRENT_TEST(pex) { return 0; }
|
||||
TORRENT_TEST(pex) {}
|
||||
#endif // TORRENT_DISABLE_EXTENSIONS
|
||||
|
||||
|
|
|
@ -270,6 +270,5 @@ TORRENT_TEST(primitives)
|
|||
// test endpoint_to_bytes
|
||||
TEST_EQUAL(endpoint_to_bytes(udp::endpoint(address_v4::from_string("10.11.12.13"), 8080)), "\x0a\x0b\x0c\x0d\x1f\x90");
|
||||
TEST_EQUAL(endpoint_to_bytes(udp::endpoint(address_v4::from_string("16.5.127.1"), 12345)), "\x10\x05\x7f\x01\x30\x39");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -424,8 +424,6 @@ TORRENT_TEST(priority)
|
|||
// we have to clear them, session doesn't really support being destructed
|
||||
// as a global destructor (for silly reasons)
|
||||
sp.clear();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -268,6 +268,5 @@ TORRENT_TEST(privacy)
|
|||
pr[11] = test_proxy(settings_pack::http, force_proxy_mode | expect_udp_reject);
|
||||
pr[12] = test_proxy(settings_pack::http_pw, force_proxy_mode | expect_udp_reject);
|
||||
pr[13] = test_proxy(settings_pack::i2p_proxy, force_proxy_mode);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -138,6 +138,5 @@ TORRENT_TEST(read_piece)
|
|||
test_read_piece(0);
|
||||
test_read_piece(seed_mode);
|
||||
test_read_piece(time_critical);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ void wait_for_complete(lt::session& ses, torrent_handle h)
|
|||
if (st.progress_ppm == 1000000) return;
|
||||
test_sleep(500);
|
||||
}
|
||||
TEST_CHECK(false);
|
||||
TEST_ERROR("torrent did not finish");
|
||||
}
|
||||
|
||||
TORRENT_TEST(recheck)
|
||||
|
@ -98,6 +98,4 @@ TORRENT_TEST(recheck)
|
|||
st1 = tor1.status();
|
||||
TEST_CHECK(st1.progress_ppm <= 1000000);
|
||||
wait_for_complete(ses1, tor1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -520,7 +520,5 @@ TORRENT_TEST(remap_files)
|
|||
remove_all("tmp2_remap2", ec);
|
||||
remove_all("tmp1_remap3", ec);
|
||||
remove_all("tmp2_remap3", ec);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -340,7 +340,6 @@ TORRENT_TEST(resume)
|
|||
// TODO: test all other resume flags here too. This would require returning
|
||||
// more than just the torrent_status from test_resume_flags. Also http seeds
|
||||
// and trackers for instance
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -86,6 +86,5 @@ TORRENT_TEST(session)
|
|||
// for the asynchronous call to set the alert
|
||||
// mask completes, before it goes on to destruct
|
||||
// the session object
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -596,7 +596,6 @@ TORRENT_TEST(ssl)
|
|||
remove_all("tmp2_ssl", ec);
|
||||
|
||||
#endif // TORRENT_USE_OPENSSL
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -76,6 +76,5 @@ TORRENT_TEST(stat_cache)
|
|||
TEST_CHECK(sc.get_filesize(14) == stat_cache::not_in_cache);
|
||||
TEST_CHECK(sc.get_filesize(15) == 1000);
|
||||
TEST_CHECK(sc.get_filetime(15) == 3000);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -838,7 +838,7 @@ void free_iov(file::iovec_t* iov, int num_bufs)
|
|||
}
|
||||
}
|
||||
|
||||
void test_iovec_copy_bufs()
|
||||
TORRENT_TEST(iovec_copy_bufs)
|
||||
{
|
||||
file::iovec_t iov1[10];
|
||||
file::iovec_t iov2[10];
|
||||
|
@ -869,7 +869,7 @@ void test_iovec_copy_bufs()
|
|||
free_iov(iov1, 10);
|
||||
}
|
||||
|
||||
void test_iovec_clear_bufs()
|
||||
TORRENT_TEST(iovec_clear_bufs)
|
||||
{
|
||||
file::iovec_t iov[10];
|
||||
alloc_iov(iov, 10);
|
||||
|
@ -887,7 +887,7 @@ void test_iovec_clear_bufs()
|
|||
free_iov(iov, 10);
|
||||
}
|
||||
|
||||
void test_iovec_bufs_size()
|
||||
TORRENT_TEST(iovec_bufs_size)
|
||||
{
|
||||
file::iovec_t iov[10];
|
||||
|
||||
|
@ -903,7 +903,7 @@ void test_iovec_bufs_size()
|
|||
}
|
||||
}
|
||||
|
||||
void test_iovec_advance_bufs()
|
||||
TORRENT_TEST(iovec_advance_bufs)
|
||||
{
|
||||
file::iovec_t iov1[10];
|
||||
file::iovec_t iov2[10];
|
||||
|
@ -936,13 +936,6 @@ void test_iovec_advance_bufs()
|
|||
|
||||
TORRENT_TEST(storage)
|
||||
{
|
||||
test_iovec_copy_bufs();
|
||||
test_iovec_clear_bufs();
|
||||
test_iovec_advance_bufs();
|
||||
test_iovec_bufs_size();
|
||||
|
||||
return 0;
|
||||
|
||||
// initialize test pieces
|
||||
for (char* p = piece0, *end(piece0 + piece_size); p < end; ++p)
|
||||
*p = random_byte();
|
||||
|
@ -974,7 +967,5 @@ TORRENT_TEST(storage)
|
|||
|
||||
std::for_each(test_paths.begin(), test_paths.end(), boost::bind(&run_test, _1, true));
|
||||
std::for_each(test_paths.begin(), test_paths.end(), boost::bind(&run_test, _1, false));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,8 +39,6 @@ TORRENT_TEST(super_seeding)
|
|||
|
||||
// with strict super seeding
|
||||
test_swarm(super_seeding | strict_super_seeding);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -44,7 +44,5 @@ TORRENT_TEST(swarm)
|
|||
|
||||
// test explicit cache
|
||||
test_swarm(suggest | explicit_cache);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,8 +36,6 @@ TORRENT_TEST(time_crititcal)
|
|||
{
|
||||
// with time critical pieces
|
||||
test_swarm(time_critical);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -264,8 +264,6 @@ TORRENT_TEST(torrent)
|
|||
TEST_EQUAL(int(sum), fs.piece_size(idx));
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -394,7 +394,5 @@ TORRENT_TEST(traccker)
|
|||
fprintf(stderr, "stop_web_server\n");
|
||||
stop_web_server();
|
||||
fprintf(stderr, "done\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -129,11 +129,9 @@ TORRENT_TEST(trackers_extension)
|
|||
// this allows shutting down the sessions in parallel
|
||||
p1 = ses1.abort();
|
||||
p2 = ses2.abort();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
TORRENT_TEST(trackers_extension) { return 0; }
|
||||
TORRENT_TEST(trackers_extension) { }
|
||||
#endif // TORRENT_DISABLE_EXTENSIONS
|
||||
|
||||
|
|
|
@ -48,7 +48,6 @@ TORRENT_TEST(url_seed)
|
|||
run_http_suite(proxy, "http", 1, 0, 0, keepalive);
|
||||
}
|
||||
run_http_suite(proxy, "http", 1, 0, 0, 1, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -251,6 +251,5 @@ TORRENT_TEST(utf8)
|
|||
TEST_EQUAL(ret, conversion_ok);
|
||||
|
||||
TEST_EQUAL(utf8, identity);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -137,7 +137,5 @@ TORRENT_TEST(utp)
|
|||
error_code ec;
|
||||
remove_all("./tmp1_utp", ec);
|
||||
remove_all("./tmp2_utp", ec);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,5 @@ TORRENT_TEST(web_seed)
|
|||
run_http_suite(proxy, "https", false);
|
||||
#endif
|
||||
run_http_suite(proxy, "http", false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,6 @@ const int proxy = libtorrent::settings_pack::none;
|
|||
|
||||
TORRENT_TEST(web_seed_ban)
|
||||
{
|
||||
int ret = 0;
|
||||
for (int url_seed = 0; url_seed < 2; ++url_seed)
|
||||
{
|
||||
#ifdef TORRENT_USE_OPENSSL
|
||||
|
@ -48,6 +47,5 @@ TORRENT_TEST(web_seed_ban)
|
|||
#endif
|
||||
run_http_suite(proxy, "http", url_seed, 0, 1);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,6 @@ const int proxy = libtorrent::settings_pack::none;
|
|||
|
||||
TORRENT_TEST(web_seed_chunked)
|
||||
{
|
||||
int ret = 0;
|
||||
for (int url_seed = 0; url_seed < 2; ++url_seed)
|
||||
{
|
||||
#ifdef TORRENT_USE_OPENSSL
|
||||
|
@ -48,6 +47,5 @@ TORRENT_TEST(web_seed_chunked)
|
|||
#endif
|
||||
run_http_suite(proxy, "http", url_seed, 1, 0);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,6 @@ const int proxy = libtorrent::settings_pack::http;
|
|||
|
||||
TORRENT_TEST(web_seed_http)
|
||||
{
|
||||
int ret = 0;
|
||||
for (int url_seed = 0; url_seed < 2; ++url_seed)
|
||||
{
|
||||
#ifdef TORRENT_USE_OPENSSL
|
||||
|
@ -48,6 +47,5 @@ TORRENT_TEST(web_seed_http)
|
|||
#endif
|
||||
run_http_suite(proxy, "http", url_seed);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,6 @@ const int proxy = libtorrent::settings_pack::http_pw;
|
|||
|
||||
TORRENT_TEST(web_seed_http_pw)
|
||||
{
|
||||
int ret = 0;
|
||||
for (int url_seed = 0; url_seed < 2; ++url_seed)
|
||||
{
|
||||
#ifdef TORRENT_USE_OPENSSL
|
||||
|
@ -48,6 +47,5 @@ TORRENT_TEST(web_seed_http_pw)
|
|||
#endif
|
||||
run_http_suite(proxy, "http", url_seed);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,8 @@ TORRENT_TEST(web_seed_redirect)
|
|||
{
|
||||
fprintf(stderr, "failed to create file \"test_file\": (%d) %s\n"
|
||||
, ec.value(), ec.message().c_str());
|
||||
return 1;
|
||||
TEST_ERROR("failed to create file");
|
||||
return;
|
||||
}
|
||||
file::iovec_t b = { random_data, size_t(16000)};
|
||||
f.writev(0, &b, 1, ec);
|
||||
|
@ -76,8 +77,8 @@ TORRENT_TEST(web_seed_redirect)
|
|||
{
|
||||
fprintf(stderr, "error creating hashes for test torrent: %s\n"
|
||||
, ec.message().c_str());
|
||||
TEST_CHECK(false);
|
||||
return 0;
|
||||
TEST_ERROR("failed to create hashes");
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<char> buf;
|
||||
|
@ -91,14 +92,13 @@ TORRENT_TEST(web_seed_redirect)
|
|||
settings.set_int(settings_pack::max_queued_disk_bytes, 256 * 1024);
|
||||
settings.set_int(settings_pack::alert_mask, ~(alert::progress_notification | alert::stats_notification));
|
||||
ses.apply_settings(settings);
|
||||
|
||||
|
||||
// disable keep-alive because otherwise the test will choke on seeing
|
||||
// the disconnect (from the redirect)
|
||||
test_transfer(ses, torrent_file, 0, 0, "http", true, false, false, false);
|
||||
}
|
||||
|
||||
stop_web_server();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -40,7 +40,6 @@ const int proxy = libtorrent::settings_pack::socks4;
|
|||
|
||||
TORRENT_TEST(web_seed_socks4)
|
||||
{
|
||||
int ret = 0;
|
||||
for (int url_seed = 0; url_seed < 2; ++url_seed)
|
||||
{
|
||||
#ifdef TORRENT_USE_OPENSSL
|
||||
|
@ -48,6 +47,5 @@ TORRENT_TEST(web_seed_socks4)
|
|||
#endif
|
||||
run_http_suite(proxy, "http", url_seed);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,6 @@ const int proxy = libtorrent::settings_pack::socks5;
|
|||
|
||||
TORRENT_TEST(web_seed_socks5)
|
||||
{
|
||||
int ret = 0;
|
||||
for (int url_seed = 0; url_seed < 2; ++url_seed)
|
||||
{
|
||||
#ifdef TORRENT_USE_OPENSSL
|
||||
|
@ -48,6 +47,5 @@ TORRENT_TEST(web_seed_socks5)
|
|||
#endif
|
||||
run_http_suite(proxy, "http", url_seed);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,6 @@ const int proxy = libtorrent::settings_pack::socks5_pw;
|
|||
|
||||
TORRENT_TEST(web_seed_socks5_pw)
|
||||
{
|
||||
int ret = 0;
|
||||
for (int url_seed = 0; url_seed < 2; ++url_seed)
|
||||
{
|
||||
#ifdef TORRENT_USE_OPENSSL
|
||||
|
@ -48,6 +47,5 @@ TORRENT_TEST(web_seed_socks5_pw)
|
|||
#endif
|
||||
run_http_suite(proxy, "http", url_seed);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue