use standard array container (#676)
This commit is contained in:
parent
64cb8b236a
commit
ff0675e64e
|
@ -473,12 +473,12 @@ namespace
|
|||
void dht_get_mutable_item(lt::session& ses, std::string key, std::string salt)
|
||||
{
|
||||
TORRENT_ASSERT(key.size() == 32);
|
||||
boost::array<char, 32> public_key;
|
||||
std::array<char, 32> public_key;
|
||||
std::copy(key.begin(), key.end(), public_key.begin());
|
||||
ses.dht_get_item(public_key, salt);
|
||||
}
|
||||
|
||||
void put_string(entry& e, boost::array<char, 64>& sig, boost::uint64_t& seq,
|
||||
void put_string(entry& e, std::array<char, 64>& sig, boost::uint64_t& seq,
|
||||
std::string const& salt, std::string public_key, std::string private_key,
|
||||
std::string data)
|
||||
{
|
||||
|
@ -498,7 +498,7 @@ namespace
|
|||
{
|
||||
TORRENT_ASSERT(private_key.size() == 64);
|
||||
TORRENT_ASSERT(public_key.size() == 32);
|
||||
boost::array<char, 32> key;
|
||||
std::array<char, 32> key;
|
||||
std::copy(public_key.begin(), public_key.end(), key.begin());
|
||||
ses.dht_put_item(key, boost::bind(&put_string, _1, _2, _3, _4
|
||||
, public_key, private_key, data)
|
||||
|
|
|
@ -45,7 +45,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <thread>
|
||||
#include <boost/bind.hpp>
|
||||
#include <iostream>
|
||||
#include <boost/array.hpp>
|
||||
#include <array>
|
||||
#include <boost/detail/atomic_count.hpp>
|
||||
|
||||
#if BOOST_ASIO_DYN_LINK
|
||||
|
@ -696,7 +696,7 @@ struct peer_conn
|
|||
write_uint8(7, ptr);
|
||||
write_uint32(piece, ptr);
|
||||
write_uint32(start, ptr);
|
||||
boost::array<boost::asio::const_buffer, 2> vec;
|
||||
std::array<boost::asio::const_buffer, 2> vec;
|
||||
vec[0] = boost::asio::buffer(write_buf_proto, ptr - write_buf_proto);
|
||||
vec[1] = boost::asio::buffer(write_buffer, length);
|
||||
boost::asio::async_write(s, vec, boost::bind(&peer_conn::on_have_all_sent, this, _1, _2));
|
||||
|
|
|
@ -1939,8 +1939,8 @@ namespace libtorrent
|
|||
struct TORRENT_EXPORT dht_mutable_item_alert final : alert
|
||||
{
|
||||
dht_mutable_item_alert(aux::stack_allocator& alloc
|
||||
, boost::array<char, 32> k
|
||||
, boost::array<char, 64> sig
|
||||
, std::array<char, 32> k
|
||||
, std::array<char, 64> sig
|
||||
, boost::uint64_t sequence
|
||||
, std::string const& s
|
||||
, entry const& i
|
||||
|
@ -1952,14 +1952,14 @@ namespace libtorrent
|
|||
virtual std::string message() const override;
|
||||
|
||||
// the public key that was looked up
|
||||
boost::array<char, 32> key;
|
||||
std::array<char, 32> key;
|
||||
|
||||
// the signature of the data. This is not the signature of the
|
||||
// plain encoded form of the item, but it includes the sequence number
|
||||
// and possibly the hash as well. See the dht_store document for more
|
||||
// information. This is primarily useful for echoing back in a store
|
||||
// request.
|
||||
boost::array<char, 64> signature;
|
||||
std::array<char, 64> signature;
|
||||
|
||||
// the sequence number of this item
|
||||
boost::uint64_t seq;
|
||||
|
@ -1981,8 +1981,8 @@ namespace libtorrent
|
|||
{
|
||||
// internal
|
||||
dht_put_alert(aux::stack_allocator& alloc, sha1_hash const& t, int n);
|
||||
dht_put_alert(aux::stack_allocator& alloc, boost::array<char, 32> key
|
||||
, boost::array<char, 64> sig
|
||||
dht_put_alert(aux::stack_allocator& alloc, std::array<char, 32> key
|
||||
, std::array<char, 64> sig
|
||||
, std::string s
|
||||
, boost::uint64_t sequence_number
|
||||
, int n);
|
||||
|
@ -1998,8 +1998,8 @@ namespace libtorrent
|
|||
|
||||
// if a mutable item was stored, these are the public key, signature,
|
||||
// salt and sequence number the item was stored under.
|
||||
boost::array<char, 32> public_key;
|
||||
boost::array<char, 64> signature;
|
||||
std::array<char, 32> public_key;
|
||||
std::array<char, 64> signature;
|
||||
std::string salt;
|
||||
boost::uint64_t seq;
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace libtorrent { namespace aux {
|
|||
}
|
||||
|
||||
template <size_t N>
|
||||
array_view(boost::array<T, N>& arr)
|
||||
array_view(std::array<T, N>& arr)
|
||||
: m_ptr(arr.data()), m_len(arr.size()) {}
|
||||
|
||||
template <size_t N>
|
||||
|
|
|
@ -324,13 +324,13 @@ namespace libtorrent
|
|||
|
||||
void dht_get_immutable_item(sha1_hash const& target);
|
||||
|
||||
void dht_get_mutable_item(boost::array<char, 32> key
|
||||
void dht_get_mutable_item(std::array<char, 32> key
|
||||
, std::string salt = std::string());
|
||||
|
||||
void dht_put_immutable_item(entry const& data, sha1_hash target);
|
||||
|
||||
void dht_put_mutable_item(boost::array<char, 32> key
|
||||
, boost::function<void(entry&, boost::array<char,64>&
|
||||
void dht_put_mutable_item(std::array<char, 32> key
|
||||
, boost::function<void(entry&, std::array<char,64>&
|
||||
, boost::uint64_t&, std::string const&)> cb
|
||||
, std::string salt = std::string());
|
||||
|
||||
|
@ -1181,7 +1181,7 @@ namespace libtorrent
|
|||
struct extension_dht_query
|
||||
{
|
||||
boost::uint8_t query_len;
|
||||
boost::array<char, max_dht_query_length> query;
|
||||
std::array<char, max_dht_query_length> query;
|
||||
dht_extension_handler_t handler;
|
||||
};
|
||||
typedef std::vector<extension_dht_query> m_extension_dht_queries_t;
|
||||
|
|
|
@ -45,7 +45,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include <boost/smart_ptr.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <array>
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
// SunPRO seems to have an overly-strict
|
||||
// definition of POD types and doesn't
|
||||
// seem to allow boost::array in unions
|
||||
// seem to allow std::array in unions
|
||||
#define TORRENT_BROKEN_UNIONS 1
|
||||
|
||||
#define TORRENT_COMPLETE_TYPES_REQUIRED 1
|
||||
|
|
|
@ -40,7 +40,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include <string>
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <array>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <boost/smart_ptr.hpp>
|
||||
#include <boost/weak_ptr.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <array>
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ public:
|
|||
// store it in a shared_ptr
|
||||
boost::shared_ptr<handler_type> h(new handler_type(handler));
|
||||
|
||||
tcp::resolver::query q(m_hostname, to_string(m_port).elems);
|
||||
tcp::resolver::query q(m_hostname, to_string(m_port).data());
|
||||
m_resolver.async_resolve(q, boost::bind(
|
||||
&http_stream::name_lookup, this, _1, _2, h));
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ public:
|
|||
// store it in a shaed_ptr
|
||||
boost::shared_ptr<handler_type> h(new handler_type(handler));
|
||||
|
||||
tcp::resolver::query q(m_hostname, to_string(m_port).elems);
|
||||
tcp::resolver::query q(m_hostname, to_string(m_port).data());
|
||||
m_resolver.async_resolve(q, boost::bind(
|
||||
&i2p_stream::do_connect, this, _1, _2, h));
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <libtorrent/entry.hpp>
|
||||
#include <vector>
|
||||
#include <exception>
|
||||
#include <boost/array.hpp>
|
||||
#include <array>
|
||||
|
||||
namespace libtorrent { namespace dht
|
||||
{
|
||||
|
@ -116,9 +116,9 @@ public:
|
|||
bool is_mutable() const { return m_mutable; }
|
||||
|
||||
entry const& value() const { return m_value; }
|
||||
boost::array<char, item_pk_len> const& pk() const
|
||||
std::array<char, item_pk_len> const& pk() const
|
||||
{ return m_pk; }
|
||||
boost::array<char, item_sig_len> const& sig() const
|
||||
std::array<char, item_sig_len> const& sig() const
|
||||
{ return m_sig; }
|
||||
boost::uint64_t seq() const { return m_seq; }
|
||||
std::string const& salt() const { return m_salt; }
|
||||
|
@ -126,8 +126,8 @@ public:
|
|||
private:
|
||||
entry m_value;
|
||||
std::string m_salt;
|
||||
boost::array<char, item_pk_len> m_pk;
|
||||
boost::array<char, item_sig_len> m_sig;
|
||||
std::array<char, item_pk_len> m_pk;
|
||||
std::array<char, item_sig_len> m_sig;
|
||||
boost::uint64_t m_seq;
|
||||
bool m_mutable;
|
||||
};
|
||||
|
|
|
@ -41,7 +41,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <boost/cstdint.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <array>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/unordered_set.hpp>
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace libtorrent
|
|||
// used for read jobs
|
||||
char* recv_buf;
|
||||
int buf_size;
|
||||
boost::array<boost::asio::mutable_buffer, 2> read_vec;
|
||||
std::array<boost::asio::mutable_buffer, 2> read_vec;
|
||||
|
||||
boost::shared_ptr<peer_connection> peer;
|
||||
// defined in session_impl.cpp
|
||||
|
|
|
@ -34,7 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#define TORRENT_PEER_CLASS_SET_HPP_INCLUDED
|
||||
|
||||
#include "libtorrent/peer_class.hpp"
|
||||
#include <boost/array.hpp>
|
||||
#include <array>
|
||||
|
||||
namespace libtorrent {
|
||||
|
||||
|
@ -62,7 +62,7 @@ namespace libtorrent {
|
|||
// class IDs. Each ID refers to a an entry in m_ses.m_peer_classes which
|
||||
// holds the metadata about the class. Classes affect bandwidth limits
|
||||
// among other things
|
||||
boost::array<peer_class_t, 15> m_class;
|
||||
std::array<peer_class_t, 15> m_class;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <boost/smart_ptr.hpp>
|
||||
#include <boost/weak_ptr.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <array>
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/pool/pool.hpp>
|
||||
|
|
|
@ -77,7 +77,7 @@ struct TORRENT_EXTRA_EXPORT receive_buffer
|
|||
// regular buffer only
|
||||
boost::asio::mutable_buffer reserve(int size);
|
||||
// with possible disk buffer usage
|
||||
int reserve(boost::array<boost::asio::mutable_buffer, 2>& vec, int size);
|
||||
int reserve(std::array<boost::asio::mutable_buffer, 2>& vec, int size);
|
||||
|
||||
// tell the buffer we just receved more bytes at the end of it. This will
|
||||
// advance the end cursor
|
||||
|
|
|
@ -361,7 +361,7 @@ namespace libtorrent
|
|||
// as an empty string if no salt is to be used.
|
||||
// if the item is found in the DHT, a dht_mutable_item_alert is
|
||||
// posted.
|
||||
void dht_get_item(boost::array<char, 32> key
|
||||
void dht_get_item(std::array<char, 32> key
|
||||
, std::string salt = std::string());
|
||||
|
||||
// store the given bencoded data as an immutable item in the DHT.
|
||||
|
@ -382,7 +382,7 @@ namespace libtorrent
|
|||
// the current value stored under the key (may be empty). Also expected
|
||||
// to be set to the value to be stored by the function.
|
||||
//
|
||||
// boost::array<char,64>& signature
|
||||
// std::array<char,64>& signature
|
||||
// the signature authenticating the current value. This may be zeroes
|
||||
// if there is currently no value stored. The function is expected to
|
||||
// fill in this buffer with the signature of the new value to store.
|
||||
|
@ -409,8 +409,8 @@ namespace libtorrent
|
|||
// must first retrieve it, then modify it, then write it back. The way
|
||||
// the DHT works, it is natural to always do a lookup before storing and
|
||||
// calling the callback in between is convenient.
|
||||
void dht_put_item(boost::array<char, 32> key
|
||||
, boost::function<void(entry&, boost::array<char,64>&
|
||||
void dht_put_item(std::array<char, 32> key
|
||||
, boost::function<void(entry&, std::array<char,64>&
|
||||
, boost::uint64_t&, std::string const&)> cb
|
||||
, std::string salt = std::string());
|
||||
|
||||
|
|
|
@ -165,7 +165,7 @@ public:
|
|||
boost::shared_ptr<handler_type> h(new handler_type(handler));
|
||||
|
||||
ADD_OUTSTANDING_ASYNC("socks5_stream::name_lookup");
|
||||
tcp::resolver::query q(m_hostname, to_string(m_port).elems);
|
||||
tcp::resolver::query q(m_hostname, to_string(m_port).data());
|
||||
m_resolver.async_resolve(q, boost::bind(
|
||||
&socks5_stream::name_lookup, this, _1, _2, h));
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <string>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/array.hpp> // for boost::array
|
||||
#include <array> // for std::array
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
|
@ -50,7 +50,7 @@ namespace libtorrent
|
|||
TORRENT_EXTRA_EXPORT bool is_alpha(char c);
|
||||
|
||||
TORRENT_EXTRA_EXPORT
|
||||
boost::array<char, 4+std::numeric_limits<boost::int64_t>::digits10>
|
||||
std::array<char, 4+std::numeric_limits<boost::int64_t>::digits10>
|
||||
to_string(boost::int64_t n);
|
||||
|
||||
// internal
|
||||
|
|
|
@ -181,7 +181,7 @@ namespace libtorrent
|
|||
|
||||
io_service& m_ios;
|
||||
|
||||
boost::array<int, 3> m_restrict_mtu;
|
||||
std::array<int, 3> m_restrict_mtu;
|
||||
int m_mtu_idx;
|
||||
|
||||
// this is passed on to the instantiate connection
|
||||
|
|
|
@ -46,7 +46,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <boost/smart_ptr.hpp>
|
||||
#include <boost/weak_ptr.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <array>
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <boost/smart_ptr.hpp>
|
||||
#include <boost/weak_ptr.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <array>
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
|
|
|
@ -279,8 +279,8 @@ TORRENT_TEST(dht_dual_stack_mutable_item)
|
|||
dht_network dht(sim, 100);
|
||||
dht_network dht6(sim, 100, dht_network::bind_ipv6);
|
||||
|
||||
boost::array<char, ed25519_private_key_size> sk;
|
||||
boost::array<char, ed25519_public_key_size> pk;
|
||||
std::array<char, ed25519_private_key_size> sk;
|
||||
std::array<char, ed25519_public_key_size> pk;
|
||||
int put_count = 0;
|
||||
bool got_item = false;
|
||||
|
||||
|
@ -309,11 +309,11 @@ TORRENT_TEST(dht_dual_stack_mutable_item)
|
|||
}
|
||||
if (ticks == 2)
|
||||
{
|
||||
boost::array<unsigned char, ed25519_seed_size> seed;
|
||||
std::array<unsigned char, ed25519_seed_size> seed;
|
||||
ed25519_create_keypair((unsigned char*)pk.data()
|
||||
, (unsigned char*)sk.data(), seed.data());
|
||||
|
||||
ses.dht_put_item(pk, [&](lt::entry& item, boost::array<char, 64>& sig
|
||||
ses.dht_put_item(pk, [&](lt::entry& item, std::array<char, 64>& sig
|
||||
, boost::uint64_t& seq, std::string const& salt)
|
||||
{
|
||||
item = "mutable item";
|
||||
|
|
|
@ -1478,8 +1478,8 @@ namespace libtorrent {
|
|||
// TODO: 2 the salt here is allocated on the heap. It would be nice to
|
||||
// allocate in in the stack_allocator
|
||||
dht_mutable_item_alert::dht_mutable_item_alert(aux::stack_allocator&
|
||||
, boost::array<char, 32> k
|
||||
, boost::array<char, 64> sig
|
||||
, std::array<char, 32> k
|
||||
, std::array<char, 64> sig
|
||||
, boost::uint64_t sequence
|
||||
, std::string const& s
|
||||
, entry const& i
|
||||
|
@ -1506,8 +1506,8 @@ namespace libtorrent {
|
|||
{}
|
||||
|
||||
dht_put_alert::dht_put_alert(aux::stack_allocator&
|
||||
, boost::array<char, 32> key
|
||||
, boost::array<char, 64> sig
|
||||
, std::array<char, 32> key
|
||||
, std::array<char, 64> sig
|
||||
, std::string s
|
||||
, boost::uint64_t sequence_number
|
||||
, int n)
|
||||
|
|
|
@ -611,7 +611,7 @@ namespace libtorrent
|
|||
switch (m_type)
|
||||
{
|
||||
case int_t:
|
||||
out += libtorrent::to_string(integer()).elems;
|
||||
out += libtorrent::to_string(integer()).data();
|
||||
out += "\n";
|
||||
break;
|
||||
case string_t:
|
||||
|
|
|
@ -286,7 +286,7 @@ namespace libtorrent
|
|||
virtual std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT
|
||||
{
|
||||
std::string ret;
|
||||
ret += to_string(ev).elems;
|
||||
ret += to_string(ev).data();
|
||||
ret += " ";
|
||||
switch (ev)
|
||||
{
|
||||
|
|
|
@ -42,7 +42,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <cstring>
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <array>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
|
||||
#ifdef TORRENT_WINDOWS
|
||||
|
@ -237,7 +237,7 @@ namespace libtorrent
|
|||
snprintf(msg, sizeof(msg), "%s://%s%s%s%s%s%s", protocol.c_str(), auth.c_str()
|
||||
, auth.empty()?"":"@", host.c_str()
|
||||
, port == -1 ? "" : ":"
|
||||
, port == -1 ? "" : to_string(port).elems
|
||||
, port == -1 ? "" : to_string(port).data()
|
||||
, escape_path(path.c_str(), int(path.size())).c_str());
|
||||
return msg;
|
||||
}
|
||||
|
|
|
@ -182,17 +182,17 @@ namespace libtorrent
|
|||
request += "?info_hash=";
|
||||
request += escape_string(reinterpret_cast<char const*>(&t->torrent_file().info_hash()[0]), 20);
|
||||
request += "&piece=";
|
||||
request += to_string(r.piece).elems;
|
||||
request += to_string(r.piece).data();
|
||||
|
||||
// if we're requesting less than an entire piece we need to
|
||||
// add ranges
|
||||
if (r.start > 0 || r.length != t->torrent_file().piece_size(r.piece))
|
||||
{
|
||||
request += "&ranges=";
|
||||
request += to_string(r.start).elems;
|
||||
request += to_string(r.start).data();
|
||||
request += "-";
|
||||
// ranges are inclusive, just like HTTP
|
||||
request += to_string(r.start + r.length - 1).elems;
|
||||
request += to_string(r.start + r.length - 1).data();
|
||||
}
|
||||
|
||||
request += " HTTP/1.1\r\n";
|
||||
|
@ -286,7 +286,7 @@ namespace libtorrent
|
|||
// temporarily unavailable, retry later
|
||||
t->retry_web_seed(this, retry_time);
|
||||
|
||||
std::string error_msg = to_string(m_parser.status_code()).elems
|
||||
std::string error_msg = to_string(m_parser.status_code()).data()
|
||||
+ (" " + m_parser.message());
|
||||
if (t->alerts().should_post<url_seed_alert>())
|
||||
{
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace libtorrent
|
|||
std::string endpoint;
|
||||
if (!m_hostname.empty())
|
||||
{
|
||||
endpoint = m_hostname + ':' + to_string(m_remote_endpoint.port()).elems;
|
||||
endpoint = m_hostname + ':' + to_string(m_remote_endpoint.port()).data();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -152,7 +152,7 @@ namespace libtorrent
|
|||
if (stats && settings.get_bool(settings_pack::report_redundant_bytes))
|
||||
{
|
||||
url += "&redundant=";
|
||||
url += to_string(tracker_req().redundant).elems;
|
||||
url += to_string(tracker_req().redundant).data();
|
||||
}
|
||||
if (!tracker_req().trackerid.empty())
|
||||
{
|
||||
|
|
|
@ -175,9 +175,9 @@ void item::assign(entry const& v, std::pair<char const*, int> salt
|
|||
int bsize = bencode(buffer, v);
|
||||
TORRENT_ASSERT(bsize <= 1000);
|
||||
sign_mutable_item(std::make_pair(buffer, bsize)
|
||||
, salt, seq, pk, sk, m_sig.c_array());
|
||||
, salt, seq, pk, sk, m_sig.data());
|
||||
m_salt.assign(salt.first, salt.second);
|
||||
memcpy(m_pk.c_array(), pk, item_pk_len);
|
||||
memcpy(m_pk.data(), pk, item_pk_len);
|
||||
m_seq = seq;
|
||||
m_mutable = true;
|
||||
}
|
||||
|
@ -194,8 +194,8 @@ bool item::assign(bdecode_node const& v
|
|||
{
|
||||
if (!verify_mutable_item(v.data_section(), salt, seq, pk, sig))
|
||||
return false;
|
||||
memcpy(m_pk.c_array(), pk, item_pk_len);
|
||||
memcpy(m_sig.c_array(), sig, item_sig_len);
|
||||
memcpy(m_pk.data(), pk, item_pk_len);
|
||||
memcpy(m_sig.data(), sig, item_sig_len);
|
||||
if (salt.second > 0)
|
||||
m_salt.assign(salt.first, salt.second);
|
||||
else
|
||||
|
@ -224,8 +224,8 @@ void item::assign(entry const& v, std::string salt, boost::uint64_t seq
|
|||
, seq, pk, sig));
|
||||
#endif
|
||||
|
||||
memcpy(m_pk.c_array(), pk, item_pk_len);
|
||||
memcpy(m_sig.c_array(), sig, item_sig_len);
|
||||
memcpy(m_pk.data(), pk, item_pk_len);
|
||||
memcpy(m_sig.data(), sig, item_sig_len);
|
||||
m_salt = salt;
|
||||
m_seq = seq;
|
||||
m_mutable = true;
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace libtorrent
|
|||
|
||||
void peer_class_set::remove_class(peer_class_pool& pool, peer_class_t c)
|
||||
{
|
||||
boost::array<peer_class_t, 15>::iterator i = std::find(m_class.begin()
|
||||
std::array<peer_class_t, 15>::iterator i = std::find(m_class.begin()
|
||||
, m_class.begin() + m_size, c);
|
||||
int idx = i - m_class.begin();
|
||||
if (idx == m_size) return; // not found
|
||||
|
|
|
@ -5752,7 +5752,7 @@ namespace libtorrent
|
|||
|
||||
int max_receive = m_recv_buffer.max_receive();
|
||||
|
||||
boost::array<boost::asio::mutable_buffer, 2> vec;
|
||||
std::array<boost::asio::mutable_buffer, 2> vec;
|
||||
int num_bufs = 0;
|
||||
// only apply the contiguous receive buffer when we don't have any
|
||||
// outstanding requests. When we're likely to receive pieces, we'll
|
||||
|
|
|
@ -62,7 +62,7 @@ boost::asio::mutable_buffer receive_buffer::reserve(int size)
|
|||
return boost::asio::buffer(&m_recv_buffer[0] + m_recv_end, size);
|
||||
}
|
||||
|
||||
int receive_buffer::reserve(boost::array<boost::asio::mutable_buffer, 2>& vec, int size)
|
||||
int receive_buffer::reserve(std::array<boost::asio::mutable_buffer, 2>& vec, int size)
|
||||
{
|
||||
TORRENT_ASSERT(size > 0);
|
||||
TORRENT_ASSERT(m_recv_pos >= 0);
|
||||
|
@ -206,7 +206,7 @@ buffer::interval receive_buffer::mutable_buffer()
|
|||
, &m_recv_buffer[0] + m_recv_start + rcv_pos);
|
||||
}
|
||||
|
||||
// TODO: 2 should this take a boost::array<..., 2> instead? it could return the
|
||||
// TODO: 2 should this take a std::array<..., 2> instead? it could return the
|
||||
// number of buffers added, just like reserve.
|
||||
void receive_buffer::mutable_buffers(std::vector<boost::asio::mutable_buffer>& vec, int const bytes)
|
||||
{
|
||||
|
|
|
@ -516,7 +516,7 @@ namespace libtorrent
|
|||
#endif
|
||||
}
|
||||
|
||||
void session_handle::dht_get_item(boost::array<char, 32> key
|
||||
void session_handle::dht_get_item(std::array<char, 32> key
|
||||
, std::string salt)
|
||||
{
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
|
@ -539,8 +539,8 @@ namespace libtorrent
|
|||
return ret;
|
||||
}
|
||||
|
||||
void session_handle::dht_put_item(boost::array<char, 32> key
|
||||
, boost::function<void(entry&, boost::array<char,64>&
|
||||
void session_handle::dht_put_item(std::array<char, 32> key
|
||||
, boost::function<void(entry&, std::array<char,64>&
|
||||
, boost::uint64_t&, std::string const&)> cb
|
||||
, std::string salt)
|
||||
{
|
||||
|
|
|
@ -2308,7 +2308,7 @@ namespace aux {
|
|||
|
||||
for (;;)
|
||||
{
|
||||
boost::array<udp_socket::packet, 50> p;
|
||||
std::array<udp_socket::packet, 50> p;
|
||||
error_code err;
|
||||
int const num_packets = s->read(p, err);
|
||||
|
||||
|
@ -5715,7 +5715,7 @@ namespace aux {
|
|||
|
||||
// key is a 32-byte binary string, the public key to look up.
|
||||
// the salt is optional
|
||||
void session_impl::dht_get_mutable_item(boost::array<char, 32> key
|
||||
void session_impl::dht_get_mutable_item(std::array<char, 32> key
|
||||
, std::string salt)
|
||||
{
|
||||
if (!m_dht) return;
|
||||
|
@ -5733,8 +5733,8 @@ namespace aux {
|
|||
|
||||
void on_dht_put_mutable_item(alert_manager& alerts, dht::item const& i, int num)
|
||||
{
|
||||
boost::array<char, 64> sig = i.sig();
|
||||
boost::array<char, 32> pk = i.pk();
|
||||
std::array<char, 64> sig = i.sig();
|
||||
std::array<char, 32> pk = i.pk();
|
||||
boost::uint64_t seq = i.seq();
|
||||
std::string salt = i.salt();
|
||||
|
||||
|
@ -5743,12 +5743,12 @@ namespace aux {
|
|||
}
|
||||
|
||||
void put_mutable_callback(dht::item& i
|
||||
, boost::function<void(entry&, boost::array<char,64>&
|
||||
, boost::function<void(entry&, std::array<char,64>&
|
||||
, boost::uint64_t&, std::string const&)> cb)
|
||||
{
|
||||
entry value = i.value();
|
||||
boost::array<char, 64> sig = i.sig();
|
||||
boost::array<char, 32> pk = i.pk();
|
||||
std::array<char, 64> sig = i.sig();
|
||||
std::array<char, 32> pk = i.pk();
|
||||
boost::uint64_t seq = i.seq();
|
||||
std::string salt = i.salt();
|
||||
cb(value, sig, seq, salt);
|
||||
|
@ -5778,8 +5778,8 @@ namespace aux {
|
|||
, target, _1));
|
||||
}
|
||||
|
||||
void session_impl::dht_put_mutable_item(boost::array<char, 32> key
|
||||
, boost::function<void(entry&, boost::array<char,64>&
|
||||
void session_impl::dht_put_mutable_item(std::array<char, 32> key
|
||||
, boost::function<void(entry&, std::array<char,64>&
|
||||
, boost::uint64_t&, std::string const&)> cb
|
||||
, std::string salt)
|
||||
{
|
||||
|
|
|
@ -51,10 +51,10 @@ namespace libtorrent
|
|||
|
||||
// lexical_cast's result depends on the locale. We need
|
||||
// a well defined result
|
||||
boost::array<char, 4 + std::numeric_limits<boost::int64_t>::digits10>
|
||||
std::array<char, 4 + std::numeric_limits<boost::int64_t>::digits10>
|
||||
to_string(boost::int64_t n)
|
||||
{
|
||||
boost::array<char, 4 + std::numeric_limits<boost::int64_t>::digits10> ret;
|
||||
std::array<char, 4 + std::numeric_limits<boost::int64_t>::digits10> ret;
|
||||
char *p = &ret.back();
|
||||
*p = '\0';
|
||||
boost::uint64_t un = n;
|
||||
|
@ -198,7 +198,7 @@ namespace libtorrent
|
|||
ret += i->device;
|
||||
}
|
||||
ret += ":";
|
||||
ret += to_string(i->port).elems;
|
||||
ret += to_string(i->port).data();
|
||||
if (i->ssl) ret += "s";
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <array>
|
||||
#include <boost/system/system_error.hpp>
|
||||
#include <boost/system/error_code.hpp>
|
||||
#include <boost/asio/read.hpp>
|
||||
|
@ -319,7 +319,7 @@ void udp_socket::wrap(udp::endpoint const& ep, array_view<char const> p
|
|||
write_uint8(ep.address().is_v4()?1:4, h); // atyp
|
||||
write_endpoint(ep, h);
|
||||
|
||||
boost::array<boost::asio::const_buffer, 2> iovec;
|
||||
std::array<boost::asio::const_buffer, 2> iovec;
|
||||
iovec[0] = boost::asio::const_buffer(header, h - header);
|
||||
iovec[1] = boost::asio::const_buffer(p.data(), p.size());
|
||||
|
||||
|
@ -348,7 +348,7 @@ void udp_socket::wrap(char const* hostname, int const port, array_view<char cons
|
|||
h += hostlen;
|
||||
write_uint16(port, h);
|
||||
|
||||
boost::array<boost::asio::const_buffer, 2> iovec;
|
||||
std::array<boost::asio::const_buffer, 2> iovec;
|
||||
iovec[0] = boost::asio::const_buffer(header, h - header);
|
||||
iovec[1] = boost::asio::const_buffer(p.data(), p.size());
|
||||
|
||||
|
@ -503,7 +503,7 @@ void socks5::start(aux::proxy_settings const& ps)
|
|||
m_proxy_settings = ps;
|
||||
|
||||
// TODO: use the system resolver_interface here
|
||||
tcp::resolver::query q(ps.hostname, to_string(ps.port).elems);
|
||||
tcp::resolver::query q(ps.hostname, to_string(ps.port).data());
|
||||
ADD_OUTSTANDING_ASYNC("socks5::on_name_lookup");
|
||||
m_resolver.async_resolve(q, boost::bind(
|
||||
&socks5::on_name_lookup, self(), _1, _2));
|
||||
|
|
|
@ -532,7 +532,7 @@ namespace libtorrent
|
|||
cb->debug_log("==> UDP_TRACKER_CONNECT [ to: %s ih: %s]"
|
||||
, m_hostname.empty()
|
||||
? print_endpoint(m_target).c_str()
|
||||
: (m_hostname + ":" + to_string(m_target.port()).elems).c_str()
|
||||
: (m_hostname + ":" + to_string(m_target.port()).data()).c_str()
|
||||
, hex_ih);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -956,7 +956,7 @@ void upnp::on_upnp_xml(error_code const& e
|
|||
= parse_url_components(d.url, ec);
|
||||
if (d.port == -1) d.port = protocol == "http" ? 80 : 443;
|
||||
d.control_url = protocol + "://" + d.hostname + ":"
|
||||
+ to_string(d.port).elems + s.control_url;
|
||||
+ to_string(d.port).data() + s.control_url;
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -1396,7 +1396,7 @@ void upnp::return_error(int mapping, int code, std::unique_lock<std::mutex>& l)
|
|||
error_code_t* e = std::lower_bound(error_codes, end, tmp
|
||||
, boost::bind(&error_code_t::code, _1) < boost::bind(&error_code_t::code, _2));
|
||||
std::string error_string = "UPnP mapping error ";
|
||||
error_string += to_string(code).elems;
|
||||
error_string += to_string(code).data();
|
||||
if (e != end && e->code == code)
|
||||
{
|
||||
error_string += ": ";
|
||||
|
|
|
@ -342,9 +342,9 @@ void web_peer_connection::write_request(peer_request const& r)
|
|||
request += " HTTP/1.1\r\n";
|
||||
add_headers(request, m_settings, using_proxy);
|
||||
request += "\r\nRange: bytes=";
|
||||
request += to_string(file_req.start).elems;
|
||||
request += to_string(file_req.start).data();
|
||||
request += "-";
|
||||
request += to_string(file_req.start + file_req.length - 1).elems;
|
||||
request += to_string(file_req.start + file_req.length - 1).data();
|
||||
request += "\r\n\r\n";
|
||||
m_first_request = false;
|
||||
|
||||
|
@ -405,9 +405,9 @@ void web_peer_connection::write_request(peer_request const& r)
|
|||
request += " HTTP/1.1\r\n";
|
||||
add_headers(request, m_settings, using_proxy);
|
||||
request += "\r\nRange: bytes=";
|
||||
request += to_string(f.offset).elems;
|
||||
request += to_string(f.offset).data();
|
||||
request += "-";
|
||||
request += to_string(f.offset + f.size - 1).elems;
|
||||
request += to_string(f.offset + f.size - 1).data();
|
||||
request += "\r\n\r\n";
|
||||
m_first_request = false;
|
||||
|
||||
|
@ -554,7 +554,7 @@ void web_peer_connection::handle_error(int bytes_left)
|
|||
if (retry_time <= 0) retry_time = m_settings.get_int(settings_pack::urlseed_wait_retry);
|
||||
// temporarily unavailable, retry later
|
||||
t->retry_web_seed(this, retry_time);
|
||||
std::string error_msg = to_string(m_parser.status_code()).elems
|
||||
std::string error_msg = to_string(m_parser.status_code()).data()
|
||||
+ (" " + m_parser.message());
|
||||
if (t->alerts().should_post<url_seed_alert>())
|
||||
{
|
||||
|
|
|
@ -536,7 +536,7 @@ void peer_conn::write_piece(int piece, int start, int length)
|
|||
write_uint8(7, ptr);
|
||||
write_uint32(piece, ptr);
|
||||
write_uint32(start, ptr);
|
||||
boost::array<boost::asio::const_buffer, 2> vec;
|
||||
std::array<boost::asio::const_buffer, 2> vec;
|
||||
vec[0] = boost::asio::buffer(write_buf_proto, ptr - write_buf_proto);
|
||||
vec[1] = boost::asio::buffer(write_buffer, length);
|
||||
boost::asio::async_write(s, vec, boost::bind(&peer_conn::on_have_all_sent, this, _1, _2));
|
||||
|
|
|
@ -114,9 +114,9 @@ sha1_hash generate_next()
|
|||
return ret;
|
||||
}
|
||||
|
||||
boost::array<char, 64> generate_key()
|
||||
std::array<char, 64> generate_key()
|
||||
{
|
||||
boost::array<char, 64> ret;
|
||||
std::array<char, 64> ret;
|
||||
for (int i = 0; i < 64; ++i) ret[i] = rand() & 0xff;
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ TORRENT_TEST(recv_buffer_pos_at_end_false)
|
|||
|
||||
b.cut(0, 1000);
|
||||
// allocate some space to receive into
|
||||
boost::array<boost::asio::mutable_buffer, 2> vec;
|
||||
std::array<boost::asio::mutable_buffer, 2> vec;
|
||||
int num_bufs = b.reserve(vec, 1000);
|
||||
|
||||
// since we don't have a disk buffer, there should only be a single
|
||||
|
@ -88,7 +88,7 @@ TORRENT_TEST(recv_buffer_pos_at_end_true)
|
|||
receive_buffer b(a);
|
||||
b.cut(0, 1000);
|
||||
b.reserve(1000);
|
||||
boost::array<boost::asio::mutable_buffer, 2> vec;
|
||||
std::array<boost::asio::mutable_buffer, 2> vec;
|
||||
int num_bufs = b.reserve(vec, 1000);
|
||||
TEST_EQUAL(num_bufs, 1);
|
||||
b.received(1000);
|
||||
|
@ -103,7 +103,7 @@ TORRENT_TEST(recv_buffer_packet_finished)
|
|||
// packet_size = 10
|
||||
b.cut(0, 10);
|
||||
b.reserve(1000);
|
||||
boost::array<boost::asio::mutable_buffer, 2> vec;
|
||||
std::array<boost::asio::mutable_buffer, 2> vec;
|
||||
int num_bufs = b.reserve(vec, 1000);
|
||||
TEST_EQUAL(num_bufs, 1);
|
||||
b.received(1000);
|
||||
|
@ -124,7 +124,7 @@ TORRENT_TEST(recv_buffer_disk_buffer)
|
|||
receive_buffer b(a);
|
||||
b.reserve(1000);
|
||||
b.cut(0, 1000); // packet size = 1000
|
||||
boost::array<boost::asio::mutable_buffer, 2> vec;
|
||||
std::array<boost::asio::mutable_buffer, 2> vec;
|
||||
b.assign_disk_buffer(&disk_buffer, 137);
|
||||
int const num_bufs = b.reserve(vec, 1000);
|
||||
TEST_EQUAL(num_bufs, 2);
|
||||
|
|
|
@ -93,10 +93,10 @@ TORRENT_TEST(string)
|
|||
|
||||
// test itoa
|
||||
|
||||
TEST_CHECK(to_string(345).elems == std::string("345"));
|
||||
TEST_CHECK(to_string(-345).elems == std::string("-345"));
|
||||
TEST_CHECK(to_string(0).elems == std::string("0"));
|
||||
TEST_CHECK(to_string(1000000000).elems == std::string("1000000000"));
|
||||
TEST_CHECK(to_string(345).data() == std::string("345"));
|
||||
TEST_CHECK(to_string(-345).data() == std::string("-345"));
|
||||
TEST_CHECK(to_string(0).data() == std::string("0"));
|
||||
TEST_CHECK(to_string(1000000000).data() == std::string("1000000000"));
|
||||
|
||||
// base64 test vectors from http://www.faqs.org/rfcs/rfc4648.html
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ alert* wait_for_alert(lt::session& s, int alert_type)
|
|||
return ret;
|
||||
}
|
||||
|
||||
void put_string(entry& e, boost::array<char, 64>& sig, boost::uint64_t& seq
|
||||
void put_string(entry& e, std::array<char, 64>& sig, boost::uint64_t& seq
|
||||
, std::string const& salt, char const* public_key, char const* private_key
|
||||
, char const* str)
|
||||
{
|
||||
|
@ -150,8 +150,8 @@ int dump_key(char *filename)
|
|||
}
|
||||
fclose(f);
|
||||
|
||||
boost::array<char, 32> public_key;
|
||||
boost::array<char, 64> private_key;
|
||||
std::array<char, 32> public_key;
|
||||
std::array<char, 64> private_key;
|
||||
ed25519_create_keypair((unsigned char*)public_key.data()
|
||||
, (unsigned char*)private_key.data(), seed);
|
||||
|
||||
|
@ -346,8 +346,8 @@ int main(int argc, char* argv[])
|
|||
--argc;
|
||||
if (argc < 1) usage();
|
||||
|
||||
boost::array<char, 32> public_key;
|
||||
boost::array<char, 64> private_key;
|
||||
std::array<char, 32> public_key;
|
||||
std::array<char, 64> private_key;
|
||||
ed25519_create_keypair((unsigned char*)public_key.data()
|
||||
, (unsigned char*)private_key.data(), seed);
|
||||
|
||||
|
@ -374,7 +374,7 @@ int main(int argc, char* argv[])
|
|||
fprintf(stderr, "public key is expected to be 64 hex digits\n");
|
||||
return 1;
|
||||
}
|
||||
boost::array<char, 32> public_key;
|
||||
std::array<char, 32> public_key;
|
||||
bool ret = from_hex(argv[0], len, &public_key[0]);
|
||||
if (!ret)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue