diff --git a/include/libtorrent/alert_types.hpp b/include/libtorrent/alert_types.hpp index 0ea15ad52..794a5504d 100644 --- a/include/libtorrent/alert_types.hpp +++ b/include/libtorrent/alert_types.hpp @@ -388,9 +388,9 @@ namespace libtorrent struct TORRENT_EXPORT peer_ban_alert: peer_alert { - peer_ban_alert(torrent_handle h, tcp::endpoint const& ip - , peer_id const& pid) - : peer_alert(h, ip, pid) + peer_ban_alert(torrent_handle h, tcp::endpoint const& ep + , peer_id const& peer_id) + : peer_alert(h, ep, peer_id) {} TORRENT_DEFINE_ALERT(peer_ban_alert); @@ -400,9 +400,9 @@ namespace libtorrent struct TORRENT_EXPORT peer_unsnubbed_alert: peer_alert { - peer_unsnubbed_alert(torrent_handle h, tcp::endpoint const& ip - , peer_id const& pid) - : peer_alert(h, ip, pid) + peer_unsnubbed_alert(torrent_handle h, tcp::endpoint const& ep + , peer_id const& peer_id) + : peer_alert(h, ep, peer_id) {} TORRENT_DEFINE_ALERT(peer_unsnubbed_alert); @@ -412,9 +412,9 @@ namespace libtorrent struct TORRENT_EXPORT peer_snubbed_alert: peer_alert { - peer_snubbed_alert(torrent_handle h, tcp::endpoint const& ip - , peer_id const& pid) - : peer_alert(h, ip, pid) + peer_snubbed_alert(torrent_handle h, tcp::endpoint const& ep + , peer_id const& peer_id) + : peer_alert(h, ep, peer_id) {} TORRENT_DEFINE_ALERT(peer_snubbed_alert); @@ -424,9 +424,9 @@ namespace libtorrent struct TORRENT_EXPORT peer_error_alert: peer_alert { - peer_error_alert(torrent_handle const& h, tcp::endpoint const& ip - , peer_id const& pid, error_code const& e) - : peer_alert(h, ip, pid) + peer_error_alert(torrent_handle const& h, tcp::endpoint const& ep + , peer_id const& peer_id, error_code const& e) + : peer_alert(h, ep, peer_id) , error(e) { #ifndef TORRENT_NO_DEPRECATE @@ -451,9 +451,9 @@ namespace libtorrent struct TORRENT_EXPORT peer_connect_alert: peer_alert { - peer_connect_alert(torrent_handle h, tcp::endpoint const& ip - , peer_id const& pid) - : peer_alert(h, ip, pid) + peer_connect_alert(torrent_handle h, tcp::endpoint const& ep + , peer_id const& peer_id) + : peer_alert(h, ep, peer_id) {} TORRENT_DEFINE_ALERT(peer_connect_alert); @@ -465,9 +465,9 @@ namespace libtorrent struct TORRENT_EXPORT peer_disconnected_alert: peer_alert { - peer_disconnected_alert(torrent_handle const& h, tcp::endpoint const& ip - , peer_id const& pid, error_code const& e) - : peer_alert(h, ip, pid) + peer_disconnected_alert(torrent_handle const& h, tcp::endpoint const& ep + , peer_id const& peer_id, error_code const& e) + : peer_alert(h, ep, peer_id) , error(e) { #ifndef TORRENT_NO_DEPRECATE @@ -490,9 +490,9 @@ namespace libtorrent struct TORRENT_EXPORT invalid_request_alert: peer_alert { - invalid_request_alert(torrent_handle const& h, tcp::endpoint const& ip - , peer_id const& pid, peer_request const& r) - : peer_alert(h, ip, pid) + invalid_request_alert(torrent_handle const& h, tcp::endpoint const& ep + , peer_id const& peer_id, peer_request const& r) + : peer_alert(h, ep, peer_id) , request(r) {} @@ -536,9 +536,9 @@ namespace libtorrent struct TORRENT_EXPORT request_dropped_alert: peer_alert { - request_dropped_alert(const torrent_handle& h, tcp::endpoint const& ip - , peer_id const& pid, int block_num, int piece_num) - : peer_alert(h, ip, pid) + request_dropped_alert(const torrent_handle& h, tcp::endpoint const& ep + , peer_id const& peer_id, int block_num, int piece_num) + : peer_alert(h, ep, peer_id) , block_index(block_num) , piece_index(piece_num) { TORRENT_ASSERT(block_index >= 0 && piece_index >= 0);} @@ -555,9 +555,9 @@ namespace libtorrent struct TORRENT_EXPORT block_timeout_alert: peer_alert { - block_timeout_alert(const torrent_handle& h, tcp::endpoint const& ip - , peer_id const& pid, int block_num, int piece_num) - : peer_alert(h, ip, pid) + block_timeout_alert(const torrent_handle& h, tcp::endpoint const& ep + , peer_id const& peer_id, int block_num, int piece_num) + : peer_alert(h, ep, peer_id) , block_index(block_num) , piece_index(piece_num) { TORRENT_ASSERT(block_index >= 0 && piece_index >= 0);} @@ -574,9 +574,9 @@ namespace libtorrent struct TORRENT_EXPORT block_finished_alert: peer_alert { - block_finished_alert(const torrent_handle& h, tcp::endpoint const& ip - , peer_id const& pid, int block_num, int piece_num) - : peer_alert(h, ip, pid) + block_finished_alert(const torrent_handle& h, tcp::endpoint const& ep + , peer_id const& peer_id, int block_num, int piece_num) + : peer_alert(h, ep, peer_id) , block_index(block_num) , piece_index(piece_num) { TORRENT_ASSERT(block_index >= 0 && piece_index >= 0);} @@ -592,9 +592,9 @@ namespace libtorrent struct TORRENT_EXPORT block_downloading_alert: peer_alert { - block_downloading_alert(const torrent_handle& h, tcp::endpoint const& ip - , peer_id const& pid, char const* speedmsg, int block_num, int piece_num) - : peer_alert(h, ip, pid) + block_downloading_alert(const torrent_handle& h, tcp::endpoint const& ep + , peer_id const& peer_id, char const* speedmsg, int block_num, int piece_num) + : peer_alert(h, ep, peer_id) , peer_speedmsg(speedmsg) , block_index(block_num) , piece_index(piece_num) @@ -612,9 +612,9 @@ namespace libtorrent struct TORRENT_EXPORT unwanted_block_alert: peer_alert { - unwanted_block_alert(const torrent_handle& h, tcp::endpoint const& ip - , peer_id const& pid, int block_num, int piece_num) - : peer_alert(h, ip, pid) + unwanted_block_alert(const torrent_handle& h, tcp::endpoint const& ep + , peer_id const& peer_id, int block_num, int piece_num) + : peer_alert(h, ep, peer_id) , block_index(block_num) , piece_index(piece_num) { TORRENT_ASSERT(block_index >= 0 && piece_index >= 0);} diff --git a/include/libtorrent/bitfield.hpp b/include/libtorrent/bitfield.hpp index 3434738e7..a98d3507e 100644 --- a/include/libtorrent/bitfield.hpp +++ b/include/libtorrent/bitfield.hpp @@ -46,22 +46,22 @@ namespace libtorrent { resize(bits); } bitfield(int bits, bool val): m_bytes(0), m_size(0) { resize(bits, val); } - bitfield(char const* bytes, int bits): m_bytes(0), m_size(0) - { assign(bytes, bits); } + bitfield(char const* b, int bits): m_bytes(0), m_size(0) + { assign(b, bits); } bitfield(bitfield const& rhs): m_bytes(0), m_size(0), m_own(false) { assign(rhs.bytes(), rhs.size()); } - void borrow_bytes(char* bytes, int bits) + void borrow_bytes(char* b, int bits) { dealloc(); - m_bytes = (unsigned char*)bytes; + m_bytes = (unsigned char*)b; m_size = bits; m_own = false; } ~bitfield() { dealloc(); } - void assign(char const* bytes, int bits) - { resize(bits); std::memcpy(m_bytes, bytes, (bits + 7) / 8); clear_trailing_bits(); } + void assign(char const* b, int bits) + { resize(bits); std::memcpy(m_bytes, b, (bits + 7) / 8); clear_trailing_bits(); } bool operator[](int index) const { return get_bit(index); } @@ -221,25 +221,25 @@ namespace libtorrent void resize(int bits) { - const int bytes = (bits + 7) / 8; + const int b = (bits + 7) / 8; if (m_bytes) { if (m_own) { - m_bytes = (unsigned char*)std::realloc(m_bytes, bytes); + m_bytes = (unsigned char*)std::realloc(m_bytes, b); m_own = true; } else if (bits > m_size) { - unsigned char* tmp = (unsigned char*)std::malloc(bytes); - std::memcpy(tmp, m_bytes, (std::min)(int(m_size + 7)/ 8, bytes)); + unsigned char* tmp = (unsigned char*)std::malloc(b); + std::memcpy(tmp, m_bytes, (std::min)(int(m_size + 7)/ 8, b)); m_bytes = tmp; m_own = true; } } else { - m_bytes = (unsigned char*)std::malloc(bytes); + m_bytes = (unsigned char*)std::malloc(b); m_own = true; } m_size = bits; diff --git a/include/libtorrent/buffer.hpp b/include/libtorrent/buffer.hpp index 26d2a3ab9..33d8b6ba5 100644 --- a/include/libtorrent/buffer.hpp +++ b/include/libtorrent/buffer.hpp @@ -49,9 +49,9 @@ public: , end(0) {} - interval(char* begin, char* end) - : begin(begin) - , end(end) + interval(char* b, char* e) + : begin(b) + , end(e) {} char operator[](int index) const @@ -73,9 +73,9 @@ public: , end(i.end) {} - const_interval(char const* begin, char const* end) - : begin(begin) - , end(end) + const_interval(char const* b, char const* e) + : begin(b) + , end(e) {} char operator[](int index) const @@ -151,18 +151,18 @@ public: std::memcpy(m_begin + p, first, last - first); } - void erase(char* begin, char* end) + void erase(char* b, char* e) { - TORRENT_ASSERT(end <= m_end); - TORRENT_ASSERT(begin >= m_begin); - TORRENT_ASSERT(begin <= end); - if (end == m_end) + TORRENT_ASSERT(e <= m_end); + TORRENT_ASSERT(b >= m_begin); + TORRENT_ASSERT(b <= e); + if (e == m_end) { - resize(begin - m_begin); + resize(b - m_begin); return; } - std::memmove(begin, end, m_end - end); - m_end = begin + (m_end - end); + std::memmove(b, e, m_end - e); + m_end = b + (m_end - e); } void clear() { m_end = m_begin; } diff --git a/include/libtorrent/chained_buffer.hpp b/include/libtorrent/chained_buffer.hpp index 02ff4db22..aa46b2d36 100644 --- a/include/libtorrent/chained_buffer.hpp +++ b/include/libtorrent/chained_buffer.hpp @@ -95,19 +95,19 @@ namespace libtorrent } template - void append_buffer(char* buffer, int size, int used_size, D const& destructor) + void append_buffer(char* buffer, int s, int used_size, D const& destructor) { - TORRENT_ASSERT(size >= used_size); + TORRENT_ASSERT(s >= used_size); buffer_t b; b.buf = buffer; - b.size = size; + b.size = s; b.start = buffer; b.used_size = used_size; b.free = destructor; m_vec.push_back(b); m_bytes += used_size; - m_capacity += size; + m_capacity += s; TORRENT_ASSERT(m_bytes <= m_capacity); } @@ -123,25 +123,25 @@ namespace libtorrent // tries to copy the given buffer to the end of the // last chained buffer. If there's not enough room // it returns false - bool append(char const* buf, int size) + bool append(char const* buf, int s) { - char* insert = allocate_appendix(size); + char* insert = allocate_appendix(s); if (insert == 0) return false; - std::memcpy(insert, buf, size); + std::memcpy(insert, buf, s); return true; } // tries to allocate memory from the end // of the last buffer. If there isn't // enough room, returns 0 - char* allocate_appendix(int size) + char* allocate_appendix(int s) { if (m_vec.empty()) return 0; buffer_t& b = m_vec.back(); char* insert = b.start + b.used_size; - if (insert + size > b.buf + b.size) return 0; - b.used_size += size; - m_bytes += size; + if (insert + s > b.buf + b.size) return 0; + b.used_size += s; + m_bytes += s; TORRENT_ASSERT(m_bytes <= m_capacity); return insert; } diff --git a/include/libtorrent/ip_filter.hpp b/include/libtorrent/ip_filter.hpp index 8d8089d47..8812de7cd 100644 --- a/include/libtorrent/ip_filter.hpp +++ b/include/libtorrent/ip_filter.hpp @@ -241,7 +241,7 @@ namespace detail struct range { - range(Addr addr, int access = 0): start(addr), access(access) {} + range(Addr addr, int a = 0): start(addr), access(a) {} bool operator<(range const& r) const { return start < r.start; } bool operator<(Addr const& a) const diff --git a/include/libtorrent/peer_connection.hpp b/include/libtorrent/peer_connection.hpp index 6657e3409..95c15539d 100644 --- a/include/libtorrent/peer_connection.hpp +++ b/include/libtorrent/peer_connection.hpp @@ -279,7 +279,7 @@ namespace libtorrent void keep_alive(); peer_id const& pid() const { return m_peer_id; } - void set_pid(const peer_id& pid) { m_peer_id = pid; } + void set_pid(const peer_id& peer_id) { m_peer_id = peer_id; } bool has_piece(int i) const; std::vector const& download_queue() const; @@ -1063,10 +1063,10 @@ namespace libtorrent struct allocating_handler { allocating_handler( - Handler const& handler, handler_storage& storage + Handler const& h, handler_storage& s ) - : handler(handler) - , storage(storage) + : handler(h) + , storage(s) {} template diff --git a/include/libtorrent/piece_picker.hpp b/include/libtorrent/piece_picker.hpp index 38d2d62c6..c2ea3322e 100644 --- a/include/libtorrent/piece_picker.hpp +++ b/include/libtorrent/piece_picker.hpp @@ -425,15 +425,15 @@ namespace libtorrent // prio 4,5,6 halves the availability of a piece int availability = peer_count; - int priority = piece_priority; + int p = piece_priority; if (piece_priority >= priority_levels / 2) { availability /= 2; - priority -= (priority_levels - 2) / 2; + p -= (priority_levels - 2) / 2; } if (downloading) return availability * prio_factor; - return availability * prio_factor + (priority_levels / 2) - priority; + return availability * prio_factor + (priority_levels / 2) - p; } bool operator!=(piece_pos p) const diff --git a/include/libtorrent/policy.hpp b/include/libtorrent/policy.hpp index 15a2a45aa..9aca316ed 100644 --- a/include/libtorrent/policy.hpp +++ b/include/libtorrent/policy.hpp @@ -464,10 +464,10 @@ namespace libtorrent }; inline policy::ipv4_peer::ipv4_peer( - tcp::endpoint const& ip, bool connectable, int src + tcp::endpoint const& ep, bool c, int src ) - : peer(ip.port(), connectable, src) - , addr(ip.address().to_v4()) + : peer(ep.port(), c, src) + , addr(ep.address().to_v4()) { #if TORRENT_USE_IPV6 is_v6_addr = false; @@ -512,10 +512,10 @@ namespace libtorrent #if TORRENT_USE_IPV6 inline policy::ipv6_peer::ipv6_peer( - tcp::endpoint const& ip, bool connectable, int src + tcp::endpoint const& ep, bool c, int src ) - : peer(ip.port(), connectable, src) - , addr(ip.address().to_v6().to_bytes()) + : peer(ep.port(), c, src) + , addr(ep.address().to_v6().to_bytes()) { is_v6_addr = true; #if TORRENT_USE_I2P diff --git a/include/libtorrent/stat.hpp b/include/libtorrent/stat.hpp index dcbbcf7fa..9bf05d36c 100644 --- a/include/libtorrent/stat.hpp +++ b/include/libtorrent/stat.hpp @@ -112,11 +112,11 @@ namespace libtorrent size_type rate_sum() const { return m_rate_sum; } size_type total() const { return m_total_counter; } - void offset(size_type counter) + void offset(size_type c) { - TORRENT_ASSERT(counter >= 0); + TORRENT_ASSERT(c >= 0); TORRENT_ASSERT(m_total_counter >= 0); - m_total_counter += counter; + m_total_counter += c; TORRENT_ASSERT(m_total_counter >= 0); } diff --git a/include/libtorrent/storage.hpp b/include/libtorrent/storage.hpp index b1b5ad243..6054a8e40 100644 --- a/include/libtorrent/storage.hpp +++ b/include/libtorrent/storage.hpp @@ -275,8 +275,8 @@ namespace libtorrent std::string save_path() const; - bool verify_resume_data(lazy_entry const& rd, error_code& error) - { return m_storage->verify_resume_data(rd, error); } + bool verify_resume_data(lazy_entry const& rd, error_code& e) + { return m_storage->verify_resume_data(rd, e); } bool is_allocating() const { return m_state == state_expand_pieces; } diff --git a/include/libtorrent/torrent.hpp b/include/libtorrent/torrent.hpp index 3097139d2..025fbd3b7 100644 --- a/include/libtorrent/torrent.hpp +++ b/include/libtorrent/torrent.hpp @@ -307,8 +307,8 @@ namespace libtorrent void connect_to_url_seed(std::list::iterator url); bool connect_to_peer(policy::peer* peerinfo); - void set_ratio(float ratio) - { TORRENT_ASSERT(ratio >= 0.0f); m_ratio = ratio; } + void set_ratio(float r) + { TORRENT_ASSERT(r >= 0.0f); m_ratio = r; } float ratio() const { return m_ratio; } diff --git a/include/libtorrent/variant_stream.hpp b/include/libtorrent/variant_stream.hpp index 2001c8e12..74104784a 100644 --- a/include/libtorrent/variant_stream.hpp +++ b/include/libtorrent/variant_stream.hpp @@ -56,8 +56,8 @@ namespace aux template struct io_control_visitor_ec: boost::static_visitor<> { - io_control_visitor_ec(IO_Control_Command& ioc, error_code& ec_) - : ioc(ioc), ec(ec_) {} + io_control_visitor_ec(IO_Control_Command& io, error_code& e) + : ioc(io), ec(e) {} template void operator()(T* p) const @@ -76,8 +76,8 @@ namespace aux struct io_control_visitor : boost::static_visitor<> { - io_control_visitor(IO_Control_Command& ioc) - : ioc(ioc) {} + io_control_visitor(IO_Control_Command& io) + : ioc(io) {} template void operator()(T* p) const @@ -96,9 +96,9 @@ namespace aux struct async_connect_visitor : boost::static_visitor<> { - async_connect_visitor(EndpointType const& endpoint, Handler const& handler) - : endpoint(endpoint) - , handler(handler) + async_connect_visitor(EndpointType const& ep, Handler const& h) + : endpoint(ep) + , handler(h) {} template @@ -357,9 +357,9 @@ namespace aux struct async_read_some_visitor : boost::static_visitor<> { - async_read_some_visitor(Mutable_Buffers const& buffers, Handler const& handler) - : buffers(buffers) - , handler(handler) + async_read_some_visitor(Mutable_Buffers const& bufs, Handler const& h) + : buffers(bufs) + , handler(h) {} template @@ -381,8 +381,8 @@ namespace aux struct read_some_visitor : boost::static_visitor { - read_some_visitor(Mutable_Buffers const& buffers) - : buffers(buffers) + read_some_visitor(Mutable_Buffers const& bufs) + : buffers(bufs) {} template @@ -400,9 +400,9 @@ namespace aux struct read_some_visitor_ec : boost::static_visitor { - read_some_visitor_ec(Mutable_Buffers const& buffers, error_code& ec_) - : buffers(buffers) - , ec(ec_) + read_some_visitor_ec(Mutable_Buffers const& bufs, error_code& e) + : buffers(bufs) + , ec(e) {} template @@ -422,9 +422,9 @@ namespace aux struct async_write_some_visitor : boost::static_visitor<> { - async_write_some_visitor(Const_Buffers const& buffers, Handler const& handler) - : buffers(buffers) - , handler(handler) + async_write_some_visitor(Const_Buffers const& bufs, Handler const& h) + : buffers(bufs) + , handler(h) {} template