headers, end of file, code cleanup

This commit is contained in:
Alden Torres 2016-12-11 21:37:07 -05:00 committed by Arvid Norberg
parent 51fb7feeb7
commit f382936d56
31 changed files with 20 additions and 92 deletions

View File

@ -238,7 +238,6 @@ rule warnings ( properties * )
result += <cxxflags>-Wno-c++98-compat-pedantic ;
result += <cflags>-Wno-padded ;
result += <cflags>-Wno-global-constructors ;
result += <cxxflags>-Wno-c++98-compat ;
# this warns on any global static object, which are used for error_category
# objects
result += <cflags>-Wno-exit-time-destructors ;
@ -261,7 +260,6 @@ rule warnings ( properties * )
result += <cflags>-Wno-long-long ;
# enable these warnings again, once the other ones are dealt with
result += <cflags>-Wno-sign-compare ;
result += <cflags>-Wno-unused-variable ;
}
@ -778,4 +776,3 @@ package.install install
: torrent
: $(headers)
;

View File

@ -123,4 +123,3 @@ extern char const* libtorrent_assert_log;
#endif // TORRENT_USE_ASSERTS
#endif

View File

@ -36,6 +36,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <vector>
#include <string>
#include <cstdint>
#include <cstddef>
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/system/error_code.hpp>

View File

@ -37,8 +37,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <vector>
#if TORRENT_USE_IFCONF || TORRENT_USE_NETLINK || TORRENT_USE_SYSCTL
#include <sys/socket.h> // for SO_BINDTODEVICE
#endif
@ -51,6 +49,8 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/socket.hpp"
#include "libtorrent/aux_/bind_to_device.hpp"
#include <vector>
namespace libtorrent
{
struct socket_type;

View File

@ -71,4 +71,3 @@ namespace libtorrent
}
#endif // TORRENT_PEER_HPP_INCLUDED

View File

@ -64,7 +64,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/span.hpp"
#include "libtorrent/piece_block.hpp"
#include "libtorrent/peer_info.hpp"
#include "libtorrent/disk_interface.hpp"
#include <ctime>
#include <algorithm>
@ -79,6 +78,7 @@ namespace libtorrent
{
class torrent;
struct torrent_peer;
struct disk_interface;
#ifndef TORRENT_DISABLE_EXTENSIONS
struct peer_plugin;

View File

@ -68,10 +68,8 @@ namespace libtorrent
struct request_callback;
class tracker_manager;
struct timeout_handler;
struct tracker_connection;
class udp_tracker_connection;
class http_tracker_connection;
class udp_socket;
struct resolver_interface;
struct counters;
struct ip_filter;

View File

@ -36,16 +36,11 @@ POSSIBILITY OF SUCH DAMAGE.
#include <vector>
#include <string>
#include <utility>
#include <ctime>
#include <mutex>
#include <cstdint>
#include <memory>
#include "libtorrent/udp_socket.hpp"
#include "libtorrent/entry.hpp"
#include "libtorrent/session_settings.hpp"
#include "libtorrent/peer_id.hpp"
#include "libtorrent/peer.hpp"
#include "libtorrent/tracker_manager.hpp"
#include "libtorrent/config.hpp"
@ -133,4 +128,3 @@ namespace libtorrent
}
#endif // TORRENT_UDP_TRACKER_CONNECTION_HPP_INCLUDED

View File

@ -42,16 +42,11 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/config.hpp"
#include "libtorrent/web_connection_base.hpp"
#include "libtorrent/disk_buffer_holder.hpp"
#include "libtorrent/torrent.hpp"
#include "libtorrent/piece_block_progress.hpp"
#include "libtorrent/http_parser.hpp"
#include "libtorrent/operations.hpp" // for operation_t enum
namespace libtorrent
{
class torrent;
class TORRENT_EXTRA_EXPORT web_peer_connection
: public web_connection_base
{

View File

@ -374,4 +374,3 @@ TORRENT_EXPORT void assert_fail(char const*, int, char const*
, char const*, char const*, int) {}
#endif

View File

@ -32,7 +32,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/bdecode.hpp"
#include "libtorrent/alloca.hpp"
#include <boost/system/error_code.hpp>
#include <limits>
#include <cstring> // for memset
#include <cstdio> // for snprintf
@ -1021,4 +1020,3 @@ done:
return ret;
}
}

View File

@ -33,12 +33,10 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/config.hpp"
#include "libtorrent/enum_net.hpp"
#include "libtorrent/broadcast_socket.hpp"
#include "libtorrent/error_code.hpp"
#include "libtorrent/assert.hpp"
#include "libtorrent/socket_type.hpp"
#include <functional>
#include <vector>
#include <cstdlib> // for wcstombscstombs
#include "libtorrent/aux_/disable_warnings_push.hpp"

