more warnings on appveyor

This commit is contained in:
arvidn 2018-11-16 16:19:12 +01:00 committed by Arvid Norberg
parent 9a03b25133
commit eab1055938
30 changed files with 107 additions and 94 deletions

View File

@ -75,32 +75,32 @@ build_script:
# examples
- cd %ROOT_DIRECTORY%\examples
- if defined bjam (
b2.exe --hash openssl-version=pre1.1 warnings-as-errors=on -j2 %compiler% address-model=%model% picker-debugging=on invariant-checks=full variant=%variant% %linkflags% %include% link=shared crypto=%crypto%
b2.exe --hash openssl-version=pre1.1 warnings=all warnings-as-errors=on -j2 %compiler% address-model=%model% picker-debugging=on invariant-checks=full variant=%variant% %linkflags% %include% link=shared crypto=%crypto%
)
# tools
- cd %ROOT_DIRECTORY%\tools
- if defined bjam (
b2.exe --hash openssl-version=pre1.1 warnings-as-errors=on -j2 %compiler% address-model=%model% picker-debugging=on invariant-checks=full variant=%variant% %linkflags% %include% link=shared crypto=%crypto%
b2.exe --hash openssl-version=pre1.1 warnings=all warnings-as-errors=on -j2 %compiler% address-model=%model% picker-debugging=on invariant-checks=full variant=%variant% %linkflags% %include% link=shared crypto=%crypto%
)
# test
- cd %ROOT_DIRECTORY%\test
- if defined bjam (
b2.exe --hash openssl-version=pre1.1 warnings-as-errors=on -j2 %compiler% address-model=%model% picker-debugging=on invariant-checks=full variant=%variant% %linkflags% %include% link=shared crypto=%crypto% win-tests test_upnp test_natpmp testing.execute=off
b2.exe --hash openssl-version=pre1.1 warnings=all warnings-as-errors=on -j2 %compiler% address-model=%model% picker-debugging=on invariant-checks=full variant=%variant% %linkflags% %include% link=shared crypto=%crypto% win-tests test_upnp test_natpmp testing.execute=off
)
# python binding
- cd %ROOT_DIRECTORY%\bindings\python
# we use 64 bit python builds
- if defined python (
b2.exe --hash openssl-version=pre1.1 warnings-as-errors=on -j2 %compiler% address-model=%model% picker-debugging=on invariant-checks=full variant=%variant% %linkflags% %include% link=shared crypto=%crypto% libtorrent-link=shared stage_module stage_dependencies
b2.exe --hash openssl-version=pre1.1 warnings=all warnings-as-errors=on -j2 %compiler% address-model=%model% picker-debugging=on invariant-checks=full variant=%variant% %linkflags% %include% link=shared crypto=%crypto% libtorrent-link=shared stage_module stage_dependencies
)
# simulations
- cd %ROOT_DIRECTORY%\simulation
- if defined sim (
b2.exe --hash openssl-version=pre1.1 warnings-as-errors=on -j2 %compiler% address-model=%model% debug-iterators=off picker-debugging=on invariant-checks=full test_debug %linkflags% %include% boost-link=default link=static crypto=built-in define=BOOST_ASIO_DISABLE_IOCP testing.execute=off
b2.exe --hash openssl-version=pre1.1 warnings=all warnings-as-errors=on -j2 %compiler% address-model=%model% debug-iterators=off picker-debugging=on invariant-checks=full test_debug %linkflags% %include% boost-link=default link=static crypto=built-in define=BOOST_ASIO_DISABLE_IOCP testing.execute=off
)
# minimal support for cmake build
@ -115,7 +115,7 @@ build_script:
test_script:
- cd %ROOT_DIRECTORY%\test
- if defined bjam (
appveyor-retry b2.exe -l400 --hash openssl-version=pre1.1 warnings-as-errors=on -j2 %compiler% address-model=%model% picker-debugging=on invariant-checks=full variant=%variant% %linkflags% %include% link=shared crypto=%crypto% win-tests
appveyor-retry b2.exe -l400 --hash openssl-version=pre1.1 warnings=all warnings-as-errors=on -j2 %compiler% address-model=%model% picker-debugging=on invariant-checks=full variant=%variant% %linkflags% %include% link=shared crypto=%crypto% win-tests
)
- cd %ROOT_DIRECTORY%\bindings\python

