diff --git a/test/test_bitfield.cpp b/test/test_bitfield.cpp index c4ee6bfea..633a463b3 100644 --- a/test/test_bitfield.cpp +++ b/test/test_bitfield.cpp @@ -158,12 +158,12 @@ TORRENT_TEST(test_assign3) { bitfield test1; std::uint8_t b2[] = { 0x08, 0x10, 0xff, 0xff, 0xff, 0xff, 0xf, 0xc, 0x7f }; - test1.assign((char*)b2, 72); + test1.assign(reinterpret_cast(b2), 72); print_bitfield(test1); TEST_EQUAL(test1.count(), 47); std::uint8_t b3[] = { 0x08, 0x10, 0xff, 0xff, 0xff, 0xff, 0xf, 0xc }; - test1.assign((char*)b3, 64); + test1.assign(reinterpret_cast(b3), 64); print_bitfield(test1); TEST_EQUAL(test1.count(), 40); } @@ -183,7 +183,7 @@ TORRENT_TEST(test_assign) std::array b; bitfield test1; - for (int i = 0; i < 4; ++i) + for (std::size_t i = 0; i < 4; ++i) { b[i] = char(0xc0); test1.assign(&b[i], 2); @@ -197,7 +197,7 @@ TORRENT_TEST(test_assign2) { std::array b; bitfield test1; - for (int i = 0; i < 4; ++i) + for (std::size_t i = 0; i < 4; ++i) { std::memset(&b[i], 0xff, 5); b[i + 5] = char(0xc0); @@ -392,7 +392,7 @@ TORRENT_TEST(not_initialized_assign) // check a not initialized empty bitfield bitfield test1(0); std::uint8_t b1[] = { 0xff }; - test1.assign((char*)b1, 8); + test1.assign(reinterpret_cast(b1), 8); TEST_EQUAL(test1.count(), 8); } diff --git a/test/test_checking.cpp b/test/test_checking.cpp index 8e7a903b3..61034820c 100644 --- a/test/test_checking.cpp +++ b/test/test_checking.cpp @@ -115,7 +115,6 @@ void test_checking(int flags = read_only_files) std::string path = combine_path("test_torrent_dir", dirname); path = combine_path(path, name); - error_code ec; file f(path, open_mode::read_write, ec); if (ec) std::printf("ERROR: opening file \"%s\": (%d) %s\n" , path.c_str(), ec.value(), ec.message().c_str()); @@ -217,7 +216,7 @@ void test_checking(int flags = read_only_files) st = tor1.status(); - std::printf("%d %f %s\n", st.state, st.progress_ppm / 10000.f, st.errc.message().c_str()); + std::printf("%d %f %s\n", st.state, st.progress_ppm / 10000.0, st.errc.message().c_str()); if ( #ifndef TORRENT_NO_DEPRECATE diff --git a/test/test_dht.cpp b/test/test_dht.cpp index 4560b4f56..8c15e4a2c 100644 --- a/test/test_dht.cpp +++ b/test/test_dht.cpp @@ -1359,7 +1359,7 @@ void test_put(address(&rand_addr)()) TEST_ERROR(t.error_string); } - itemv = span(buffer, bencode(buffer, items[0].ent)); + itemv = span(buffer, std::size_t(bencode(buffer, items[0].ent))); sig = sign_mutable_item(itemv, salt, seq, pk, sk); TEST_EQUAL(verify_mutable_item(itemv, salt, seq, pk, sig), true); @@ -1428,7 +1428,7 @@ void test_put(address(&rand_addr)()) // also test that invalid signatures fail! - itemv = span(buffer, bencode(buffer, items[0].ent)); + itemv = span(buffer, std::size_t(bencode(buffer, items[0].ent))); sig = sign_mutable_item(itemv, salt, seq, pk, sk); TEST_EQUAL(verify_mutable_item(itemv, salt, seq, pk, sig), 1); // break the signature @@ -1492,7 +1492,7 @@ void test_put(address(&rand_addr)()) // increment sequence number seq = next_seq(seq); // put item 1 - itemv = span(buffer, bencode(buffer, items[1].ent)); + itemv = span(buffer, std::size_t(bencode(buffer, items[1].ent))); sig = sign_mutable_item(itemv, salt, seq, pk, sk); TEST_EQUAL(verify_mutable_item(itemv, salt, seq, pk, sig), 1); @@ -1685,12 +1685,12 @@ void test_routing_table(address(&rand_addr)()) init_rand_address(); add_and_replace(tmp, diff); - table.node_seen(id, udp::endpoint(rand_addr(), rand()), 10); + table.node_seen(id, rand_udp_ep(rand_addr), 10); nodes.clear(); for (int i = 0; i < 7000; ++i) { - table.node_seen(tmp, udp::endpoint(rand_addr(), rand()), 20 + (tmp[19] & 0xff)); + table.node_seen(tmp, rand_udp_ep(rand_addr), 20 + (tmp[19] & 0xff)); add_and_replace(tmp, diff); } std::printf("active buckets: %d\n", table.num_active_buckets()); @@ -1770,14 +1770,14 @@ void test_routing_table(address(&rand_addr)()) for (int i = 0; i < 5; ++i) { address const a = addr4(ips[i]); - node_id const id = generate_id_impl(a, rs[i]); - TEST_CHECK(id[0] == prefixes[i][0]); - TEST_CHECK(id[1] == prefixes[i][1]); - TEST_CHECK((id[2] & 0xf8) == (prefixes[i][2] & 0xf8)); + node_id const new_id = generate_id_impl(a, std::uint32_t(rs[i])); + TEST_CHECK(new_id[0] == prefixes[i][0]); + TEST_CHECK(new_id[1] == prefixes[i][1]); + TEST_CHECK((new_id[2] & 0xf8) == (prefixes[i][2] & 0xf8)); - TEST_CHECK(id[19] == rs[i]); + TEST_CHECK(new_id[19] == rs[i]); std::printf("IP address: %s r: %d node ID: %s\n", ips[i] - , rs[i], aux::to_hex(id).c_str()); + , rs[i], aux::to_hex(new_id).c_str()); } } @@ -2259,7 +2259,7 @@ void test_mutable_get(address(&rand_addr)(), bool const with_salt) g_sent_packets.clear(); signature sig; - itemv = span(buffer, bencode(buffer, items[0].ent)); + itemv = span(buffer, std::size_t(bencode(buffer, items[0].ent))); sig = sign_mutable_item(itemv, salt, seq, pk, sk); send_dht_response(t.dht_node, response, initial_node , msg_args() @@ -2390,14 +2390,14 @@ TORRENT_TEST(immutable_put) std::string flat_data; bencode(std::back_inserter(flat_data), put_data); sha1_hash target = item_target_id( - span(flat_data.c_str(), int(flat_data.size()))); + span(flat_data.c_str(), flat_data.size())); t.dht_node.put_item(target, put_data, std::bind(&put_immutable_item_cb, _1, loop)); TEST_EQUAL(g_sent_packets.size(), 8); if (g_sent_packets.size() != 8) break; - for (int i = 0; i < 8; ++i) + for (std::size_t i = 0; i < 8; ++i) { auto const packet = find_packet(nodes[i].ep()); TEST_CHECK(packet != g_sent_packets.end()); @@ -2413,7 +2413,7 @@ TORRENT_TEST(immutable_put) continue; } char tok[10]; - std::snprintf(tok, sizeof(tok), "%02d", i); + std::snprintf(tok, sizeof(tok), "%02d", int(i)); msg_args args; args.token(tok).port(1234).nid(nodes[i].id).nodes({nodes[i]}); @@ -2424,11 +2424,11 @@ TORRENT_TEST(immutable_put) TEST_EQUAL(g_sent_packets.size(), 8); if (g_sent_packets.size() != 8) break; - itemv = span(buffer, bencode(buffer, put_data)); + itemv = span(buffer, std::size_t(bencode(buffer, put_data))); for (int i = 0; i < 8; ++i) { - auto const packet = find_packet(nodes[i].ep()); + auto const packet = find_packet(nodes[std::size_t(i)].ep()); TEST_CHECK(packet != g_sent_packets.end()); if (packet == g_sent_packets.end()) continue; @@ -2447,7 +2447,7 @@ TORRENT_TEST(immutable_put) if (put_immutable_item_keys[0].string_value() != "q" || put_immutable_item_keys[2].string_value() != "put") continue; - if (i < loop) send_dht_response(t.dht_node, response, nodes[i].ep()); + if (i < loop) send_dht_response(t.dht_node, response, nodes[std::size_t(i)].ep()); } else { @@ -2498,7 +2498,7 @@ TORRENT_TEST(mutable_put) TEST_EQUAL(g_sent_packets.size(), 8); if (g_sent_packets.size() != 8) break; - for (int i = 0; i < 8; ++i) + for (std::size_t i = 0; i < 8; ++i) { auto const packet = find_packet(nodes[i].ep()); TEST_CHECK(packet != g_sent_packets.end()); @@ -2514,7 +2514,7 @@ TORRENT_TEST(mutable_put) continue; } char tok[10]; - std::snprintf(tok, sizeof(tok), "%02d", i); + std::snprintf(tok, sizeof(tok), "%02d", int(i)); msg_args args; args.token(tok).port(1234).nid(nodes[i].id).nodes({nodes[i]}); @@ -2525,11 +2525,11 @@ TORRENT_TEST(mutable_put) TEST_EQUAL(g_sent_packets.size(), 8); if (g_sent_packets.size() != 8) break; - itemv = span(buffer, bencode(buffer, items[0].ent)); + itemv = span(buffer, std::size_t(bencode(buffer, items[0].ent))); for (int i = 0; i < 8; ++i) { - auto const packet = find_packet(nodes[i].ep()); + auto const packet = find_packet(nodes[std::size_t(i)].ep()); TEST_CHECK(packet != g_sent_packets.end()); if (packet == g_sent_packets.end()) continue; @@ -2554,7 +2554,7 @@ TORRENT_TEST(mutable_put) if (put_mutable_item_keys[0].string_value() != "q" || put_mutable_item_keys[2].string_value() != "put") continue; - if (i < loop) send_dht_response(t.dht_node, response, nodes[i].ep()); + if (i < loop) send_dht_response(t.dht_node, response, nodes[std::size_t(i)].ep()); } else { @@ -2617,7 +2617,7 @@ TORRENT_TEST(traversal_done) // get_item_cb if (i == num_test_nodes) i = 0; - auto const packet = find_packet(nodes[i].ep()); + auto const packet = find_packet(nodes[std::size_t(i)].ep()); TEST_CHECK(packet != g_sent_packets.end()); if (packet == g_sent_packets.end()) continue; @@ -2672,7 +2672,7 @@ TORRENT_TEST(dht_dual_stack) if (family == "n4") return node4p; if (family == "n6") return node6p; TEST_CHECK(false); - return (node*)nullptr; + return static_cast(nullptr); }; std::unique_ptr dht_storage(dht_default_storage_constructor(sett)); dht_storage->update_node_ids({node_id(nullptr)}); @@ -3063,7 +3063,7 @@ TORRENT_TEST(routing_table_extended) aux::random_shuffle(node_id_prefix.begin(), node_id_prefix.end()); routing_table tbl(id, udp::v4(), 8, sett, &observer); - for (int i = 0; i < 256; ++i) + for (std::size_t i = 0; i < 256; ++i) { add_and_replace(id, diff); id[0] = node_id_prefix[i]; @@ -3094,7 +3094,7 @@ TORRENT_TEST(routing_table_set_id) for (int i = 0; i < 256; ++i) node_id_prefix.push_back(i & 0xff); aux::random_shuffle(node_id_prefix.begin(), node_id_prefix.end()); routing_table tbl(id, udp::v4(), 8, sett, &observer); - for (int i = 0; i < 256; ++i) + for (std::size_t i = 0; i < 256; ++i) { id[0] = node_id_prefix[i]; tbl.node_seen(id, rand_udp_ep(), 20 + (id[19] & 0xff)); diff --git a/test/test_file_storage.cpp b/test/test_file_storage.cpp index 6a7ee8c6e..954ec7480 100644 --- a/test/test_file_storage.cpp +++ b/test/test_file_storage.cpp @@ -449,8 +449,6 @@ void test_optimize(std::vector file_sizes TEST_EQUAL(fs.num_files(), int(expected_order.size())); if (fs.num_files() != int(expected_order.size())) return; - file_index_t idx{0}; - int num_pad_files = 0; std::cout << "{ "; for (file_index_t idx{0}; idx != fs.end_file(); ++idx) { @@ -458,6 +456,9 @@ void test_optimize(std::vector file_sizes std::cout << fs.file_size(idx) << " "; } std::cout << "}\n"; + + file_index_t idx{0}; + int num_pad_files = 0; for (int expect : expected_order) { if (expect == -1) diff --git a/test/test_heterogeneous_queue.cpp b/test/test_heterogeneous_queue.cpp index a9ce36ff4..71032c66f 100644 --- a/test/test_heterogeneous_queue.cpp +++ b/test/test_heterogeneous_queue.cpp @@ -67,7 +67,7 @@ struct D { static int instances; D() { ++instances; } - D(D const& d) { ++instances; } + D(D const&) { ++instances; } D(D&&) noexcept { ++instances; } ~D() { --instances; } @@ -316,10 +316,10 @@ TORRENT_TEST(copy_move) TEST_EQUAL(int(ptrs.size()), 1000); - for (int i = 0; i < int(ptrs.size()); ++i) + for (std::size_t i = 0; i < ptrs.size(); ++i) { ptrs[i]->check_invariant(); - TEST_EQUAL(ptrs[i]->f, i); + TEST_EQUAL(ptrs[i]->f, int(i)); } // destroy all objects, asserting that their invariant still holds diff --git a/test/test_http_connection.cpp b/test/test_http_connection.cpp index 86cab4dac..4661c89df 100644 --- a/test/test_http_connection.cpp +++ b/test/test_http_connection.cpp @@ -77,10 +77,10 @@ void http_connect_handler(http_connection& c) } void http_handler(error_code const& ec, http_parser const& parser - , span data, http_connection& c) + , span data, http_connection&) { ++handler_called; - data_size = data.size(); + data_size = int(data.size()); g_error_code = ec; TORRENT_ASSERT(data.empty() || parser.finished()); @@ -180,7 +180,7 @@ void run_suite(std::string const& protocol ps.type = proxy_type; if (ps.type != settings_pack::none) - ps.port = start_proxy(ps.type); + ps.port = aux::numeric_cast(start_proxy(ps.type)); typedef boost::optional err; diff --git a/test/test_packet_buffer.cpp b/test/test_packet_buffer.cpp index 34e940ebf..56b1a000f 100644 --- a/test/test_packet_buffer.cpp +++ b/test/test_packet_buffer.cpp @@ -33,6 +33,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "test.hpp" #include "libtorrent/packet_buffer.hpp" #include "libtorrent/packet_pool.hpp" +#include "libtorrent/aux_/numeric_cast.hpp" using lt::packet_buffer; using lt::packet_ptr; @@ -108,14 +109,14 @@ TORRENT_TEST(insert) for (int i = 0; i < 0xff; ++i) { int index = (i + 0xfff0) & 0xffff; - pb.insert(index, make_pkt(pool, index + 1)); + pb.insert(packet_buffer::index_type(index), make_pkt(pool, index + 1)); std::printf("insert: %u (mask: %x)\n", index, int(pb.capacity() - 1)); TEST_EQUAL(pb.capacity(), 512); if (i >= 14) { index = (index - 14) & 0xffff; std::printf("remove: %u\n", index); - TEST_EQUAL(get_val(pb.remove(index).get()), std::uint8_t(index + 1)); + TEST_EQUAL(get_val(pb.remove(packet_buffer::index_type(index)).get()), std::uint8_t(index + 1)); TEST_EQUAL(pb.size(), 14); } } diff --git a/test/test_part_file.cpp b/test/test_part_file.cpp index ce525d338..8843a073f 100644 --- a/test/test_part_file.cpp +++ b/test/test_part_file.cpp @@ -69,7 +69,7 @@ TORRENT_TEST(part_file) TEST_CHECK(!exists(combine_path(combine_path(cwd, "partfile_test_dir"), "partfile.parts"))); // write something to the metadata file - for (int i = 0; i < 1024; ++i) buf[i] = char(i & 0xff); + for (int i = 0; i < 1024; ++i) buf[std::size_t(i)] = char(i & 0xff); iovec_t v = buf; pf.writev(v, piece_index_t(10), 0, ec); @@ -94,7 +94,7 @@ TORRENT_TEST(part_file) if (ec) std::printf("part_file::readv: %s\n", ec.message().c_str()); for (int i = 0; i < 1024; ++i) - TEST_CHECK(buf[i] == char(i)); + TEST_CHECK(buf[std::size_t(i)] == char(i)); } { @@ -108,7 +108,7 @@ TORRENT_TEST(part_file) if (ec) std::printf("part_file::readv: %s\n", ec.message().c_str()); for (int i = 0; i < 1024; ++i) - TEST_CHECK(buf[i] == static_cast(i)); + TEST_CHECK(buf[std::size_t(i)] == static_cast(i)); // test exporting the piece to a file diff --git a/test/test_peer_classes.cpp b/test/test_peer_classes.cpp index db05a9f4e..90477705d 100644 --- a/test/test_peer_classes.cpp +++ b/test/test_peer_classes.cpp @@ -40,6 +40,7 @@ POSSIBILITY OF SUCH DAMAGE. using namespace lt; +namespace { std::string class_name(peer_class_t id, peer_class_pool const& p) { peer_class const* c = p.at(id); @@ -49,6 +50,7 @@ std::string class_name(peer_class_t id, peer_class_pool const& p) c->get_info(&i); return i.label; } +} // anonymous namespace TORRENT_TEST(peer_class) { diff --git a/test/test_peer_list.cpp b/test/test_peer_list.cpp index 7f618fb18..5939299ed 100644 --- a/test/test_peer_list.cpp +++ b/test/test_peer_list.cpp @@ -535,7 +535,7 @@ TORRENT_TEST(set_ip_filter) for (int i = 0; i < 100; ++i) { p.add_peer(tcp::endpoint( - address_v4((10 << 24) + ((i + 10) << 16)), 353), {}, {}, &st); + address_v4(std::uint32_t((10 << 24) + ((i + 10) << 16))), 353), {}, {}, &st); TEST_EQUAL(st.erased.size(), 0); st.erased.clear(); } @@ -565,7 +565,7 @@ TORRENT_TEST(set_port_filter) for (int i = 0; i < 100; ++i) { p.add_peer(tcp::endpoint( - address_v4((10 << 24) + ((i + 10) << 16)), i + 10), {}, {}, &st); + address_v4(std::uint32_t((10 << 24) + ((i + 10) << 16))), std::uint16_t(i + 10)), {}, {}, &st); TEST_EQUAL(st.erased.size(), 0); st.erased.clear(); } @@ -595,7 +595,7 @@ TORRENT_TEST(set_max_failcount) for (int i = 0; i < 100; ++i) { torrent_peer* peer = p.add_peer(tcp::endpoint( - address_v4((10 << 24) + ((i + 10) << 16)), i + 10), {}, {}, &st); + address_v4(std::uint32_t((10 << 24) + ((i + 10) << 16))), std::uint16_t(i + 10)), {}, {}, &st); TEST_EQUAL(st.erased.size(), 0); st.erased.clear(); // every other peer has a failcount of 1 @@ -625,7 +625,7 @@ TORRENT_TEST(set_seed) for (int i = 0; i < 100; ++i) { torrent_peer* peer = p.add_peer(tcp::endpoint( - address_v4((10 << 24) + ((i + 10) << 16)), i + 10), {}, {}, &st); + address_v4(std::uint32_t((10 << 24) + ((i + 10) << 16))), std::uint16_t(i + 10)), {}, {}, &st); TEST_EQUAL(st.erased.size(), 0); st.erased.clear(); // make every other peer a seed diff --git a/test/test_priority.cpp b/test/test_priority.cpp index 04200b589..e082be33e 100644 --- a/test/test_priority.cpp +++ b/test/test_priority.cpp @@ -297,9 +297,9 @@ done: else #endif { - error_code ec; - p = read_resume_data(resume_data, ec); - TEST_CHECK(!ec); + error_code ec1; + p = read_resume_data(resume_data, ec1); + TEST_CHECK(!ec1); } p.flags &= ~torrent_flags::paused; p.flags &= ~torrent_flags::auto_managed; diff --git a/test/test_random.cpp b/test/test_random.cpp index 36d3c0c07..cced2cebc 100644 --- a/test/test_random.cpp +++ b/test/test_random.cpp @@ -55,11 +55,11 @@ TORRENT_TEST(random) ++buckets[val & 0xff]; } - for (int i = 0; i < 256; ++i) + for (std::size_t i = 0; i < 256; ++i) { const int expected = repetitions / 256; // expect each bucket to be within 15% of the expected value - std::printf("%d: %f\n", i, double(buckets[i] - expected) * 100.0 / expected); + std::printf("%d: %f\n", int(i), double(buckets[i] - expected) * 100.0 / expected); TEST_CHECK(std::abs(buckets[i] - expected) < expected / 6); } } diff --git a/test/test_storage.cpp b/test/test_storage.cpp index 9d7c4721d..f1cfcb78a 100644 --- a/test/test_storage.cpp +++ b/test/test_storage.cpp @@ -60,8 +60,8 @@ using namespace lt; namespace { -std::size_t const piece_size = 16 * 1024 * 16; -std::size_t const half = piece_size / 2; +constexpr std::size_t piece_size = 16 * 1024 * 16; +constexpr std::size_t half = piece_size / 2; void on_check_resume_data(status_t const status, storage_error const& error, bool* done) { @@ -420,23 +420,23 @@ void test_check_files(std::string const& test_path std::shared_ptr info; error_code ec; - const int piece_size = 16 * 1024; + constexpr int piece_size_check = 16 * 1024; remove_all(combine_path(test_path, "temp_storage"), ec); if (ec && ec != boost::system::errc::no_such_file_or_directory) std::cout << "remove_all '" << combine_path(test_path, "temp_storage") << "': " << ec.message() << std::endl; file_storage fs; - fs.add_file("temp_storage/test1.tmp", piece_size); - fs.add_file("temp_storage/test2.tmp", piece_size * 2); - fs.add_file("temp_storage/test3.tmp", piece_size); + fs.add_file("temp_storage/test1.tmp", piece_size_check); + fs.add_file("temp_storage/test2.tmp", piece_size_check * 2); + fs.add_file("temp_storage/test3.tmp", piece_size_check); - std::vector piece0 = new_piece(piece_size); - std::vector piece2 = new_piece(piece_size); + std::vector piece0 = new_piece(piece_size_check); + std::vector piece2 = new_piece(piece_size_check); - lt::create_torrent t(fs, piece_size, -1, {}); + lt::create_torrent t(fs, piece_size_check, -1, {}); t.set_hash(piece_index_t(0), hasher(piece0).final()); - t.set_hash(piece_index_t(1), sha1_hash(nullptr)); - t.set_hash(piece_index_t(2), sha1_hash(nullptr)); + t.set_hash(piece_index_t(1), {}); + t.set_hash(piece_index_t(2), {}); t.set_hash(piece_index_t(3), hasher(piece2).final()); create_directory(combine_path(test_path, "temp_storage"), ec); @@ -445,11 +445,11 @@ void test_check_files(std::string const& test_path std::ofstream f; f.open(combine_path(test_path, combine_path("temp_storage", "test1.tmp")).c_str() , std::ios::trunc | std::ios::binary); - f.write(piece0.data(), piece_size); + f.write(piece0.data(), piece_size_check); f.close(); f.open(combine_path(test_path, combine_path("temp_storage", "test3.tmp")).c_str() , std::ios::trunc | std::ios::binary); - f.write(piece2.data(), piece_size); + f.write(piece2.data(), piece_size_check); f.close(); std::vector buf; @@ -520,7 +520,7 @@ void run_test(bool unbuffered) fs.add_file("temp_storage/test4.tmp", 0); fs.add_file("temp_storage/test5.tmp", 3253); fs.add_file("temp_storage/test6.tmp", 841); - const int last_file_size = 4 * piece_size - int(fs.total_size()); + int const last_file_size = 4 * int(piece_size) - int(fs.total_size()); fs.add_file("temp_storage/test7.tmp", last_file_size); // File layout @@ -561,7 +561,7 @@ void run_test(bool unbuffered) TEST_EQUAL(file_size(combine_path(base, "test6.tmp")), 841); std::printf("file: %d expected: %d last_file_size: %d, piece_size: %d\n" , int(file_size(combine_path(base, "test7.tmp"))) - , int(last_file_size - piece_size), last_file_size, int(piece_size)); + , last_file_size - int(piece_size), last_file_size, int(piece_size)); TEST_EQUAL(file_size(combine_path(base, "test7.tmp")), last_file_size - int(piece_size)); remove_all(combine_path(test_path, "temp_storage"), ec); if (ec && ec != boost::system::errc::no_such_file_or_directory) @@ -650,13 +650,12 @@ void test_fastresume(bool const test_deprecated) settings_pack pack = settings(); lt::session ses(pack); - error_code ec; - add_torrent_params p; p.ti = std::make_shared(std::cref(*t)); p.save_path = combine_path(test_path, "tmp1"); p.storage_mode = storage_mode_sparse; - torrent_handle h = ses.add_torrent(std::move(p), ec); + error_code ignore; + torrent_handle h = ses.add_torrent(std::move(p), ignore); TEST_CHECK(exists(combine_path(p.save_path, "temporary"))); if (!exists(combine_path(p.save_path, "temporary"))) return;