View File

@ -2156,7 +2156,7 @@ typedef struct _FILE_ALLOCATED_RANGE_BUFFER {
// update the modification time of the file for no good
// reason.
if ((m_open_mode & sparse) == 0
&& st.st_blocks < (s + st.st_blksize - 1) / st.st_blksize)
&& std::int64_t(st.st_blocks) < (s + st.st_blksize - 1) / st.st_blksize)
{
// How do we know that the file is already allocated?
// if we always try to allocate the space, we'll update

View File

@ -158,7 +158,7 @@ namespace libtorrent { namespace aux
TORRENT_ASSERT(file_index != fs.num_files());
TORRENT_ASSERT(file_offset <= fs.file_size(file_index));
std::int64_t const add = (std::min)(fs.file_size(file_index)
- file_offset, std::int64_t(size));
- file_offset, size);
m_file_progress[file_index] += add;
TORRENT_ASSERT(m_file_progress[file_index]

View File

@ -36,9 +36,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/utf8.hpp"
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/crc.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include <cstdio>

View File

@ -56,7 +56,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/resolver_interface.hpp"
#include "libtorrent/ip_filter.hpp"
using namespace libtorrent;
using namespace std::placeholders;
namespace libtorrent

View File

@ -34,7 +34,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include <libtorrent/io.hpp>
#include <libtorrent/random.hpp>
#include <libtorrent/invariant_check.hpp>
#include <libtorrent/kademlia/node_id.hpp> // for generate_random_id
#include <libtorrent/kademlia/rpc_manager.hpp>
#include <libtorrent/kademlia/routing_table.hpp>
#include <libtorrent/kademlia/find_data.hpp>

View File

@ -30,10 +30,7 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/time.hpp" // for total_seconds
#include <libtorrent/kademlia/traversal_algorithm.hpp>
#include <libtorrent/kademlia/routing_table.hpp>
#include <libtorrent/kademlia/rpc_manager.hpp>
#include <libtorrent/kademlia/node.hpp>
#include <libtorrent/kademlia/dht_observer.hpp> // for dht_logger

View File

@ -684,4 +684,3 @@ void natpmp::close_impl()
}
} // namespace libtorrent

View File

@ -216,4 +216,3 @@ namespace libtorrent {
}
}

View File

@ -414,6 +414,5 @@ namespace libtorrent
file::iovec_t b = {header.get(), std::size_t(m_header_size)};
m_file.writev(0, b, ec);
if (ec) return;
}
}

View File

@ -57,7 +57,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/bandwidth_manager.hpp"
#include "libtorrent/request_blocks.hpp" // for request_a_block
#include "libtorrent/performance_counters.hpp" // for counters
#include "libtorrent/alert_manager.hpp" // for alert_manageralert_manager
#include "libtorrent/alert_manager.hpp" // for alert_manager
#include "libtorrent/ip_filter.hpp"
#include "libtorrent/ip_voter.hpp"
#include "libtorrent/kademlia/node_id.hpp"

View File

@ -119,4 +119,3 @@ namespace libtorrent
return int(m_errors.size()) - 1;
}
}

View File

