added std:: prefix, end of file cleanup, formatting, consts

This commit is contained in:
Alden Torres 2017-01-13 08:44:08 -05:00 committed by Arvid Norberg
parent 9199756a27
commit 1874a917b0
19 changed files with 38 additions and 52 deletions

View File

@ -45,4 +45,3 @@ namespace libtorrent
}
#endif

View File

@ -47,4 +47,3 @@ namespace libtorrent { namespace aux {
}}
#endif

View File

@ -499,7 +499,7 @@ namespace libtorrent
#ifndef TORRENT_NO_DEPRECATE
TORRENT_DEPRECATED void pop_alerts();
TORRENT_DEPRECATED alert const* pop_alert();
TORRENT_DEPRECATED size_t set_alert_queue_size_limit(size_t queue_size_limit_);
TORRENT_DEPRECATED std::size_t set_alert_queue_size_limit(std::size_t queue_size_limit_);
TORRENT_DEPRECATED int upload_rate_limit_depr() const;
TORRENT_DEPRECATED int download_rate_limit_depr() const;
TORRENT_DEPRECATED int local_upload_rate_limit() const;

View File

@ -40,20 +40,17 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/time.hpp"
#include "libtorrent/disk_buffer_holder.hpp"
#include "libtorrent/error_code.hpp"
#include "libtorrent/socket.hpp" // for tcp::endpoint
#include "libtorrent/aux_/vector.hpp"
#include <functional>
#include <memory>
#include "libtorrent/socket.hpp" // for tcp::endpoint
#include "libtorrent/aux_/disable_warnings_push.hpp"
#ifdef TORRENT_USE_OPENSSL
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/asio/ssl/context.hpp>
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#endif
namespace libtorrent
{

View File

@ -106,7 +106,7 @@ namespace libtorrent { namespace aux
}
}
void get_hash(char *digest, size_t digest_size)
void get_hash(char *digest, std::size_t digest_size)
{
DWORD size = DWORD(digest_size);
if (CryptGetHashParam(m_hash, HP_HASHVAL
@ -162,4 +162,3 @@ namespace libtorrent { namespace aux
} // namespace libtorrent
#endif

View File

@ -82,4 +82,3 @@ namespace libtorrent { namespace aux
} // namespace libtorrent
#endif

View File

@ -156,7 +156,7 @@ namespace libtorrent
// start points to the first decimal digit
// length is the number of digits
void construct_int(char const* start, int length)
void construct_int(char const* start, int const length)
{
TORRENT_ASSERT(m_type == none_t);
m_type = int_t;
@ -412,4 +412,3 @@ namespace libtorrent
#endif // TORRENT_NO_DEPRECATE
#endif

View File

@ -76,4 +76,3 @@ namespace libtorrent
}
#endif

View File

@ -139,4 +139,3 @@ namespace libtorrent
}
#endif // TORRENT_PACKET_BUFFER_HPP_INCLUDED

View File

@ -10,13 +10,13 @@ namespace libtorrent
struct sha512_ctx
{
std::uint64_t length, state[8];
size_t curlen;
std::size_t curlen;
std::uint8_t buf[128];
};
TORRENT_EXTRA_EXPORT int SHA512_init(sha512_ctx* context);
TORRENT_EXTRA_EXPORT int SHA512_update(sha512_ctx* context
, std::uint8_t const* data, size_t len);
, std::uint8_t const* data, std::size_t len);
TORRENT_EXTRA_EXPORT int SHA512_final(std::uint8_t* digest, sha512_ctx* context);
}

View File