View File

@ -210,6 +210,9 @@ my-python-extension libtorrent
<conditional>@libtorrent_linking
<crypto>openssl:<library>/torrent//ssl
<crypto>openssl:<library>/torrent//crypto
# C4268: 'identifier' : 'const' static/global data initialized
# with compiler generated default constructor fills the object with zeros
<toolset>msvc:<cflags>/wd4268
: # default-build
<warnings>all
: # usage-requirements

View File

@ -54,7 +54,7 @@ struct tuple_to_endpoint
if (PyTuple_Size(x) != 2) return nullptr;
extract<std::string> ip(object(borrowed(PyTuple_GetItem(x, 0))));
if (!ip.check()) return nullptr;
extract<int> port(object(borrowed(PyTuple_GetItem(x, 1))));
extract<std::uint16_t> port(object(borrowed(PyTuple_GetItem(x, 1))));
if (!port.check()) return nullptr;
lt::error_code ec;
lt::address::from_string(ip, ec);
@ -69,7 +69,7 @@ struct tuple_to_endpoint
object o(borrowed(x));
data->convertible = new (storage) T(lt::address::from_string(
extract<std::string>(o[0])), extract<int>(o[1]));
extract<std::string>(o[0])), extract<std::uint16_t>(o[1]));
}
};

View File

@ -145,14 +145,14 @@ private:
boost::system::error_category const* m_cat;
};
void error_code_assign(boost::system::error_code& self, int const v, category_holder const cat)
void error_code_assign(boost::system::error_code& me, int const v, category_holder const cat)
{
self.assign(v, cat.ref());
me.assign(v, cat.ref());
}
category_holder error_code_category(boost::system::error_code const& self)
category_holder error_code_category(boost::system::error_code const& me)
{
return category_holder(self.category());
return category_holder(me.category());
}
#define WRAP_CAT(name) \

View File

@ -191,9 +191,9 @@ void dict_to_announce_entry(dict d, announce_entry& ae)
{
ae.url = extract<std::string>(d["url"]);
if (d.has_key("tier"))
ae.tier = extract<int>(d["tier"]);
ae.tier = extract<std::uint8_t>(d["tier"]);
if (d.has_key("fail_limit"))
ae.fail_limit = extract<int>(d["fail_limit"]);
ae.fail_limit = extract<std::uint8_t>(d["fail_limit"]);
}
void replace_trackers(torrent_handle& h, object trackers)

View File

@ -15,6 +15,9 @@ project client_test
<toolset>darwin:<cflags>-Wno-unused-command-line-argument
# disable warning C4275: non DLL-interface classkey 'identifier' used as base for DLL-interface classkey 'identifier'
<toolset>msvc:<cflags>/wd4275
# C4268: 'identifier' : 'const' static/global data initialized
# with compiler generated default constructor fills the object with zeros
<toolset>msvc:<cflags>/wd4268
: default-build
<link>static
;

View File

@ -118,8 +118,8 @@ int main(int argc, char const* argv[]) try
if (auto rd = lt::alert_cast<lt::save_resume_data_alert>(a)) {
std::ofstream of(".resume_file", std::ios_base::binary);
of.unsetf(std::ios_base::skipws);
auto buf = write_resume_data_buf(rd->params);
of.write(buf.data(), buf.size());
auto const b = write_resume_data_buf(rd->params);
of.write(b.data(), b.size());
}
if (auto st = lt::alert_cast<lt::state_update_alert>(a)) {

View File

@ -102,7 +102,7 @@ bool sleep_and_input(int* c, lt::time_duration const sleep)
std::this_thread::sleep_for(sleep / 2);
}
return false;
};
}
#else

