forked from premiere/premiere-libtorrent
some sunPRO compiler support
This commit is contained in:
parent
b09a282a9e
commit
dcffa55700
|
@ -41,7 +41,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#else
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <alloca.h>
|
||||
|
||||
#define TORRENT_ALLOCA(t, n) static_cast<t*>(alloca(sizeof(t) * (n)))
|
||||
|
||||
|
|
|
@ -77,6 +77,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
# endif
|
||||
# endif
|
||||
|
||||
#define TORRENT_STRICT_UNIONS 1
|
||||
|
||||
// ======= MSVC =========
|
||||
|
||||
|
@ -235,6 +236,10 @@ inline int snprintf(char* buf, int len, char const* fmt, ...)
|
|||
#define TORRENT_USE_ICONV 1
|
||||
#endif
|
||||
|
||||
#ifndef TORRENT_STRICT_UNIONS
|
||||
#define TORRENT_STRICT_UNIONS 0
|
||||
#endif
|
||||
|
||||
#if defined UNICODE && !defined BOOST_NO_STD_WSTRING
|
||||
#define TORRENT_USE_WSTRING 1
|
||||
#else
|
||||
|
@ -307,6 +312,14 @@ inline int snprintf(char* buf, int len, char const* fmt, ...)
|
|||
#define for if (false) {} else for
|
||||
#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
|
||||
// if one is already defined, don't pick one
|
||||
// autmatically. This lets the user control this
|
||||
|
|
|
@ -158,7 +158,7 @@ namespace libtorrent
|
|||
// array at the end, it will end up referring
|
||||
// to the m_name field
|
||||
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
|
||||
bool m_done;
|
||||
};
|
||||
|
|
|
@ -100,6 +100,7 @@ typedef std::vector<tcp::endpoint> peers_t;
|
|||
|
||||
struct msg
|
||||
{
|
||||
msg(lazy_entry const& m, udp::endpoint const& ep): message(m), addr(ep) {}
|
||||
// the message
|
||||
lazy_entry const& message;
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ protected:
|
|||
|
||||
const boost::intrusive_ptr<traversal_algorithm> m_algorithm;
|
||||
|
||||
union addr_t
|
||||
TORRENT_NON_POD_UNION addr_t
|
||||
{
|
||||
#if TORRENT_USE_IPV6
|
||||
address_v6::bytes_type v6;
|
||||
|
|
|
@ -107,7 +107,7 @@ struct traversal_algorithm : boost::noncopyable
|
|||
|
||||
node_id id;
|
||||
|
||||
union addr_t
|
||||
TORRENT_NON_POD_UNION addr_t
|
||||
{
|
||||
address_v4::bytes_type v4;
|
||||
#if TORRENT_USE_IPV6
|
||||
|
|
|
@ -187,7 +187,7 @@ namespace libtorrent
|
|||
save_peer_proxy = 0x040,
|
||||
save_web_proxy = 0x080,
|
||||
save_tracker_proxy = 0x100,
|
||||
save_as_map = 0x200,
|
||||
save_as_map = 0x200
|
||||
};
|
||||
void save_state(entry& e, boost::uint32_t flags = 0xffffffff) const;
|
||||
void load_state(lazy_entry const& e);
|
||||
|
|
|
@ -311,7 +311,7 @@ namespace libtorrent
|
|||
{ none, requested, writing, finished };
|
||||
|
||||
private:
|
||||
union addr_t
|
||||
TORRENT_NON_POD_UNION addr_t
|
||||
{
|
||||
address_v4::bytes_type v4;
|
||||
#if TORRENT_USE_IPV6
|
||||
|
|
|
@ -76,7 +76,7 @@ namespace libtorrent
|
|||
#endif
|
||||
}
|
||||
|
||||
union addr_t
|
||||
TORRENT_NON_POD_UNION addr_t
|
||||
{
|
||||
address_v4::bytes_type v4;
|
||||
#if TORRENT_USE_IPV6
|
||||
|
|
|
@ -632,7 +632,13 @@ namespace libtorrent
|
|||
ret.resize(outsize);
|
||||
char const* in = s.c_str();
|
||||
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);
|
||||
if (retval == (size_t)-1) return s;
|
||||
// if this string has an invalid utf-8 sequence in it, don't touch it
|
||||
|
|
|
@ -520,7 +520,7 @@ namespace libtorrent { namespace dht
|
|||
return;
|
||||
}
|
||||
|
||||
libtorrent::dht::msg m = {e, ep};
|
||||
libtorrent::dht::msg m(e, ep);
|
||||
|
||||
if (e.type() != lazy_entry::dict_t)
|
||||
{
|
||||
|
|
|
@ -33,6 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/pch.hpp"
|
||||
|
||||
#include <vector>
|
||||
#include <iterator> // std::distance()
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <numeric>
|
||||
|
|
|
@ -45,6 +45,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <vector>
|
||||
#include <utility>
|
||||
#include <numeric>
|
||||
#include <algorithm> // count
|
||||
|
||||
#include "libtorrent/peer_connection.hpp"
|
||||
#include "libtorrent/bt_peer_connection.hpp"
|
||||
|
|
Loading…
Reference in New Issue