@ -52,11 +52,11 @@ namespace libtorrent
span(T& p) : m_ptr(&p), m_len(1) {} // NOLINT
span(T* p, size_t const l) : m_ptr(p), m_len(l) {} // NOLINT
template <typename U, size_t N>
template <typename U, std::size_t N>
span(std::array<U, N>& arr) // NOLINT
: m_ptr(arr.data()), m_len(arr.size()) {}
template <typename U, size_t N>
template <typename U, std::size_t N>
span(U (&arr)[N]) // NOLINT
: m_ptr(&arr[0]), m_len(N) {}
@ -65,7 +65,7 @@ namespace libtorrent
span(Cont& c) // NOLINT
: m_ptr(c.data()), m_len(c.size()) {}
size_t size() const { return m_len; }
std::size_t size() const { return m_len; }
bool empty() const { return m_len == 0; }
T* data() const { return m_ptr; }
@ -80,32 +80,32 @@ namespace libtorrent
T& front() const { TORRENT_ASSERT(m_len > 0); return m_ptr[0]; }
T& back() const { TORRENT_ASSERT(m_len > 0); return m_ptr[m_len - 1]; }
span<T> first(size_t const n) const
span<T> first(std::size_t const n) const
{
TORRENT_ASSERT(size() >= n);
return { data(), n };
}
span<T> last(size_t const n) const
span<T> last(std::size_t const n) const
{
TORRENT_ASSERT(size() >= n);
return { data() + size() - n, n };
}
span<T> subspan(size_t const offset) const
span<T> subspan(std::size_t const offset) const
{
TORRENT_ASSERT(size() >= offset);
return { data() + offset, size() - offset };
}
span<T> subspan(size_t const offset, size_t const count) const
span<T> subspan(std::size_t const offset, std::size_t const count) const
{
TORRENT_ASSERT(size() >= offset);
TORRENT_ASSERT(size() >= offset + count);
return { data() + offset, count };
}
T& operator[](size_t const idx)
T& operator[](std::size_t const idx)
{
TORRENT_ASSERT(idx < m_len);
return m_ptr[idx];
@ -113,7 +113,7 @@ namespace libtorrent
private:
T* m_ptr;
size_t m_len;
std::size_t m_len;
};
}

View File

@ -100,4 +100,3 @@ namespace libtorrent
}
#endif // TORRENT_STAT_CACHE_HPP

View File

@ -152,4 +152,3 @@ namespace std {
}
#endif

View File

@ -104,7 +104,7 @@ namespace libtorrent
void defer_ack(utp_socket_impl* s);
void subscribe_drained(utp_socket_impl* s);
void restrict_mtu(int mtu)
void restrict_mtu(int const mtu)
{
m_restrict_mtu[std::size_t(m_mtu_idx)] = mtu;
m_mtu_idx = (m_mtu_idx + 1) % int(m_restrict_mtu.size());

View File

@ -253,9 +253,9 @@ public:
bool is_open() const { return m_open; }
int read_buffer_size() const;
static void on_read(void* self, size_t bytes_transferred
static void on_read(void* self, std::size_t bytes_transferred
, error_code const& ec, bool kill);
static void on_write(void* self, size_t bytes_transferred
static void on_write(void* self, std::size_t bytes_transferred
, error_code const& ec, bool kill);
static void on_connect(void* self, error_code const& ec, bool kill);
static void on_close_reason(void* self, std::uint16_t reason);

View File

@ -125,7 +125,7 @@ namespace libtorrent
, (bytes + page_size() - 1) & (page_size() - 1), B_NO_LOCK, B_READ_AREA | B_WRITE_AREA);
if (id < B_OK) return nullptr;
#else
ret = valloc(size_t(bytes));
ret = valloc(std::size_t(bytes));
#endif
if (ret == nullptr) return nullptr;
@ -208,4 +208,3 @@ namespace libtorrent
#endif
}

View File

@ -84,7 +84,7 @@ 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
char* chained_buffer::append(char const* buf, int s)
char* chained_buffer::append(char const* buf, int const s)
{
TORRENT_ASSERT(is_single_thread());
TORRENT_ASSERT(!m_destructed);
@ -97,7 +97,7 @@ namespace libtorrent
// tries to allocate memory from the end
// of the last buffer. If there isn't
// enough room, returns 0
char* chained_buffer::allocate_appendix(int s)
char* chained_buffer::allocate_appendix(int const s)
{
TORRENT_ASSERT(is_single_thread());
TORRENT_ASSERT(!m_destructed);
@ -112,7 +112,7 @@ namespace libtorrent
return insert;
}
std::vector<boost::asio::const_buffer> const& chained_buffer::build_iovec(int to_send)
std::vector<boost::asio::const_buffer> const& chained_buffer::build_iovec(int const to_send)
{
TORRENT_ASSERT(is_single_thread());
TORRENT_ASSERT(!m_destructed);

View File

@ -103,4 +103,3 @@ namespace libtorrent
} // aux namespace
}

View File

@ -184,10 +184,10 @@ int SHA512_init(sha512_ctx* md) {
@param inlen The length of the data (octets)
@return 0 if successful
*/
int SHA512_update(sha512_ctx* md, std::uint8_t const* in, size_t inlen)
int SHA512_update(sha512_ctx* md, std::uint8_t const* in, std::size_t inlen)
{
size_t n;
size_t i;
std::size_t n;
std::size_t i;
int err;
if (md == NULL) return 1;
if (in == NULL) return 1;