forked from premiere/premiere-libtorrent
added std:: prefix, end of file cleanup, formatting, consts
This commit is contained in:
parent
9199756a27
commit
1874a917b0
|
@ -45,4 +45,3 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -47,4 +47,3 @@ namespace libtorrent { namespace aux {
|
||||||
}}
|
}}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -499,7 +499,7 @@ namespace libtorrent
|
||||||
#ifndef TORRENT_NO_DEPRECATE
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
TORRENT_DEPRECATED void pop_alerts();
|
TORRENT_DEPRECATED void pop_alerts();
|
||||||
TORRENT_DEPRECATED alert const* pop_alert();
|
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 upload_rate_limit_depr() const;
|
||||||
TORRENT_DEPRECATED int download_rate_limit_depr() const;
|
TORRENT_DEPRECATED int download_rate_limit_depr() const;
|
||||||
TORRENT_DEPRECATED int local_upload_rate_limit() const;
|
TORRENT_DEPRECATED int local_upload_rate_limit() const;
|
||||||
|
|
|
@ -40,20 +40,17 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "libtorrent/time.hpp"
|
#include "libtorrent/time.hpp"
|
||||||
#include "libtorrent/disk_buffer_holder.hpp"
|
#include "libtorrent/disk_buffer_holder.hpp"
|
||||||
#include "libtorrent/error_code.hpp"
|
#include "libtorrent/error_code.hpp"
|
||||||
|
#include "libtorrent/socket.hpp" // for tcp::endpoint
|
||||||
#include "libtorrent/aux_/vector.hpp"
|
#include "libtorrent/aux_/vector.hpp"
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "libtorrent/socket.hpp" // for tcp::endpoint
|
|
||||||
|
|
||||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
|
||||||
|
|
||||||
#ifdef TORRENT_USE_OPENSSL
|
#ifdef TORRENT_USE_OPENSSL
|
||||||
|
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||||
#include <boost/asio/ssl/context.hpp>
|
#include <boost/asio/ssl/context.hpp>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,14 +7,14 @@ Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions
|
modification, are permitted provided that the following conditions
|
||||||
are met:
|
are met:
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright
|
* Redistributions of source code must retain the above copyright
|
||||||
notice, this list of conditions and the following disclaimer.
|
notice, this list of conditions and the following disclaimer.
|
||||||
* Redistributions in binary form must reproduce the above copyright
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in
|
notice, this list of conditions and the following disclaimer in
|
||||||
the documentation and/or other materials provided with the distribution.
|
the documentation and/or other materials provided with the distribution.
|
||||||
* Neither the name of the author nor the names of its
|
* Neither the name of the author nor the names of its
|
||||||
contributors may be used to endorse or promote products derived
|
contributors may be used to endorse or promote products derived
|
||||||
from this software without specific prior written permission.
|
from this software without specific prior written permission.
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
@ -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);
|
DWORD size = DWORD(digest_size);
|
||||||
if (CryptGetHashParam(m_hash, HP_HASHVAL
|
if (CryptGetHashParam(m_hash, HP_HASHVAL
|
||||||
|
@ -162,4 +162,3 @@ namespace libtorrent { namespace aux
|
||||||
} // namespace libtorrent
|
} // namespace libtorrent
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -82,4 +82,3 @@ namespace libtorrent { namespace aux
|
||||||
} // namespace libtorrent
|
} // namespace libtorrent
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,7 @@ namespace libtorrent
|
||||||
|
|
||||||
// start points to the first decimal digit
|
// start points to the first decimal digit
|
||||||
// length is the number of digits
|
// 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);
|
TORRENT_ASSERT(m_type == none_t);
|
||||||
m_type = int_t;
|
m_type = int_t;
|
||||||
|
@ -412,4 +412,3 @@ namespace libtorrent
|
||||||
#endif // TORRENT_NO_DEPRECATE
|
#endif // TORRENT_NO_DEPRECATE
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -76,4 +76,3 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -139,4 +139,3 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TORRENT_PACKET_BUFFER_HPP_INCLUDED
|
#endif // TORRENT_PACKET_BUFFER_HPP_INCLUDED
|
||||||
|
|
||||||
|
|
|
@ -10,13 +10,13 @@ namespace libtorrent
|
||||||
struct sha512_ctx
|
struct sha512_ctx
|
||||||
{
|
{
|
||||||
std::uint64_t length, state[8];
|
std::uint64_t length, state[8];
|
||||||
size_t curlen;
|
std::size_t curlen;
|
||||||
std::uint8_t buf[128];
|
std::uint8_t buf[128];
|
||||||
};
|
};
|
||||||
|
|
||||||
TORRENT_EXTRA_EXPORT int SHA512_init(sha512_ctx* context);
|
TORRENT_EXTRA_EXPORT int SHA512_init(sha512_ctx* context);
|
||||||
TORRENT_EXTRA_EXPORT int SHA512_update(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);
|
TORRENT_EXTRA_EXPORT int SHA512_final(std::uint8_t* digest, sha512_ctx* context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,11 +52,11 @@ namespace libtorrent
|
||||||
span(T& p) : m_ptr(&p), m_len(1) {} // NOLINT
|
span(T& p) : m_ptr(&p), m_len(1) {} // NOLINT
|
||||||
span(T* p, size_t const l) : m_ptr(p), m_len(l) {} // 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
|
span(std::array<U, N>& arr) // NOLINT
|
||||||
: m_ptr(arr.data()), m_len(arr.size()) {}
|
: 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
|
span(U (&arr)[N]) // NOLINT
|
||||||
: m_ptr(&arr[0]), m_len(N) {}
|
: m_ptr(&arr[0]), m_len(N) {}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ namespace libtorrent
|
||||||
span(Cont& c) // NOLINT
|
span(Cont& c) // NOLINT
|
||||||
: m_ptr(c.data()), m_len(c.size()) {}
|
: 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; }
|
bool empty() const { return m_len == 0; }
|
||||||
T* data() const { return m_ptr; }
|
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& 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]; }
|
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);
|
TORRENT_ASSERT(size() >= n);
|
||||||
return { data(), 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);
|
TORRENT_ASSERT(size() >= n);
|
||||||
return { data() + size() - n, 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);
|
TORRENT_ASSERT(size() >= offset);
|
||||||
return { data() + offset, 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);
|
||||||
TORRENT_ASSERT(size() >= offset + count);
|
TORRENT_ASSERT(size() >= offset + count);
|
||||||
return { data() + offset, count };
|
return { data() + offset, count };
|
||||||
}
|
}
|
||||||
|
|
||||||
T& operator[](size_t const idx)
|
T& operator[](std::size_t const idx)
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(idx < m_len);
|
TORRENT_ASSERT(idx < m_len);
|
||||||
return m_ptr[idx];
|
return m_ptr[idx];
|
||||||
|
@ -113,7 +113,7 @@ namespace libtorrent
|
||||||
|
|
||||||
private:
|
private:
|
||||||
T* m_ptr;
|
T* m_ptr;
|
||||||
size_t m_len;
|
std::size_t m_len;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,4 +100,3 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TORRENT_STAT_CACHE_HPP
|
#endif // TORRENT_STAT_CACHE_HPP
|
||||||
|
|
||||||
|
|
|
@ -152,4 +152,3 @@ namespace std {
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@ namespace libtorrent
|
||||||
void defer_ack(utp_socket_impl* s);
|
void defer_ack(utp_socket_impl* s);
|
||||||
void subscribe_drained(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_restrict_mtu[std::size_t(m_mtu_idx)] = mtu;
|
||||||
m_mtu_idx = (m_mtu_idx + 1) % int(m_restrict_mtu.size());
|
m_mtu_idx = (m_mtu_idx + 1) % int(m_restrict_mtu.size());
|
||||||
|
|
|
@ -253,9 +253,9 @@ public:
|
||||||
bool is_open() const { return m_open; }
|
bool is_open() const { return m_open; }
|
||||||
|
|
||||||
int read_buffer_size() const;
|
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);
|
, 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);
|
, error_code const& ec, bool kill);
|
||||||
static void on_connect(void* self, 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);
|
static void on_close_reason(void* self, std::uint16_t reason);
|
||||||
|
|
|
@ -107,7 +107,7 @@ namespace libtorrent
|
||||||
TORRENT_ASSERT(int(bytes) >= page_size());
|
TORRENT_ASSERT(int(bytes) >= page_size());
|
||||||
#ifdef TORRENT_DEBUG_BUFFERS
|
#ifdef TORRENT_DEBUG_BUFFERS
|
||||||
const int page = page_size();
|
const int page = page_size();
|
||||||
const int num_pages = (bytes + (page-1)) / page + 2;
|
const int num_pages = (bytes + (page - 1)) / page + 2;
|
||||||
const int orig_bytes = bytes;
|
const int orig_bytes = bytes;
|
||||||
bytes = num_pages * page;
|
bytes = num_pages * page;
|
||||||
#endif
|
#endif
|
||||||
|
@ -122,10 +122,10 @@ namespace libtorrent
|
||||||
ret = _aligned_malloc(bytes, page_size());
|
ret = _aligned_malloc(bytes, page_size());
|
||||||
#elif defined TORRENT_BEOS
|
#elif defined TORRENT_BEOS
|
||||||
area_id id = create_area("", &ret, B_ANY_ADDRESS
|
area_id id = create_area("", &ret, B_ANY_ADDRESS
|
||||||
, (bytes + page_size() - 1) & (page_size()-1), B_NO_LOCK, B_READ_AREA | B_WRITE_AREA);
|
, (bytes + page_size() - 1) & (page_size() - 1), B_NO_LOCK, B_READ_AREA | B_WRITE_AREA);
|
||||||
if (id < B_OK) return nullptr;
|
if (id < B_OK) return nullptr;
|
||||||
#else
|
#else
|
||||||
ret = valloc(size_t(bytes));
|
ret = valloc(std::size_t(bytes));
|
||||||
#endif
|
#endif
|
||||||
if (ret == nullptr) return nullptr;
|
if (ret == nullptr) return nullptr;
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ namespace libtorrent
|
||||||
#define PROT_READ PAGE_READONLY
|
#define PROT_READ PAGE_READONLY
|
||||||
#endif
|
#endif
|
||||||
mprotect(ret, std::size_t(page), PROT_READ);
|
mprotect(ret, std::size_t(page), PROT_READ);
|
||||||
mprotect(static_cast<char*>(ret) + (num_pages-1) * page, std::size_t(page), PROT_READ);
|
mprotect(static_cast<char*>(ret) + (num_pages - 1) * page, std::size_t(page), PROT_READ);
|
||||||
|
|
||||||
#ifdef TORRENT_WINDOWS
|
#ifdef TORRENT_WINDOWS
|
||||||
#undef mprotect
|
#undef mprotect
|
||||||
|
@ -208,4 +208,3 @@ namespace libtorrent
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ namespace libtorrent
|
||||||
// tries to copy the given buffer to the end of the
|
// tries to copy the given buffer to the end of the
|
||||||
// last chained buffer. If there's not enough room
|
// last chained buffer. If there's not enough room
|
||||||
// it returns false
|
// 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(is_single_thread());
|
||||||
TORRENT_ASSERT(!m_destructed);
|
TORRENT_ASSERT(!m_destructed);
|
||||||
|
@ -97,7 +97,7 @@ namespace libtorrent
|
||||||
// tries to allocate memory from the end
|
// tries to allocate memory from the end
|
||||||
// of the last buffer. If there isn't
|
// of the last buffer. If there isn't
|
||||||
// enough room, returns 0
|
// 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(is_single_thread());
|
||||||
TORRENT_ASSERT(!m_destructed);
|
TORRENT_ASSERT(!m_destructed);
|
||||||
|
@ -112,7 +112,7 @@ namespace libtorrent
|
||||||
return insert;
|
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(is_single_thread());
|
||||||
TORRENT_ASSERT(!m_destructed);
|
TORRENT_ASSERT(!m_destructed);
|
||||||
|
|
|
@ -103,4 +103,3 @@ namespace libtorrent
|
||||||
} // aux namespace
|
} // aux namespace
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -184,10 +184,10 @@ int SHA512_init(sha512_ctx* md) {
|
||||||
@param inlen The length of the data (octets)
|
@param inlen The length of the data (octets)
|
||||||
@return 0 if successful
|
@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;
|
std::size_t n;
|
||||||
size_t i;
|
std::size_t i;
|
||||||
int err;
|
int err;
|
||||||
if (md == NULL) return 1;
|
if (md == NULL) return 1;
|
||||||
if (in == NULL) return 1;
|
if (in == NULL) return 1;
|
||||||
|
|
Loading…
Reference in New Issue