forked from premiere/premiere-libtorrent
merge build fix with C++11 from RC_0_16
This commit is contained in:
parent
7ce6425534
commit
89c3db477d
|
@ -24,6 +24,7 @@
|
|||
* fix uTP edge case where udp socket buffer fills up
|
||||
* fix nagle implementation in uTP
|
||||
|
||||
* fix building with C++11
|
||||
* fix IPv6 support in UDP socket (uTP)
|
||||
* fix mingw build issues
|
||||
* increase max allowed outstanding piece requests from peers
|
||||
|
|
|
@ -437,7 +437,7 @@ namespace libtorrent
|
|||
#endif // TORRENT_NO_DEPRECATE
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
bool is_dht_running() const { return m_dht; }
|
||||
bool is_dht_running() const { return m_dht.get(); }
|
||||
#endif
|
||||
|
||||
#if TORRENT_USE_I2P
|
||||
|
|
|
@ -50,6 +50,10 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/string_util.hpp" // for allocate_string_copy
|
||||
#include <stdlib.h> // free
|
||||
|
||||
#ifndef BOOST_SYSTEM_NOEXCEPT
|
||||
#define BOOST_SYSTEM_NOEXCEPT throw()
|
||||
#endif
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
|
||||
|
@ -496,17 +500,17 @@ namespace libtorrent
|
|||
|
||||
struct TORRENT_EXPORT libtorrent_error_category : boost::system::error_category
|
||||
{
|
||||
virtual const char* name() const throw();
|
||||
virtual std::string message(int ev) const throw();
|
||||
virtual boost::system::error_condition default_error_condition(int ev) const throw()
|
||||
virtual const char* name() const BOOST_SYSTEM_NOEXCEPT;
|
||||
virtual std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT;
|
||||
virtual boost::system::error_condition default_error_condition(int ev) const BOOST_SYSTEM_NOEXCEPT
|
||||
{ return boost::system::error_condition(ev, *this); }
|
||||
};
|
||||
|
||||
struct TORRENT_EXPORT http_error_category : boost::system::error_category
|
||||
{
|
||||
virtual const char* name() const throw();
|
||||
virtual std::string message(int ev) const throw();
|
||||
virtual boost::system::error_condition default_error_condition(int ev) const throw()
|
||||
virtual const char* name() const BOOST_SYSTEM_NOEXCEPT;
|
||||
virtual std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT;
|
||||
virtual boost::system::error_condition default_error_condition(int ev) const BOOST_SYSTEM_NOEXCEPT
|
||||
{ return boost::system::error_condition(ev, *this); }
|
||||
};
|
||||
|
||||
|
|
|
@ -67,9 +67,9 @@ namespace libtorrent {
|
|||
|
||||
struct TORRENT_EXPORT i2p_error_category : boost::system::error_category
|
||||
{
|
||||
virtual const char* name() const;
|
||||
virtual std::string message(int ev) const;
|
||||
virtual boost::system::error_condition default_error_condition(int ev) const
|
||||
virtual const char* name() const BOOST_SYSTEM_NOEXCEPT;
|
||||
virtual std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT;
|
||||
virtual boost::system::error_condition default_error_condition(int ev) const BOOST_SYSTEM_NOEXCEPT
|
||||
{ return boost::system::error_condition(ev, *this); }
|
||||
};
|
||||
|
||||
|
|
|
@ -68,9 +68,9 @@ typedef asio::error::error_category socks_error_category;
|
|||
|
||||
struct TORRENT_EXTRA_EXPORT socks_error_category : boost::system::error_category
|
||||
{
|
||||
virtual const char* name() const;
|
||||
virtual std::string message(int ev) const;
|
||||
virtual boost::system::error_condition default_error_condition(int ev) const
|
||||
virtual const char* name() const BOOST_SYSTEM_NOEXCEPT;
|
||||
virtual std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT;
|
||||
virtual boost::system::error_condition default_error_condition(int ev) const BOOST_SYSTEM_NOEXCEPT
|
||||
{ return boost::system::error_condition(ev, *this); }
|
||||
};
|
||||
|
||||
|
|
|
@ -99,9 +99,9 @@ namespace libtorrent
|
|||
|
||||
struct TORRENT_EXPORT upnp_error_category : boost::system::error_category
|
||||
{
|
||||
virtual const char* name() const;
|
||||
virtual std::string message(int ev) const;
|
||||
virtual boost::system::error_condition default_error_condition(int ev) const
|
||||
virtual const char* name() const BOOST_SYSTEM_NOEXCEPT;
|
||||
virtual std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT;
|
||||
virtual boost::system::error_condition default_error_condition(int ev) const BOOST_SYSTEM_NOEXCEPT
|
||||
{ return boost::system::error_condition(ev, *this); }
|
||||
};
|
||||
|
||||
|
|
|
@ -611,7 +611,7 @@ namespace libtorrent
|
|||
else
|
||||
{
|
||||
TORRENT_ASSERT(buf);
|
||||
file::iovec_t b = { buf.get(), buffer_size };
|
||||
file::iovec_t b = { buf.get(), size_t(buffer_size) };
|
||||
int ret = p.storage->write_impl(&b, p.piece, (std::min)(
|
||||
i * m_block_size, piece_size) - buffer_size, 1);
|
||||
if (ret > 0) ++num_write_calls;
|
||||
|
@ -811,7 +811,7 @@ namespace libtorrent
|
|||
if (buf)
|
||||
{
|
||||
l.unlock();
|
||||
file::iovec_t b = { buf.get(), buffer_size };
|
||||
file::iovec_t b = { buf.get(), size_t(buffer_size) };
|
||||
ret = p.storage->read_impl(&b, p.piece, start_block * m_block_size, 1);
|
||||
l.lock();
|
||||
++m_cache_stats.reads;
|
||||
|
@ -2025,7 +2025,7 @@ namespace libtorrent
|
|||
}
|
||||
else if (ret == -2)
|
||||
{
|
||||
file::iovec_t b = { j.buffer, j.buffer_size };
|
||||
file::iovec_t b = { j.buffer, size_t(j.buffer_size) };
|
||||
ret = j.storage->read_impl(&b, j.piece, j.offset, 1);
|
||||
if (ret < 0)
|
||||
{
|
||||
|
@ -2138,7 +2138,7 @@ namespace libtorrent
|
|||
{
|
||||
l.unlock();
|
||||
ptime start = time_now_hires();
|
||||
file::iovec_t iov = {j.buffer, j.buffer_size};
|
||||
file::iovec_t iov = {j.buffer, size_t(j.buffer_size) };
|
||||
ret = j.storage->write_impl(&iov, j.piece, j.offset, 1);
|
||||
l.lock();
|
||||
if (ret < 0)
|
||||
|
|
|
@ -40,12 +40,12 @@ namespace libtorrent
|
|||
{
|
||||
#if BOOST_VERSION >= 103500
|
||||
|
||||
const char* libtorrent_error_category::name() const throw()
|
||||
const char* libtorrent_error_category::name() const BOOST_SYSTEM_NOEXCEPT
|
||||
{
|
||||
return "libtorrent error";
|
||||
}
|
||||
|
||||
std::string libtorrent_error_category::message(int ev) const throw()
|
||||
std::string libtorrent_error_category::message(int ev) const BOOST_SYSTEM_NOEXCEPT
|
||||
{
|
||||
static char const* msgs[] =
|
||||
{
|
||||
|
@ -275,12 +275,12 @@ namespace libtorrent
|
|||
return http_category;
|
||||
}
|
||||
|
||||
const char* http_error_category::name() const throw()
|
||||
const char* http_error_category::name() const BOOST_SYSTEM_NOEXCEPT
|
||||
{
|
||||
return "http error";
|
||||
}
|
||||
|
||||
std::string http_error_category::message(int ev) const throw()
|
||||
std::string http_error_category::message(int ev) const BOOST_SYSTEM_NOEXCEPT
|
||||
{
|
||||
std::string ret;
|
||||
ret += to_string(ev).elems;
|
||||
|
|
|
@ -1084,7 +1084,7 @@ namespace libtorrent
|
|||
0, // start offset
|
||||
0, // length (0 = until EOF)
|
||||
getpid(), // owner
|
||||
(mode & write_only) ? F_WRLCK : F_RDLCK, // lock type
|
||||
short((mode & write_only) ? F_WRLCK : F_RDLCK), // lock type
|
||||
SEEK_SET // whence
|
||||
};
|
||||
if (fcntl(m_fd, F_SETLK, &l) != 0)
|
||||
|
|
|
@ -48,12 +48,12 @@ namespace libtorrent
|
|||
|
||||
i2p_error_category i2p_category;
|
||||
|
||||
const char* i2p_error_category::name() const
|
||||
const char* i2p_error_category::name() const BOOST_SYSTEM_NOEXCEPT
|
||||
{
|
||||
return "i2p error";
|
||||
}
|
||||
|
||||
std::string i2p_error_category::message(int ev) const
|
||||
std::string i2p_error_category::message(int ev) const BOOST_SYSTEM_NOEXCEPT
|
||||
{
|
||||
static char const* messages[] =
|
||||
{
|
||||
|
|
|
@ -42,12 +42,12 @@ namespace libtorrent
|
|||
socks_error_category socks_category;
|
||||
|
||||
#if BOOST_VERSION >= 103500
|
||||
const char* socks_error_category::name() const
|
||||
const char* socks_error_category::name() const BOOST_SYSTEM_NOEXCEPT
|
||||
{
|
||||
return "socks error";
|
||||
}
|
||||
|
||||
std::string socks_error_category::message(int ev) const
|
||||
std::string socks_error_category::message(int ev) const BOOST_SYSTEM_NOEXCEPT
|
||||
{
|
||||
static char const* messages[] =
|
||||
{
|
||||
|
|
|
@ -1099,12 +1099,12 @@ namespace
|
|||
#if BOOST_VERSION >= 103500
|
||||
|
||||
|
||||
const char* upnp_error_category::name() const
|
||||
const char* upnp_error_category::name() const BOOST_SYSTEM_NOEXCEPT
|
||||
{
|
||||
return "UPnP error";
|
||||
}
|
||||
|
||||
std::string upnp_error_category::message(int ev) const
|
||||
std::string upnp_error_category::message(int ev) const BOOST_SYSTEM_NOEXCEPT
|
||||
{
|
||||
int num_errors = sizeof(error_codes) / sizeof(error_codes[0]);
|
||||
error_code_t* end = error_codes + num_errors;
|
||||
|
|
|
@ -180,7 +180,7 @@ int test_main()
|
|||
|
||||
// test invalid encoding
|
||||
{
|
||||
char buf[] =
|
||||
unsigned char buf[] =
|
||||
{ 0x64 , 0x31 , 0x3a , 0x61 , 0x64 , 0x32 , 0x3a , 0x69
|
||||
, 0x64 , 0x32 , 0x30 , 0x3a , 0x2a , 0x21 , 0x19 , 0x89
|
||||
, 0x9f , 0xcd , 0x5f , 0xc9 , 0xbc , 0x80 , 0xc1 , 0x76
|
||||
|
@ -198,7 +198,7 @@ int test_main()
|
|||
printf("%s\n", buf);
|
||||
lazy_entry e;
|
||||
error_code ec;
|
||||
int ret = lazy_bdecode(buf, buf + sizeof(buf), e, ec);
|
||||
int ret = lazy_bdecode((char*)buf, (char*)buf + sizeof(buf), e, ec);
|
||||
TEST_CHECK(ret == -1);
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -197,7 +197,7 @@ void save_file(char const* filename, char const* data, int size)
|
|||
fprintf(stderr, "ERROR opening file '%s': %s\n", filename, ec.message().c_str());
|
||||
return;
|
||||
}
|
||||
file::iovec_t b = { (void*)data, size };
|
||||
file::iovec_t b = { (void*)data, size_t(size) };
|
||||
out.writev(0, &b, 1, ec);
|
||||
TEST_CHECK(!ec);
|
||||
if (ec)
|
||||
|
|
Loading…
Reference in New Issue