diff --git a/include/libtorrent/aux_/array.hpp b/include/libtorrent/aux_/array.hpp index 11163646f..d0d4c9e04 100644 --- a/include/libtorrent/aux_/array.hpp +++ b/include/libtorrent/aux_/array.hpp @@ -46,7 +46,7 @@ namespace libtorrent { namespace aux { using base = std::array; using underlying_index = typename underlying_index_t::type; - static_assert(Size <= std::size_t(std::numeric_limits::max()) + static_assert(Size <= std::size_t((std::numeric_limits::max)()) , "size is to big for index type"); array() = default; diff --git a/include/libtorrent/aux_/deque.hpp b/include/libtorrent/aux_/deque.hpp index 1251df0dd..2f71d5987 100644 --- a/include/libtorrent/aux_/deque.hpp +++ b/include/libtorrent/aux_/deque.hpp @@ -76,7 +76,7 @@ namespace libtorrent { namespace aux { IndexType end_index() const { - TORRENT_ASSERT(this->size() <= std::size_t(std::numeric_limits::max())); + TORRENT_ASSERT(this->size() <= std::size_t((std::numeric_limits::max)())); return IndexType(static_cast(this->size())); } diff --git a/include/libtorrent/aux_/session_impl.hpp b/include/libtorrent/aux_/session_impl.hpp index 548234f5a..6bdb7f012 100644 --- a/include/libtorrent/aux_/session_impl.hpp +++ b/include/libtorrent/aux_/session_impl.hpp @@ -457,7 +457,7 @@ namespace aux { peer_class_pool& peer_classes() override { return m_classes; } bool ignore_unchoke_slots_set(peer_class_set const& set) const override; int copy_pertinent_channels(peer_class_set const& set - , int channel, bandwidth_channel** dst, int max) override; + , int channel, bandwidth_channel** dst, int m) override; int use_quota_overhead(peer_class_set& set, int amount_down, int amount_up) override; bool use_quota_overhead(bandwidth_channel* ch, int amount); diff --git a/include/libtorrent/aux_/session_interface.hpp b/include/libtorrent/aux_/session_interface.hpp index 157a9e127..32fbf9cbe 100644 --- a/include/libtorrent/aux_/session_interface.hpp +++ b/include/libtorrent/aux_/session_interface.hpp @@ -249,7 +249,7 @@ namespace libtorrent { namespace aux { virtual peer_class_pool& peer_classes() = 0; virtual bool ignore_unchoke_slots_set(peer_class_set const& set) const = 0; virtual int copy_pertinent_channels(peer_class_set const& set - , int channel, bandwidth_channel** dst, int max) = 0; + , int channel, bandwidth_channel** dst, int m) = 0; virtual int use_quota_overhead(peer_class_set& set, int amount_down, int amount_up) = 0; virtual bandwidth_manager* get_bandwidth_manager(int channel) = 0; diff --git a/include/libtorrent/aux_/typed_span.hpp b/include/libtorrent/aux_/typed_span.hpp index bb96eb710..5fe6e6498 100644 --- a/include/libtorrent/aux_/typed_span.hpp +++ b/include/libtorrent/aux_/typed_span.hpp @@ -91,7 +91,7 @@ namespace libtorrent { namespace aux { IndexType end_index() const { - TORRENT_ASSERT(this->size() <= std::size_t(std::numeric_limits::max())); + TORRENT_ASSERT(this->size() <= std::size_t((std::numeric_limits::max)())); return IndexType(static_cast(this->size())); } diff --git a/include/libtorrent/aux_/vector.hpp b/include/libtorrent/aux_/vector.hpp index 1c8a7641b..3cda4fba9 100644 --- a/include/libtorrent/aux_/vector.hpp +++ b/include/libtorrent/aux_/vector.hpp @@ -85,7 +85,7 @@ namespace libtorrent { namespace aux { IndexType end_index() const { - TORRENT_ASSERT(this->size() <= std::size_t(std::numeric_limits::max())); + TORRENT_ASSERT(this->size() <= std::size_t((std::numeric_limits::max)())); return IndexType(static_cast(this->size())); } diff --git a/include/libtorrent/bandwidth_limit.hpp b/include/libtorrent/bandwidth_limit.hpp index 18b686d34..8d187a220 100644 --- a/include/libtorrent/bandwidth_limit.hpp +++ b/include/libtorrent/bandwidth_limit.hpp @@ -43,7 +43,7 @@ namespace libtorrent { // member of peer_connection struct TORRENT_EXTRA_EXPORT bandwidth_channel { - static constexpr int inf = std::numeric_limits::max(); + static constexpr int inf = (std::numeric_limits::max)(); bandwidth_channel(); diff --git a/include/libtorrent/chained_buffer.hpp b/include/libtorrent/chained_buffer.hpp index 128cf5a89..b2835082a 100644 --- a/include/libtorrent/chained_buffer.hpp +++ b/include/libtorrent/chained_buffer.hpp @@ -199,7 +199,7 @@ namespace libtorrent { new (&b.holder) Holder(std::move(buf)); m_bytes += used_size; - TORRENT_ASSERT(m_capacity < std::numeric_limits::max() - b.size); + TORRENT_ASSERT(m_capacity < (std::numeric_limits::max)() - b.size); m_capacity += b.size; TORRENT_ASSERT(m_bytes <= m_capacity); } diff --git a/include/libtorrent/extensions.hpp b/include/libtorrent/extensions.hpp index 1e84eafcf..0cecc4c35 100644 --- a/include/libtorrent/extensions.hpp +++ b/include/libtorrent/extensions.hpp @@ -267,7 +267,7 @@ namespace libtorrent { // If multiple plugins implement this function the lowest return value // (i.e. the highest priority) is used. virtual uint64_t get_unchoke_priority(peer_connection_handle const& /* peer */) - { return std::numeric_limits::max(); } + { return (std::numeric_limits::max)(); } // called when saving settings state virtual void save_state(entry&) {} diff --git a/include/libtorrent/packet_pool.hpp b/include/libtorrent/packet_pool.hpp index 648802152..aab9c6f87 100644 --- a/include/libtorrent/packet_pool.hpp +++ b/include/libtorrent/packet_pool.hpp @@ -164,7 +164,7 @@ namespace libtorrent { { TORRENT_ASSERT(is_single_thread()); TORRENT_ASSERT(allocate >= 0); - TORRENT_ASSERT(allocate <= std::numeric_limits::max()); + TORRENT_ASSERT(allocate <= (std::numeric_limits::max)()); return alloc(allocate); } diff --git a/include/libtorrent/piece_picker.hpp b/include/libtorrent/piece_picker.hpp index f599f186d..ba5375ec9 100644 --- a/include/libtorrent/piece_picker.hpp +++ b/include/libtorrent/piece_picker.hpp @@ -138,13 +138,13 @@ namespace libtorrent { bool operator<(downloading_piece const& rhs) const { return index < rhs.index; } // the index of the piece - piece_index_t index{std::numeric_limits::max()}; + piece_index_t index{(std::numeric_limits::max)()}; // info about each block in this piece. this is an index into the // m_block_info array, when multiplied by m_blocks_per_piece. // The m_blocks_per_piece following entries contain information about // all blocks in this piece. - std::uint16_t info_idx{std::numeric_limits::max()}; + std::uint16_t info_idx{(std::numeric_limits::max)()}; // the number of blocks in the finished state std::uint16_t finished:15; @@ -462,7 +462,7 @@ namespace libtorrent { , index(index_) { TORRENT_ASSERT(peer_count_ >= 0); - TORRENT_ASSERT(peer_count_ < std::numeric_limits::max()); + TORRENT_ASSERT(peer_count_ < (std::numeric_limits::max)()); TORRENT_ASSERT(index_ >= 0); } diff --git a/include/libtorrent/random.hpp b/include/libtorrent/random.hpp index fe24b0b09..c9aa71770 100644 --- a/include/libtorrent/random.hpp +++ b/include/libtorrent/random.hpp @@ -57,5 +57,5 @@ namespace libtorrent { namespace aux { TORRENT_EXTRA_EXPORT void random_bytes(span buffer); } - TORRENT_EXTRA_EXPORT std::uint32_t random(std::uint32_t max); + TORRENT_EXTRA_EXPORT std::uint32_t random(std::uint32_t m); } diff --git a/include/libtorrent/receive_buffer.hpp b/include/libtorrent/receive_buffer.hpp index f34d23db5..ebfa77391 100644 --- a/include/libtorrent/receive_buffer.hpp +++ b/include/libtorrent/receive_buffer.hpp @@ -177,14 +177,15 @@ struct crypto_receive_buffer bool crypto_packet_finished() const { - return m_recv_pos == INT_MAX || m_connection_buffer.packet_finished(); + return m_recv_pos == (std::numeric_limits::max)() + || m_connection_buffer.packet_finished(); } int packet_size() const; int crypto_packet_size() const { - TORRENT_ASSERT(m_recv_pos != INT_MAX); + TORRENT_ASSERT(m_recv_pos != (std::numeric_limits::max)()); return m_connection_buffer.packet_size() - m_recv_pos; } @@ -194,7 +195,7 @@ struct crypto_receive_buffer void crypto_cut(int size, int packet_size) { - TORRENT_ASSERT(m_recv_pos != INT_MAX); + TORRENT_ASSERT(m_recv_pos != (std::numeric_limits::max)()); m_connection_buffer.cut(size, m_recv_pos + packet_size, m_recv_pos); } @@ -211,7 +212,7 @@ private: // explicitly disallow assignment, to silence msvc warning crypto_receive_buffer& operator=(crypto_receive_buffer const&); - int m_recv_pos = std::numeric_limits::max(); + int m_recv_pos = (std::numeric_limits::max)(); int m_packet_size = 0; receive_buffer& m_connection_buffer; }; diff --git a/include/libtorrent/sha1_hash.hpp b/include/libtorrent/sha1_hash.hpp index 01bd2267b..acc88b15c 100644 --- a/include/libtorrent/sha1_hash.hpp +++ b/include/libtorrent/sha1_hash.hpp @@ -82,7 +82,7 @@ namespace aux { // returns an all-F digest. i.e. the maximum value // representable by an N bit number (N/8 bytes). This is // a static member function. - static digest32 max() + static digest32 (max)() { digest32 ret; std::memset(ret.m_number, 0xff, size()); @@ -92,7 +92,7 @@ namespace aux { // returns an all-zero digest. i.e. the minimum value // representable by an N bit number (N/8 bytes). This is // a static member function. - static digest32 min() + static digest32 (min)() { digest32 ret; // all bits are already 0