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