some sunPRO compiler support
This commit is contained in:
@@ -41,7 +41,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <alloca.h>
|
||||||
|
|
||||||
#define TORRENT_ALLOCA(t, n) static_cast<t*>(alloca(sizeof(t) * (n)))
|
#define TORRENT_ALLOCA(t, n) static_cast<t*>(alloca(sizeof(t) * (n)))
|
||||||
|
|
||||||
|
@@ -77,6 +77,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
#define TORRENT_STRICT_UNIONS 1
|
||||||
|
|
||||||
// ======= MSVC =========
|
// ======= MSVC =========
|
||||||
|
|
||||||
@@ -235,6 +236,10 @@ inline int snprintf(char* buf, int len, char const* fmt, ...)
|
|||||||
#define TORRENT_USE_ICONV 1
|
#define TORRENT_USE_ICONV 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef TORRENT_STRICT_UNIONS
|
||||||
|
#define TORRENT_STRICT_UNIONS 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined UNICODE && !defined BOOST_NO_STD_WSTRING
|
#if defined UNICODE && !defined BOOST_NO_STD_WSTRING
|
||||||
#define TORRENT_USE_WSTRING 1
|
#define TORRENT_USE_WSTRING 1
|
||||||
#else
|
#else
|
||||||
@@ -307,6 +312,14 @@ inline int snprintf(char* buf, int len, char const* fmt, ...)
|
|||||||
#define for if (false) {} else for
|
#define for if (false) {} else for
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// GCC and MSVC allows unions with constructors
|
||||||
|
// in unions. SunPRO does not, use struct there
|
||||||
|
#if TORRENT_STRICT_UNIONS
|
||||||
|
#define TORRENT_NON_POD_UNION struct
|
||||||
|
#else
|
||||||
|
#define TORRENT_NON_POD_UNION union
|
||||||
|
#endif
|
||||||
|
|
||||||
// determine what timer implementation we can use
|
// determine what timer implementation we can use
|
||||||
// if one is already defined, don't pick one
|
// if one is already defined, don't pick one
|
||||||
// autmatically. This lets the user control this
|
// autmatically. This lets the user control this
|
||||||
|
@@ -158,7 +158,7 @@ namespace libtorrent
|
|||||||
// array at the end, it will end up referring
|
// array at the end, it will end up referring
|
||||||
// to the m_name field
|
// to the m_name field
|
||||||
struct dirent m_dirent;
|
struct dirent m_dirent;
|
||||||
char m_name[NAME_MAX + 1]; // +1 to make room for null
|
char m_name[TORRENT_MAX_PATH + 1]; // +1 to make room for null
|
||||||
#endif
|
#endif
|
||||||
bool m_done;
|
bool m_done;
|
||||||
};
|
};
|
||||||
|
@@ -100,6 +100,7 @@ typedef std::vector<tcp::endpoint> peers_t;
|
|||||||
|
|
||||||
struct msg
|
struct msg
|
||||||
{
|
{
|
||||||
|
msg(lazy_entry const& m, udp::endpoint const& ep): message(m), addr(ep) {}
|
||||||
// the message
|
// the message
|
||||||
lazy_entry const& message;
|
lazy_entry const& message;
|
||||||
|
|
||||||
|
@@ -128,7 +128,7 @@ protected:
|
|||||||
|
|
||||||
const boost::intrusive_ptr<traversal_algorithm> m_algorithm;
|
const boost::intrusive_ptr<traversal_algorithm> m_algorithm;
|
||||||
|
|
||||||
union addr_t
|
TORRENT_NON_POD_UNION addr_t
|
||||||
{
|
{
|
||||||
#if TORRENT_USE_IPV6
|
#if TORRENT_USE_IPV6
|
||||||
address_v6::bytes_type v6;
|
address_v6::bytes_type v6;
|
||||||
|
@@ -107,7 +107,7 @@ struct traversal_algorithm : boost::noncopyable
|
|||||||
|
|
||||||
node_id id;
|
node_id id;
|
||||||
|
|
||||||
union addr_t
|
TORRENT_NON_POD_UNION addr_t
|
||||||
{
|
{
|
||||||
address_v4::bytes_type v4;
|
address_v4::bytes_type v4;
|
||||||
#if TORRENT_USE_IPV6
|
#if TORRENT_USE_IPV6
|
||||||
|
@@ -187,7 +187,7 @@ namespace libtorrent
|
|||||||
save_peer_proxy = 0x040,
|
save_peer_proxy = 0x040,
|
||||||
save_web_proxy = 0x080,
|
save_web_proxy = 0x080,
|
||||||
save_tracker_proxy = 0x100,
|
save_tracker_proxy = 0x100,
|
||||||
save_as_map = 0x200,
|
save_as_map = 0x200
|
||||||
};
|
};
|
||||||
void save_state(entry& e, boost::uint32_t flags = 0xffffffff) const;
|
void save_state(entry& e, boost::uint32_t flags = 0xffffffff) const;
|
||||||
void load_state(lazy_entry const& e);
|
void load_state(lazy_entry const& e);
|
||||||
|
@@ -311,7 +311,7 @@ namespace libtorrent
|
|||||||
{ none, requested, writing, finished };
|
{ none, requested, writing, finished };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
union addr_t
|
TORRENT_NON_POD_UNION addr_t
|
||||||
{
|
{
|
||||||
address_v4::bytes_type v4;
|
address_v4::bytes_type v4;
|
||||||
#if TORRENT_USE_IPV6
|
#if TORRENT_USE_IPV6
|
||||||
|
@@ -76,7 +76,7 @@ namespace libtorrent
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
union addr_t
|
TORRENT_NON_POD_UNION addr_t
|
||||||
{
|
{
|
||||||
address_v4::bytes_type v4;
|
address_v4::bytes_type v4;
|
||||||
#if TORRENT_USE_IPV6
|
#if TORRENT_USE_IPV6
|
||||||
|
@@ -632,7 +632,13 @@ namespace libtorrent
|
|||||||
ret.resize(outsize);
|
ret.resize(outsize);
|
||||||
char const* in = s.c_str();
|
char const* in = s.c_str();
|
||||||
char* out = &ret[0];
|
char* out = &ret[0];
|
||||||
size_t retval = iconv(h, (char**)&in, &insize,
|
#ifdef TORRENT_LINUX
|
||||||
|
// linux seems to have a weird iconv signature
|
||||||
|
#define ICONV_IN_CAST (char**)
|
||||||
|
#else
|
||||||
|
#define ICONV_IN_CAST
|
||||||
|
#endif
|
||||||
|
size_t retval = iconv(h, ICONV_IN_CAST &in, &insize,
|
||||||
&out, &outsize);
|
&out, &outsize);
|
||||||
if (retval == (size_t)-1) return s;
|
if (retval == (size_t)-1) return s;
|
||||||
// if this string has an invalid utf-8 sequence in it, don't touch it
|
// if this string has an invalid utf-8 sequence in it, don't touch it
|
||||||
|
@@ -520,7 +520,7 @@ namespace libtorrent { namespace dht
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
libtorrent::dht::msg m = {e, ep};
|
libtorrent::dht::msg m(e, ep);
|
||||||
|
|
||||||
if (e.type() != lazy_entry::dict_t)
|
if (e.type() != lazy_entry::dict_t)
|
||||||
{
|
{
|
||||||
|
@@ -33,6 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include "libtorrent/pch.hpp"
|
#include "libtorrent/pch.hpp"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <iterator> // std::distance()
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
|
@@ -45,6 +45,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
|
#include <algorithm> // count
|
||||||
|
|
||||||
#include "libtorrent/peer_connection.hpp"
|
#include "libtorrent/peer_connection.hpp"
|
||||||
#include "libtorrent/bt_peer_connection.hpp"
|
#include "libtorrent/bt_peer_connection.hpp"
|
||||||
|
Reference in New Issue
Block a user