From b367a0cd50b99a9477b30f44c46306ef0dc1d6be Mon Sep 17 00:00:00 2001 From: arvidn Date: Sun, 2 Apr 2017 18:45:46 -0400 Subject: [PATCH] fix simulator build warnings --- simulation/libsimulator | 2 +- src/enum_net.cpp | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/simulation/libsimulator b/simulation/libsimulator index 60d786b8f..c1537196d 160000 --- a/simulation/libsimulator +++ b/simulation/libsimulator @@ -1 +1 @@ -Subproject commit 60d786b8fa6ddaacdc98bdf691220660bc194494 +Subproject commit c1537196d68a6950e00995d5594dcbce4485effd diff --git a/src/enum_net.cpp b/src/enum_net.cpp index 01a6c5ea9..0536854e8 100644 --- a/src/enum_net.cpp +++ b/src/enum_net.cpp @@ -440,13 +440,13 @@ namespace libtorrent std::vector
ips = ios.get_ips(); - for (int i = 0; i < int(ips.size()); ++i) + for (auto const& ip : ips) { ip_interface wan; - wan.interface_address = ips[i]; + wan.interface_address = ip; wan.netmask = address_v4::from_string("255.255.255.255"); strcpy(wan.name, "eth0"); - wan.mtu = ios.sim().config().path_mtu(ips[i], ips[i]); + wan.mtu = ios.sim().config().path_mtu(ip, ip); ret.push_back(wan); } @@ -707,14 +707,14 @@ namespace libtorrent std::vector
ips = ios.get_ips(); - for (int i = 0; i < int(ips.size()); ++i) + for (auto const& ip : ips) { ip_route r; - if (ips[i].is_v4()) + if (ip.is_v4()) { r.destination = address_v4(); r.netmask = address_v4::from_string("255.255.255.0"); - address_v4::bytes_type b = ips[i].to_v4().to_bytes(); + address_v4::bytes_type b = ip.to_v4().to_bytes(); b[3] = 1; r.gateway = address_v4(b); } @@ -722,12 +722,12 @@ namespace libtorrent { r.destination = address_v6(); r.netmask = address_v6::from_string("FFFF:FFFF:FFFF:FFFF::0"); - address_v6::bytes_type b = ips[i].to_v6().to_bytes(); + address_v6::bytes_type b = ip.to_v6().to_bytes(); b[14] = 1; r.gateway = address_v6(b); } strcpy(r.name, "eth0"); - r.mtu = ios.sim().config().path_mtu(ips[i], ips[i]); + r.mtu = ios.sim().config().path_mtu(ip, ip); ret.push_back(r); }