forked from premiere/premiere-libtorrent
fix build without deprecated functions
This commit is contained in:
parent
6d54c20adf
commit
6929d051f1
2
Jamfile
2
Jamfile
|
@ -497,7 +497,7 @@ variant test_release : release
|
||||||
: <asserts>production <debug-symbols>on
|
: <asserts>production <debug-symbols>on
|
||||||
<invariant-checks>full <boost-link>shared <optimization>off
|
<invariant-checks>full <boost-link>shared <optimization>off
|
||||||
<export-extra>on <debug-iterators>on <threading>multi
|
<export-extra>on <debug-iterators>on <threading>multi
|
||||||
<inlining>on
|
<inlining>on <deprecated-functions>off
|
||||||
;
|
;
|
||||||
variant test_debug : debug
|
variant test_debug : debug
|
||||||
: <logging>on
|
: <logging>on
|
||||||
|
|
|
@ -66,8 +66,7 @@ TORRENT_TEST(close_file_interval)
|
||||||
}
|
}
|
||||||
|
|
||||||
torrent_handle h = ses.get_torrents().front();
|
torrent_handle h = ses.get_torrents().front();
|
||||||
std::vector<pool_file_status> file_status;
|
std::vector<pool_file_status> file_status = h.file_status();
|
||||||
h.file_status(file_status);
|
|
||||||
printf("%d: %d files\n", ticks, int(file_status.size()));
|
printf("%d: %d files\n", ticks, int(file_status.size()));
|
||||||
if (ticks > 0 && ticks < 19)
|
if (ticks > 0 && ticks < 19)
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,13 +35,14 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "utils.hpp"
|
#include "utils.hpp"
|
||||||
#include "libtorrent/alert_types.hpp"
|
#include "libtorrent/alert_types.hpp"
|
||||||
#include "libtorrent/session.hpp"
|
#include "libtorrent/session.hpp"
|
||||||
|
#include "libtorrent/write_resume_data.hpp"
|
||||||
#include "settings.hpp"
|
#include "settings.hpp"
|
||||||
|
|
||||||
using namespace libtorrent;
|
using namespace libtorrent;
|
||||||
|
|
||||||
TORRENT_TEST(seed_and_suggest_mode)
|
TORRENT_TEST(seed_and_suggest_mode)
|
||||||
{
|
{
|
||||||
std::shared_ptr<entry> resume_data;
|
add_torrent_params resume_data;
|
||||||
|
|
||||||
// with seed mode
|
// with seed mode
|
||||||
setup_swarm(2, swarm_test::upload
|
setup_swarm(2, swarm_test::upload
|
||||||
|
@ -59,7 +60,7 @@ TORRENT_TEST(seed_and_suggest_mode)
|
||||||
auto* sr = alert_cast<save_resume_data_alert>(a);
|
auto* sr = alert_cast<save_resume_data_alert>(a);
|
||||||
if (sr == nullptr) return;
|
if (sr == nullptr) return;
|
||||||
|
|
||||||
resume_data = sr->resume_data;
|
resume_data = sr->params;
|
||||||
}
|
}
|
||||||
// terminate
|
// terminate
|
||||||
, [](int ticks, lt::session& ses) -> bool
|
, [](int ticks, lt::session& ses) -> bool
|
||||||
|
@ -73,16 +74,14 @@ TORRENT_TEST(seed_and_suggest_mode)
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
printf("save-resume: %s\n", resume_data->to_string().c_str());
|
printf("save-resume: %s\n", write_resume_data(resume_data).to_string().c_str());
|
||||||
TEST_CHECK((*resume_data)["seed_mode"] == 1);
|
TEST_CHECK(resume_data.flags & add_torrent_params::flag_seed_mode);
|
||||||
|
|
||||||
// there should not be any pieces in a seed-mode torrent
|
// there should not be any pieces in a seed-mode torrent
|
||||||
entry const* pieces = resume_data->find_key("pieces");
|
auto const pieces = resume_data.have_pieces;
|
||||||
TEST_CHECK(pieces != nullptr);
|
for (bool const c : pieces)
|
||||||
std::string piece_str = pieces->string();
|
|
||||||
for (char c : piece_str)
|
|
||||||
{
|
{
|
||||||
TEST_CHECK(c & 0x1);
|
TEST_CHECK(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -520,12 +520,14 @@ TORRENT_TEST(redundant_have)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
TORRENT_TEST(lazy_bitfields)
|
TORRENT_TEST(lazy_bitfields)
|
||||||
{
|
{
|
||||||
test_settings([](lt::settings_pack& pack) {
|
test_settings([](lt::settings_pack& pack) {
|
||||||
pack.set_bool(settings_pack::lazy_bitfields, true); }
|
pack.set_bool(settings_pack::lazy_bitfields, true); }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
TORRENT_TEST(prioritize_partial_pieces)
|
TORRENT_TEST(prioritize_partial_pieces)
|
||||||
{
|
{
|
||||||
|
|
|
@ -58,7 +58,7 @@ TORRENT_TEST(primitives)
|
||||||
#ifndef TORRENT_NO_DEPRECATE
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
int const delay = ae.next_announce_in();
|
int const delay = ae.next_announce_in();
|
||||||
#else
|
#else
|
||||||
int const delay = total_seconds(ae.next_announce - clock_type::now());
|
int const delay = static_cast<int>(total_seconds(ae.next_announce - clock_type::now()));
|
||||||
#endif
|
#endif
|
||||||
TEST_CHECK(delay > last);
|
TEST_CHECK(delay > last);
|
||||||
last = delay;
|
last = delay;
|
||||||
|
|
|
@ -331,7 +331,7 @@ TORRENT_TEST(resume_save_load_deprecated)
|
||||||
TEST_CHECK(a);
|
TEST_CHECK(a);
|
||||||
if (a == nullptr) return;
|
if (a == nullptr) return;
|
||||||
|
|
||||||
auto const l = a->params.file_priority;
|
auto const l = a->params.file_priorities;
|
||||||
|
|
||||||
TEST_EQUAL(l.size(), 3);
|
TEST_EQUAL(l.size(), 3);
|
||||||
TEST_EQUAL(l[0], 1);
|
TEST_EQUAL(l[0], 1);
|
||||||
|
@ -353,7 +353,7 @@ TORRENT_TEST(resume_save_load_resume_deprecated)
|
||||||
TEST_CHECK(a);
|
TEST_CHECK(a);
|
||||||
if (a == nullptr) return;
|
if (a == nullptr) return;
|
||||||
|
|
||||||
auto const l = a->params.file_priority;
|
auto const l = a->params.file_priorities;
|
||||||
|
|
||||||
TEST_EQUAL(l.size(), 3);
|
TEST_EQUAL(l.size(), 3);
|
||||||
TEST_EQUAL(l[0], 1);
|
TEST_EQUAL(l[0], 1);
|
||||||
|
|
|
@ -803,7 +803,9 @@ TORRENT_TEST(rename_file)
|
||||||
|
|
||||||
auto const files = resume.renamed_files;
|
auto const files = resume.renamed_files;
|
||||||
for (auto const& i : files)
|
for (auto const& i : files)
|
||||||
|
{
|
||||||
TEST_EQUAL(i.second.substr(0, 14), "temp_storage__");
|
TEST_EQUAL(i.second.substr(0, 14), "temp_storage__");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_rename_file_fastresume(bool test_deprecated)
|
void test_rename_file_fastresume(bool test_deprecated)
|
||||||
|
|
Loading…
Reference in New Issue