@ -7799,7 +7799,7 @@ namespace libtorrent
#if TORRENT_USE_INVARIANT_CHECKS
void torrent::check_invariant() const
{
TORRENT_ASSERT(current_stats_state() == m_current_gauge_state + counters::num_checking_torrents
TORRENT_ASSERT(current_stats_state() == int(m_current_gauge_state + counters::num_checking_torrents)
|| m_current_gauge_state == no_gauge_state);
for (std::vector<time_critical_piece>::const_iterator i = m_time_critical_pieces.begin()
@ -9429,7 +9429,6 @@ namespace libtorrent
int peer_index(libtorrent::tcp::endpoint addr
, std::vector<libtorrent::peer_info> const& peers)
{
using namespace libtorrent;
std::vector<peer_info>::const_iterator i = std::find_if(peers.begin()
, peers.end(), std::bind(&peer_info::ip, _1) == addr);
if (i == peers.end()) return -1;
@ -9441,8 +9440,6 @@ namespace libtorrent
, std::vector<libtorrent::peer_info> const& peers
, std::vector<time_critical_piece> const& time_critical)
{
using namespace libtorrent;
time_point const now = clock_type::now();
float deadline = 0.f;

View File

@ -30,35 +30,20 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include <utility>
#include <vector>
#include <cctype>
#include <functional>
#include "libtorrent/tracker_manager.hpp"
#include "libtorrent/http_tracker_connection.hpp"
#include "libtorrent/udp_tracker_connection.hpp"
#include "libtorrent/aux_/session_impl.hpp"
#include "libtorrent/aux_/io.hpp"
#include "libtorrent/span.hpp"
#include "libtorrent/aux_/session_interface.hpp"
#include "libtorrent/performance_counters.hpp"
#include "libtorrent/socket_io.hpp"
using namespace std::placeholders;
namespace
{
enum
{
minimum_tracker_response_length = 3,
http_buffer_size = 2048
};
}
namespace libtorrent
{
using namespace libtorrent::aux;
timeout_handler::timeout_handler(io_service& ios)
: m_start_time(clock_type::now())
, m_read_time(m_start_time)
@ -173,8 +158,8 @@ namespace libtorrent
, char const* msg, int interval, int min_interval)
{
// we need to post the error to avoid deadlock
get_io_service().post(std::bind(&tracker_connection::fail_impl
, shared_from_this(), ec, code, std::string(msg), interval, min_interval));
get_io_service().post(std::bind(&tracker_connection::fail_impl
, shared_from_this(), ec, code, std::string(msg), interval, min_interval));
}
void tracker_connection::fail_impl(error_code const& ec, int code
@ -240,7 +225,6 @@ namespace libtorrent
if (i != m_http_conns.end())
{
m_http_conns.erase(i);
return;
}
}
@ -441,14 +425,10 @@ namespace libtorrent
}
for (auto const& c : close_http_connections)
{
c->close();
}
for (auto const& c : close_udp_connections)
{
c->close();
}
}
bool tracker_manager::empty() const

View File

@ -30,18 +30,10 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include <vector>
#include <cctype>
#include <mutex>
#include <functional>
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <tuple>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include "libtorrent/tracker_manager.hpp"
#include "libtorrent/parse_url.hpp"
#include "libtorrent/udp_tracker_connection.hpp"
#include "libtorrent/io.hpp"
@ -54,6 +46,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/aux_/time.hpp"
#include "libtorrent/aux_/io.hpp"
#include "libtorrent/span.hpp"
#include "libtorrent/peer.hpp"
#ifndef TORRENT_DISABLE_LOGGING
#include "libtorrent/socket_io.hpp"
@ -661,11 +654,9 @@ namespace libtorrent
bool udp_tracker_connection::on_scrape_response(span<char const> buf)
{
using namespace libtorrent::aux;
restart_read_timeout();
auto const action = static_cast<action_t>(aux::read_int32(buf));
std::uint32_t const transaction = read_uint32(buf);
std::uint32_t const transaction = aux::read_uint32(buf);
if (transaction != m_transaction_id)
{

View File

@ -341,8 +341,6 @@ void upnp::on_reply(udp::endpoint const& from, char* buffer
TORRENT_ASSERT(is_single_thread());
std::shared_ptr<upnp> me(self());
using namespace libtorrent::detail;
// parse out the url for the device
/*

View File

@ -272,9 +272,9 @@ namespace libtorrent { namespace
int len = bencode(p, e);
int total_size = 2 + len + metadata_piece_size;
namespace io = detail;
io::write_uint32(std::uint32_t(total_size), header);
io::write_uint32(total_size, header);
io::write_uint8(bt_peer_connection::msg_extended, header);
io::write_uint8(std::uint8_t(m_message_index), header);
io::write_uint8(m_message_index, header);
m_pc.send_buffer(msg, len + 6);
// TODO: we really need to increment the refcounter on the torrent

View File

@ -33,33 +33,30 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/config.hpp"
#include <functional>
#include <vector>
#include <cstdlib>
#include <cstdio> // for snprintf
#include <cinttypes> // for PRId64 et.al.
#include "libtorrent/web_peer_connection.hpp"
#include "libtorrent/session.hpp"
#include "libtorrent/identify_client.hpp"
#include "libtorrent/entry.hpp"
#include "libtorrent/bencode.hpp"
#include "libtorrent/alert_types.hpp"
#include "libtorrent/invariant_check.hpp"
#include "libtorrent/io.hpp"
#include "libtorrent/version.hpp"
#include "libtorrent/parse_url.hpp"
#include "libtorrent/peer_info.hpp"
#include "libtorrent/aux_/session_interface.hpp"
#include "libtorrent/alert_manager.hpp" // for alert_manageralert_manager
#include "libtorrent/alert_manager.hpp" // for alert_manager
#include "libtorrent/aux_/escape_string.hpp" // for escape_path
#include "libtorrent/hex.hpp" // for is_hex
#include "libtorrent/torrent.hpp"
#include "libtorrent/http_parser.hpp"
namespace libtorrent
{
constexpr int request_size_overhead = 5000;
struct disk_interface;
web_peer_connection::web_peer_connection(peer_connection_args const& pack
, web_seed_t& web)
: web_connection_base(pack, web)

View File

@ -196,4 +196,3 @@ namespace libtorrent
}
}

View File

@ -256,4 +256,3 @@ alias arm-tests :
;
explicit arm-tests ;