making strong_typedef::UnderlyingType constexpr and warnigs cleanup
This commit is contained in:
parent
2bc7a60f33
commit
533699bbb5
3
Jamfile
3
Jamfile
|
@ -276,6 +276,9 @@ rule warnings ( properties * )
|
|||
result += <cflags>/wd4275 ;
|
||||
# disable warning C4373: virtual function overrides, previous versions of the compiler did not override when parameters only differed by const/volatile qualifiers
|
||||
result += <cflags>/wd4373 ;
|
||||
# C4268: 'identifier' : 'const' static/global data initialized
|
||||
# with compiler generated default constructor fills the object with zeros
|
||||
result += <cflags>/wd4268 ;
|
||||
}
|
||||
|
||||
return $(result) ;
|
||||
|
|
|
@ -67,10 +67,8 @@ namespace libtorrent
|
|||
// to new peers based on socket type.
|
||||
void add(socket_type_t st, peer_class_t const peer_class)
|
||||
{
|
||||
TORRENT_ASSERT(peer_class >= peer_class_t{0});
|
||||
TORRENT_ASSERT(peer_class < peer_class_t{32});
|
||||
if (peer_class < peer_class_t{0}
|
||||
|| peer_class > peer_class_t{31}) return;
|
||||
if (peer_class > peer_class_t{31}) return;
|
||||
|
||||
TORRENT_ASSERT(st < num_socket_types && st >= 0);
|
||||
if (st < 0 || st >= num_socket_types) return;
|
||||
|
@ -78,10 +76,8 @@ namespace libtorrent
|
|||
}
|
||||
void remove(socket_type_t st, peer_class_t const peer_class)
|
||||
{
|
||||
TORRENT_ASSERT(peer_class >= peer_class_t{0});
|
||||
TORRENT_ASSERT(peer_class < peer_class_t{32});
|
||||
if (peer_class < peer_class_t{0}
|
||||
|| peer_class > peer_class_t{31}) return;
|
||||
if (peer_class > peer_class_t{31}) return;
|
||||
|
||||
TORRENT_ASSERT(st < num_socket_types && st >= 0);
|
||||
if (st < 0 || st >= num_socket_types) return;
|
||||
|
@ -95,10 +91,8 @@ namespace libtorrent
|
|||
// peer classes in the ``peer_class_type_filter`` are 32 bits.
|
||||
void disallow(socket_type_t st, peer_class_t const peer_class)
|
||||
{
|
||||
TORRENT_ASSERT(peer_class >= peer_class_t{0});
|
||||
TORRENT_ASSERT(peer_class < peer_class_t{32});
|
||||
if (peer_class < peer_class_t{0}
|
||||
|| peer_class > peer_class_t{31}) return;
|
||||
if (peer_class > peer_class_t{31}) return;
|
||||
|
||||
TORRENT_ASSERT(st < num_socket_types && st >= 0);
|
||||
if (st < 0 || st >= num_socket_types) return;
|
||||
|
@ -106,10 +100,8 @@ namespace libtorrent
|
|||
}
|
||||
void allow(socket_type_t st, peer_class_t const peer_class)
|
||||
{
|
||||
TORRENT_ASSERT(peer_class >= peer_class_t{0});
|
||||
TORRENT_ASSERT(peer_class < peer_class_t{32});
|
||||
if (peer_class < peer_class_t{0}
|
||||
|| peer_class > peer_class_t{31}) return;
|
||||
if (peer_class > peer_class_t{31}) return;
|
||||
|
||||
TORRENT_ASSERT(st < num_socket_types && st >= 0);
|
||||
if (st < 0 || st >= num_socket_types) return;
|
||||
|
@ -142,4 +134,3 @@ namespace libtorrent
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -34,19 +34,13 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#define TORRENT_PIECE_BLOCK_PROGRESS_HPP_INCLUDED
|
||||
|
||||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/units.hpp"
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
struct piece_block_progress
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push, 1)
|
||||
#pragma warning(disable : 4268)
|
||||
#endif
|
||||
constexpr static piece_index_t invalid_index{-1};
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
// the piece and block index
|
||||
// determines exactly which
|
||||
|
|
|
@ -572,20 +572,11 @@ namespace libtorrent
|
|||
std::set<const torrent_peer*> have_peers;
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push, 1)
|
||||
#pragma warning(disable : 4268)
|
||||
#endif
|
||||
|
||||
// index is set to this to indicate that we have the
|
||||
// piece. There is no entry for the piece in the
|
||||
// buckets if this is the case.
|
||||
constexpr static prio_index_t we_have_index{-1};
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
enum : std::uint32_t
|
||||
{
|
||||
// the priority value that means the piece is filtered
|
||||
|
|
|
@ -577,20 +577,11 @@ namespace libtorrent
|
|||
// peer potentially across you changing your IP.
|
||||
void set_key(int key);
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push, 1)
|
||||
#pragma warning(disable : 4268)
|
||||
#endif
|
||||
|
||||
// built-in peer classes
|
||||
static constexpr peer_class_t global_peer_class_id{0};
|
||||
static constexpr peer_class_t tcp_peer_class_id{1};
|
||||
static constexpr peer_class_t local_peer_class_id{2};
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
// ``is_listening()`` will tell you whether or not the session has
|
||||
// successfully opened a listening port. If it hasn't, this function will
|
||||
// return false, and then you can set a new
|
||||
|
|
|
@ -128,11 +128,6 @@ namespace libtorrent
|
|||
|
||||
file_index_t error_file = torrent_status::error_file_none;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push, 1)
|
||||
#pragma warning(disable : 4268)
|
||||
#endif
|
||||
|
||||
// special values for error_file to describe which file or component
|
||||
// encountered the error (``errc``).
|
||||
// the error did not occur on a file
|
||||
|
@ -152,10 +147,6 @@ namespace libtorrent
|
|||
// or a torrent log alert may provide more information.
|
||||
static constexpr file_index_t error_file_exception{-5};
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
// the path to the directory where this torrent's files are stored.
|
||||
// It's typically the path as was given to async_add_torrent() or
|
||||
// add_torrent() when this torrent was started. This field is only
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace aux {
|
|||
strong_typedef() = default;
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
constexpr strong_typedef(UnderlyingType val) : m_val(val) {}
|
||||
operator UnderlyingType() const { return m_val; }
|
||||
constexpr operator UnderlyingType() const { return m_val; }
|
||||
#else
|
||||
constexpr explicit strong_typedef(UnderlyingType val) : m_val(val) {}
|
||||
constexpr explicit operator UnderlyingType() const { return m_val; }
|
||||
|
|
Loading…
Reference in New Issue