View File

@ -382,9 +382,9 @@ std::pair<int, int> terminal_size()
}
#ifdef _WIN32
void apply_ansi_code(int* attributes, bool* reverse, bool* support_chaining, int code)
void apply_ansi_code(WORD* attributes, bool* reverse, bool* support_chaining, int code)
{
static const int color_table[8] =
static const WORD color_table[8] =
{
0, // black
FOREGROUND_RED, // red
@ -459,7 +459,7 @@ void print(char const* buf)
#ifdef _WIN32
HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE);
int current_attributes = 7;
WORD current_attributes = 7;
bool reverse = false;
SetConsoleTextAttribute(out, current_attributes);

View File

@ -18,6 +18,7 @@ project
<source>utils.cpp
<toolset>msvc:<cflags>/wd4275
<toolset>msvc:<cflags>/wd4005
<toolset>msvc:<cflags>/wd4268
: default-build
<threading>multi
<invariant-checks>full

View File

@ -288,7 +288,8 @@ struct udp_server
boost::system::error_code ec;
m_socket.open(asio::ip::udp::v4(), ec);
TEST_CHECK(!ec);
m_socket.bind(asio::ip::udp::endpoint(asio::ip::address_v4::any(), port), ec);
m_socket.bind(asio::ip::udp::endpoint(asio::ip::address_v4::any()
, static_cast<std::uint16_t>(port)), ec);
TEST_CHECK(!ec);
m_socket.non_blocking(true);

View File

@ -152,7 +152,7 @@ struct dht_node final : lt::dht::socket_manager
}
bool has_quota() override { return true; }
bool send_packet(lt::aux::listen_socket_handle const& s, entry& e, udp::endpoint const& addr) override
bool send_packet(lt::aux::listen_socket_handle const&, entry& e, udp::endpoint const& addr) override
{
// since the simulaton is single threaded, we can get away with allocating
// just a single send buffer

View File

@ -74,7 +74,7 @@ void run_test(Settings const& sett, Setup const& setup, Test const& test)
// set up a timer to fire later, to verify everything we expected to happen
// happened
sim::timer t(sim, lt::seconds((num_torrents + 1) * 60)
, [&](boost::system::error_code const& ec)
, [&](boost::system::error_code const&)
{
test(*ses);

View File

@ -89,7 +89,7 @@ TORRENT_TEST(no_truncate_checking)
std::string filename;
int size = 0;
run_test(
[&](lt::add_torrent_params& atp, lt::settings_pack& p) {
[&](lt::add_torrent_params& atp, lt::settings_pack&) {
filename = lt::combine_path(atp.save_path, atp.ti->files().file_path(lt::file_index_t{0}));
std::ofstream f(filename);
// create a file that's 100 bytes larger
@ -97,7 +97,7 @@ TORRENT_TEST(no_truncate_checking)
std::vector<char> dummy(size);
f.write(dummy.data(), dummy.size());
},
[](lt::session& ses) {}
[](lt::session&) {}
);
// file should not have been truncated just by checking
@ -127,7 +127,7 @@ std::shared_ptr<lt::torrent_info> create_multifile_torrent()
TORRENT_TEST(aligned_zero_priority)
{
run_test(
[&](lt::add_torrent_params& atp, lt::settings_pack& p) {
[&](lt::add_torrent_params& atp, lt::settings_pack&) {
atp.file_priorities.push_back(lt::download_priority_t{1});
atp.file_priorities.push_back(lt::download_priority_t{0});
atp.ti = create_multifile_torrent();
@ -147,7 +147,7 @@ TORRENT_TEST(aligned_zero_priority_no_file)
{
std::string partfile;
run_test(
[&](lt::add_torrent_params& atp, lt::settings_pack& p) {
[&](lt::add_torrent_params& atp, lt::settings_pack&) {
atp.ti = create_multifile_torrent();
atp.save_path = ".";
atp.file_priorities.push_back(lt::download_priority_t{1});
@ -181,7 +181,7 @@ TORRENT_TEST(zero_priority_missing_partfile)
{
std::shared_ptr<lt::torrent_info> ti = create_multifile_torrent();
run_test(
[&](lt::add_torrent_params& atp, lt::settings_pack& p) {
[&](lt::add_torrent_params& atp, lt::settings_pack&) {
atp.ti = ti;
atp.save_path = ".";
atp.file_priorities.push_back(lt::download_priority_t{1});

View File

@ -83,7 +83,7 @@ TORRENT_TEST(dht_bootstrap)
lt::deadline_timer timer(ios);
timer.expires_from_now(lt::seconds(10));
timer.async_wait([&](lt::error_code const& ec) {
timer.async_wait([&](lt::error_code const&) {
zombies.push_back(ses->abort());
node.close();
ses.reset();

View File

@ -73,7 +73,7 @@ struct obs : dht::dht_observer
#ifndef TORRENT_DISABLE_LOGGING
bool should_log(module_t) const override { return true; }
void log(dht_logger::module_t l, char const* fmt, ...) override
void log(dht_logger::module_t, char const* fmt, ...) override
{
va_list v;
va_start(v, fmt);

View File

@ -199,7 +199,7 @@ TORRENT_TEST(dht_storage_infohashes_sample)
sim::asio::high_resolution_timer timer(ios);
timer.expires_from_now(hours(1)); // expiration of torrents
timer.async_wait([&s](boost::system::error_code const& ec)
timer.async_wait([&s](boost::system::error_code const&)
{
// tick here to trigger the torrents expiration
s->tick();

View File

@ -129,7 +129,7 @@ void run_test(HandleAlerts const& on_alert, Test const& test)
params.save_path = save_path(1);
ses[1]->async_add_torrent(params);
sim::timer t(sim, lt::seconds(60), [&](boost::system::error_code const& ec)
sim::timer t(sim, lt::seconds(60), [&](boost::system::error_code const&)
{
test(ses);
@ -200,7 +200,7 @@ TORRENT_TEST(error_handling)
using namespace lt;
run_test(
[](lt::session&, lt::alert const*) {},
[](std::shared_ptr<lt::session> ses[2]) {}
[](std::shared_ptr<lt::session>[2]) {}
);
}
catch (std::bad_alloc const&)

View File

@ -113,8 +113,7 @@ TORRENT_TEST(file_pool_size)
atp.ti->remap_files(fs);
}
// on alert
, [&](lt::alert const* a, lt::session&)
{}
, [&](lt::alert const*, lt::session&) {}
// terminate
, [&](int ticks, lt::session& ses) -> bool
{

View File

@ -622,7 +622,7 @@ TORRENT_TEST(http_connection_ssl_proxy)
int proxy_counter = 0;
http_proxy.register_handler("10.0.0.2:8080"
, [&proxy_counter](std::string method, std::string req, std::map<std::string, std::string>& headers)
, [&proxy_counter](std::string method, std::string req, std::map<std::string, std::string>&)
{
proxy_counter++;
TEST_EQUAL(method, "CONNECT");
@ -631,8 +631,8 @@ TORRENT_TEST(http_connection_ssl_proxy)
auto h = std::make_shared<http_connection>(client_ios
, res
, [&client_counter](error_code const& ec, http_parser const& parser
, span<char const>, http_connection& c)
, [&client_counter](error_code const& ec, http_parser const&
, span<char const>, http_connection&)
{
client_counter++;
TEST_EQUAL(ec, boost::asio::error::operation_not_supported);

View File

@ -118,7 +118,7 @@ TORRENT_TEST(torrent_paused_disconnect)
{
run_test(
[](lt::session&) {},
[](lt::session&, lt::torrent_handle h, std::array<fake_peer*, 3>& test_peers) {
[](lt::session&, lt::torrent_handle h, std::array<fake_peer*, 3>&) {
add_fake_peers(h, 3);
},

View File

@ -45,7 +45,7 @@ POSSIBILITY OF SUCH DAMAGE.
using namespace lt;
char const* pe_policy(std::uint8_t policy)
char const* pe_policy(int const policy)
{
if (policy == settings_pack::pe_disabled) return "disabled";
else if (policy == settings_pack::pe_enabled) return "enabled";
@ -90,9 +90,9 @@ void test_transfer(int enc_policy, int level, bool prefer_rc4)
pack.set_bool(settings_pack::prefer_rc4, false);
}
// add torrent
, [](lt::add_torrent_params& params) {}
, [](lt::add_torrent_params&) {}
// on alert
, [](lt::alert const* a, lt::session& ses) {}
, [](lt::alert const*, lt::session&) {}
// terminate
, [](int ticks, lt::session& ses) -> bool
{
@ -176,9 +176,9 @@ TORRENT_TEST(disabled_failing)
pack.set_bool(settings_pack::prefer_rc4, true);
}
// add torrent
, [](lt::add_torrent_params& params) {}
, [](lt::add_torrent_params&) {}
// on alert
, [](lt::alert const* a, lt::session& ses) {}
, [](lt::alert const*, lt::session&) {}
// terminate
, [](int ticks, lt::session& ses) -> bool
{

View File

@ -58,9 +58,9 @@ TORRENT_TEST(seed_mode)
params.flags |= torrent_flags::seed_mode;
}
// on alert
, [](lt::alert const* a, lt::session& ses) {}
, [](lt::alert const*, lt::session&) {}
// terminate
, [](int ticks, lt::session& ses) -> bool {
, [](int ticks, lt::session&) -> bool {
// we don't need to finish seeding, exit after 20 seconds
return ticks > 20;
});
@ -80,9 +80,9 @@ TORRENT_TEST(ip_notifier_setting)
pack.set_int(settings_pack::alert_mask, alert::all_categories);
}
// add torrent
, [](lt::add_torrent_params& params) {}
, [](lt::add_torrent_params&) {}
// on alert
, [&s_tick, &working_count](lt::alert const* a, lt::session& ses)
, [&s_tick, &working_count](lt::alert const* a, lt::session&)
{
std::string const msg = a->message();
if (msg.find("received error on_ip_change:") != std::string::npos)
@ -148,13 +148,13 @@ TORRENT_TEST(add_extension_while_transfer)
pack.set_int(settings_pack::alert_mask, alert::all_categories);
}
// add torrent
, [](lt::add_torrent_params& params) {}
, [](lt::add_torrent_params&) {}
// on alert
, [&done, p](lt::alert const* a, lt::session& ses)
, [&done, p](lt::alert const* a, lt::session&)
{
if (a->type() == peer_connect_alert::alert_type)
{
auto create_test_plugin = [p](torrent_handle const& th, void*)
auto create_test_plugin = [p](torrent_handle const&, void*)
{ return p; };
lt::torrent_handle th = alert_cast<peer_connect_alert>(a)->handle;
@ -164,7 +164,7 @@ TORRENT_TEST(add_extension_while_transfer)
}
}
// terminate
, [&done](int ticks, lt::session& ses) -> bool
, [&done](int ticks, lt::session&) -> bool
{
// exit after 10 seconds
return ticks > 10 || done;

View File

@ -180,11 +180,11 @@ TORRENT_TEST(udp_tracker)
params.save_path = ".";
ses.async_add_torrent(params);
},
[&tracker_alert](lt::session& ses, lt::alert const* alert) {
[&tracker_alert](lt::session&, lt::alert const* alert) {
if (lt::alert_cast<lt::tracker_announce_alert>(alert))
tracker_alert = true;
},
[&](sim::simulation& sim, lt::session& ses
[&](sim::simulation& sim, lt::session&
, std::shared_ptr<lt::torrent_info> ti)
{
// listen on port 8080
@ -269,7 +269,7 @@ TORRENT_TEST(socks5_udp_retry)
// run for 60 seconds.The sokcks5 retry interval is expected to be 5 seconds,
// meaning there should have been 12 connection attempts
sim::timer t(sim, lt::seconds(60), [&](boost::system::error_code const& ec)
sim::timer t(sim, lt::seconds(60), [&](boost::system::error_code const&)
{
fprintf(stderr, "shutting down\n");
// shut down

View File

@ -110,9 +110,9 @@ TORRENT_TEST(seed_mode_suggest)
params.flags |= torrent_flags::seed_mode;
}
// on alert
, [](lt::alert const* a, lt::session& ses) {}
, [](lt::alert const*, lt::session&) {}
// terminate
, [](int ticks, lt::session& ses) -> bool
, [](int, lt::session&) -> bool
{ return true; });
}
@ -559,7 +559,7 @@ TORRENT_TEST(delete_partfile)
// add torrent
, [](lt::add_torrent_params&) {}
// on alert
, [](lt::alert const* a, lt::session&) {}
, [](lt::alert const*, lt::session&) {}
// terminate
, [&save_path](int, lt::session& ses) -> bool
{
@ -637,10 +637,10 @@ TORRENT_TEST(block_uploaded_alert)
int blocks_per_piece = at->handle.torrent_file()->piece_length() / 0x4000;
blocks.resize(at->handle.torrent_file()->num_pieces(), std::vector<bool>(blocks_per_piece, false));
}
else if (auto at = lt::alert_cast<lt::block_uploaded_alert>(a))
else if (auto ua = lt::alert_cast<lt::block_uploaded_alert>(a))
{
TEST_EQUAL(blocks[static_cast<int>(at->piece_index)][at->block_index], false);
blocks[static_cast<int>(at->piece_index)][at->block_index] = true;
TEST_EQUAL(blocks[static_cast<int>(ua->piece_index)][ua->block_index], false);
blocks[static_cast<int>(ua->piece_index)][ua->block_index] = true;
}
}
// terminate
@ -667,9 +667,9 @@ void test_settings(SettingsFun fun)
// add session
, fun
// add torrent
, [](lt::add_torrent_params& params) {}
, [](lt::add_torrent_params&) {}
// on alert
, [](lt::alert const* a, lt::session& ses) {}
, [](lt::alert const*, lt::session&) {}
// terminate
, [](int ticks, lt::session& ses) -> bool
{

View File

@ -124,7 +124,7 @@ void test_interval(int interval)
}
}
// terminate
, [&](int const ticks, lt::session& ses) -> bool {
, [&](int const ticks, lt::session&) -> bool {
if (ticks > duration + 1)
{
ran_to_completion = true;
@ -479,7 +479,7 @@ void test_udpv6_support(char const* listen_interfaces
}
else if (alert_cast<tracker_error_alert>(a))
{
TEST_CHECK(false && "unexpected tracker error");
TEST_ERROR("unexpected tracker error");
}
}
});
@ -1003,13 +1003,13 @@ TORRENT_TEST(tracker_key_argument)
{
std::set<std::string> keys;
tracker_test(
[](lt::add_torrent_params& p, lt::session& ses)
[](lt::add_torrent_params& p, lt::session&)
{
p.ti = make_torrent(true);
return 60;
},
[&](std::string method, std::string req
, std::map<std::string, std::string>& headers)
[&](std::string, std::string req
, std::map<std::string, std::string>&)
{
auto const pos = req.find("&key=");
TEST_CHECK(pos != std::string::npos);
@ -1198,7 +1198,7 @@ TORRENT_TEST(tracker_tiers)
ses[1] = std::make_shared<lt::session>(pack, ios1);
// only monitor alerts for session 0 (the downloader)
print_alerts(*ses[0], [=](lt::session& ses, lt::alert const* a) {
print_alerts(*ses[0], [=](lt::session&, lt::alert const* a) {
if (auto ta = alert_cast<lt::add_torrent_alert>(a))
{
ta->handle.connect_peer(lt::tcp::endpoint(peer1, 6881));
@ -1224,7 +1224,7 @@ TORRENT_TEST(tracker_tiers)
params.save_path = save_path(1);
ses[1]->async_add_torrent(params);
sim::timer t(sim, lt::minutes(30), [&](boost::system::error_code const& ec)
sim::timer t(sim, lt::minutes(30), [&](boost::system::error_code const&)
{
TEST_CHECK(received_announce[0] != received_announce[1]);
TEST_CHECK(ses[0]->get_torrents()[0].status().is_seeding);

View File

@ -140,7 +140,7 @@ void run_test(
params.save_path = save_path(1);
ses[1]->async_add_torrent(params);
sim::timer t(sim, lt::seconds(60), [&](boost::system::error_code const& ec)
sim::timer t(sim, lt::seconds(60), [&](boost::system::error_code const&)
{
test(ses);

View File

@ -127,7 +127,7 @@ void run_test(Setup const& setup
// set up a timer to fire later, to verify everything we expected to happen
// happened
sim::timer t(sim, timeout, [&](boost::system::error_code const& ec)
sim::timer t(sim, timeout, [&](boost::system::error_code const&)
{
std::printf("shutting down\n");
// shut down
@ -153,8 +153,8 @@ TORRENT_TEST(single_file)
{
ses.async_add_torrent(params);
},
[](lt::session& ses, lt::alert const* alert) {},
[&expected](sim::simulation& sim, lt::session& ses)
[](lt::session&, lt::alert const*) {},
[&expected](sim::simulation& sim, lt::session&)
{
sim::asio::io_service web_server(sim, address_v4::from_string("2.2.2.2"));
// listen on port 8080
@ -191,8 +191,8 @@ TORRENT_TEST(multi_file)
{
ses.async_add_torrent(params);
},
[](lt::session& ses, lt::alert const* alert) {},
[&expected](sim::simulation& sim, lt::session& ses)
[](lt::session&, lt::alert const*) {},
[&expected](sim::simulation& sim, lt::session&)
{
sim::asio::io_service web_server(sim, address_v4::from_string("2.2.2.2"));
// listen on port 8080
@ -226,9 +226,9 @@ std::string generate_content(lt::file_storage const& fs, file_index_t file
std::string ret;
ret.reserve(lt::aux::numeric_cast<std::size_t>(len));
std::int64_t const file_offset = fs.file_offset(file);
int const piece_size = fs.piece_length();
int const piece_sz = fs.piece_length();
for (std::int64_t i = offset + file_offset; i < offset + file_offset + len; ++i)
ret.push_back(((i % piece_size) % 26) + 'A');
ret.push_back(((i % piece_sz) % 26) + 'A');
return ret;
}
@ -258,11 +258,11 @@ TORRENT_TEST(unaligned_file_redirect)
{
ses.async_add_torrent(params);
},
[&](lt::session& ses, lt::alert const* alert) {
[&](lt::session&, lt::alert const* alert) {
if (lt::alert_cast<lt::torrent_finished_alert>(alert))
seeding = true;
},
[&fs](sim::simulation& sim, lt::session& ses)
[&fs](sim::simulation& sim, lt::session&)
{
// http1 is the root web server that will just redirect requests to
// other servers
@ -307,11 +307,11 @@ TORRENT_TEST(multi_file_redirect_pad_files)
{
ses.async_add_torrent(params);
},
[&](lt::session& ses, lt::alert const* alert) {
[&](lt::session&, lt::alert const* alert) {
if (lt::alert_cast<lt::torrent_finished_alert>(alert))
seeding = true;
},
[&fs](sim::simulation& sim, lt::session& ses)
[&fs](sim::simulation& sim, lt::session&)
{
// http1 is the root web server that will just redirect requests to
// other servers
@ -355,11 +355,11 @@ TORRENT_TEST(multi_file_redirect)
{
ses.async_add_torrent(params);
},
[&](lt::session& ses, lt::alert const* alert) {
[&](lt::session&, lt::alert const* alert) {
if (lt::alert_cast<lt::torrent_finished_alert>(alert))
seeding = true;
},
[&fs](sim::simulation& sim, lt::session& ses)
[&fs](sim::simulation& sim, lt::session&)
{
// http1 is the root web server that will just redirect requests to
// other servers
@ -413,12 +413,12 @@ TORRENT_TEST(multi_file_redirect_through_proxy)
ses.async_add_torrent(params);
},
[&](lt::session& ses, lt::alert const* alert) {
[&](lt::session&, lt::alert const* alert) {
if (lt::alert_cast<lt::torrent_finished_alert>(alert)) {
seeding = true;
}
},
[&fs](sim::simulation& sim, lt::session& ses)
[&fs](sim::simulation& sim, lt::session&)
{
sim::asio::io_service proxy_ios(sim, address_v4::from_string("50.50.50.50"));
sim::http_proxy http_p(proxy_ios, 4445);
@ -464,11 +464,11 @@ TORRENT_TEST(multi_file_unaligned_redirect)
{
ses.async_add_torrent(params);
},
[&](lt::session& ses, lt::alert const* alert) {
[&](lt::session&, lt::alert const* alert) {
// We don't expect to get this aslert
TEST_CHECK(lt::alert_cast<lt::torrent_finished_alert>(alert) == nullptr);
},
[&fs](sim::simulation& sim, lt::session& ses)
[&fs](sim::simulation& sim, lt::session&)
{
// http1 is the root web server that will just redirect requests to
// other servers
@ -507,13 +507,13 @@ TORRENT_TEST(urlseed_timeout)
params.save_path = ".";
ses.async_add_torrent(params);
},
[&timeout](lt::session& ses, lt::alert const* alert) {
[&timeout](lt::session&, lt::alert const* alert) {
const lt::peer_disconnected_alert *pda = lt::alert_cast<lt::peer_disconnected_alert>(alert);
if (pda && pda->error == errors::timed_out_inactivity){
timeout = true;
}
},
[](sim::simulation& sim, lt::session& ses)
[](sim::simulation& sim, lt::session&)
{
sim::asio::io_service web_server(sim, address_v4::from_string("2.2.2.2"));
@ -547,8 +547,8 @@ TORRENT_TEST(no_close_redudant_webseed)
ses.apply_settings(pack);
ses.async_add_torrent(params);
},
[](lt::session& ses, lt::alert const* alert) {},
[&expected](sim::simulation& sim, lt::session& ses)
[](lt::session&, lt::alert const*) {},
[&expected](sim::simulation& sim, lt::session&)
{
sim::asio::io_service web_server(sim, address_v4::from_string("2.2.2.2"));
// listen on port 8080
@ -595,8 +595,8 @@ TORRENT_TEST(web_seed_connection_limit)
ses.apply_settings(pack);
ses.async_add_torrent(params);
},
[](lt::session& ses, lt::alert const* alert) {},
[&expected](sim::simulation& sim, lt::session& ses)
[](lt::session&, lt::alert const*) {},
[&expected](sim::simulation& sim, lt::session&)
{
using ios = sim::asio::io_service;
ios web_server1{sim, address_v4::from_string("2.2.2.1")};

View File

@ -53,6 +53,9 @@ project
<toolset>msvc:<cflags>/wd4309
# C4310: cast truncates constant value
<toolset>msvc:<cflags>/wd4310
# C4268: 'identifier' : 'const' static/global data initialized
# with compiler generated default constructor fills the object with zeros
<toolset>msvc:<cflags>/wd4268
<conditional>@warnings
<export-extra>on
: default-build

View File

@ -30,6 +30,9 @@ project tools
<threading>multi
# disable warning C4275: non DLL-interface classkey 'identifier' used as base for DLL-interface classkey 'identifier'
<toolset>msvc:<cflags>/wd4275
# C4268: 'identifier' : 'const' static/global data initialized
# with compiler generated default constructor fills the object with zeros
<toolset>msvc:<cflags>/wd4268
<conditional>@link_libtorrent
: default-build
<link>static