From 6b55096ebd0ebf9d0587e1b645a281a1fe7331e5 Mon Sep 17 00:00:00 2001 From: arvidn Date: Sun, 17 Sep 2017 23:50:33 +0200 Subject: [PATCH] switch some using declarations to new-style typedefs. remove some redundant parenthesis --- include/libtorrent/bitfield.hpp | 4 ++-- include/libtorrent/error_code.hpp | 6 +++--- include/libtorrent/file.hpp | 2 -- include/libtorrent/io_service.hpp | 4 ++-- include/libtorrent/socket.hpp | 12 ++++++------ include/libtorrent/time.hpp | 10 +++++----- simulation/test_dht_storage.cpp | 2 +- 7 files changed, 19 insertions(+), 21 deletions(-) diff --git a/include/libtorrent/bitfield.hpp b/include/libtorrent/bitfield.hpp index f6028ec7e..7f36e42c9 100644 --- a/include/libtorrent/bitfield.hpp +++ b/include/libtorrent/bitfield.hpp @@ -83,7 +83,7 @@ namespace libtorrent { { TORRENT_ASSERT(index >= 0); TORRENT_ASSERT(index < size()); - return (buf()[index / 32] & aux::host_to_network((0x80000000 >> (index & 31)))) != 0; + return (buf()[index / 32] & aux::host_to_network(0x80000000 >> (index & 31))) != 0; } // set bit at ``index`` to 0 (clear_bit) or 1 (set_bit). @@ -97,7 +97,7 @@ namespace libtorrent { { TORRENT_ASSERT(index >= 0); TORRENT_ASSERT(index < size()); - buf()[index / 32] |= aux::host_to_network((0x80000000 >> (index & 31))); + buf()[index / 32] |= aux::host_to_network(0x80000000 >> (index & 31)); } // returns true if all bits in the bitfield are set diff --git a/include/libtorrent/error_code.hpp b/include/libtorrent/error_code.hpp index 9948c34e9..6bbf749d7 100644 --- a/include/libtorrent/error_code.hpp +++ b/include/libtorrent/error_code.hpp @@ -479,14 +479,14 @@ namespace libtorrent { // returns the error_category for HTTP errors TORRENT_EXPORT boost::system::error_category& http_category(); - using boost::system::error_code; - using boost::system::error_condition; + using error_code = boost::system::error_code; + using error_condition = boost::system::error_condition; // internal using boost::system::generic_category; using boost::system::system_category; - using boost::system::system_error; + using system_error = boost::system::system_error; #ifndef BOOST_NO_EXCEPTIONS #ifndef TORRENT_NO_DEPRECATE diff --git a/include/libtorrent/file.hpp b/include/libtorrent/file.hpp index 89297841d..31093e53d 100644 --- a/include/libtorrent/file.hpp +++ b/include/libtorrent/file.hpp @@ -180,8 +180,6 @@ namespace libtorrent { constexpr open_mode_t attribute_mask = attribute_hidden | attribute_executable; } - using namespace flags; - struct TORRENT_EXTRA_EXPORT file : boost::noncopyable { file(); diff --git a/include/libtorrent/io_service.hpp b/include/libtorrent/io_service.hpp index d56113005..b19853515 100644 --- a/include/libtorrent/io_service.hpp +++ b/include/libtorrent/io_service.hpp @@ -44,9 +44,9 @@ POSSIBILITY OF SUCH DAMAGE. namespace libtorrent { #if defined TORRENT_BUILD_SIMULATOR - using sim::asio::io_service; + using io_service = sim::asio::io_service; #else - using boost::asio::io_service; + using io_service = boost::asio::io_service; #endif } diff --git a/include/libtorrent/socket.hpp b/include/libtorrent/socket.hpp index 00ecb203d..a311acb3b 100644 --- a/include/libtorrent/socket.hpp +++ b/include/libtorrent/socket.hpp @@ -68,17 +68,17 @@ POSSIBILITY OF SUCH DAMAGE. namespace libtorrent { #if defined TORRENT_BUILD_SIMULATOR - using sim::asio::ip::udp; - using sim::asio::ip::tcp; + using udp = sim::asio::ip::udp; + using tcp = sim::asio::ip::tcp; using sim::asio::async_write; using sim::asio::async_read; - using sim::asio::null_buffers; + using null_buffers = sim::asio::null_buffers; #else - using boost::asio::ip::tcp; - using boost::asio::ip::udp; + using tcp = boost::asio::ip::tcp; + using udp = boost::asio::ip::udp; using boost::asio::async_write; using boost::asio::async_read; - using boost::asio::null_buffers; + using null_buffers = boost::asio::null_buffers; #endif #ifdef TORRENT_WINDOWS diff --git a/include/libtorrent/time.hpp b/include/libtorrent/time.hpp index 7a8b7218b..effb98123 100644 --- a/include/libtorrent/time.hpp +++ b/include/libtorrent/time.hpp @@ -58,11 +58,11 @@ namespace libtorrent { using minutes32 = std::chrono::duration>; using time_point32 = std::chrono::time_point; - using std::chrono::seconds; - using std::chrono::milliseconds; - using std::chrono::microseconds; - using std::chrono::minutes; - using std::chrono::hours; + using seconds = std::chrono::seconds; + using milliseconds = std::chrono::milliseconds; + using microseconds = std::chrono::microseconds; + using minutes = std::chrono::minutes; + using hours = std::chrono::hours; using std::chrono::duration_cast; using std::chrono::time_point_cast; diff --git a/simulation/test_dht_storage.cpp b/simulation/test_dht_storage.cpp index 6f720377a..874bb6007 100644 --- a/simulation/test_dht_storage.cpp +++ b/simulation/test_dht_storage.cpp @@ -51,7 +51,7 @@ POSSIBILITY OF SUCH DAMAGE. using namespace lt; using namespace lt::dht; using namespace sim; -using namespace sim::chrono; +using sim::chrono::high_resolution_clock; using namespace sim::asio; using sim::simulation; using sim::default_config;