some GCC 2.95 support fixes and some BeOS support
This commit is contained in:
parent
1d6d11bf0c
commit
39dae9e6dc
4
Jamfile
4
Jamfile
|
@ -212,11 +212,13 @@ rule tag ( name : type ? : property-set )
|
|||
|
||||
feature tcmalloc : no yes : composite propagated link-incompatible ;
|
||||
|
||||
feature timer : auto boost absolute performance clock : composite propagated link-incompatible ;
|
||||
feature timer : auto boost absolute performance clock system_time
|
||||
: composite propagated link-incompatible ;
|
||||
feature.compose <timer>boost : <define>TORRENT_USE_BOOST_DATE_TIME=1 ;
|
||||
feature.compose <timer>absolute : <define>TORRENT_USE_ABSOLUTE_TIME=1 ;
|
||||
feature.compose <timer>performance : <define>TORRENT_USE_PERFORMANCE_TIMER=1 ;
|
||||
feature.compose <timer>clock : <define>TORRENT_USE_CLOCK_GETTIME=1 ;
|
||||
feature.compose <timer>system_time : <define>TORRENT_USE_SYSTEM_TIME=1 ;
|
||||
|
||||
feature ipv6 : on off : composite propagated link-incompatible ;
|
||||
feature.compose <ipv6>off : <define>TORRENT_USE_IPV6=0 ;
|
||||
|
|
|
@ -429,7 +429,6 @@ namespace libtorrent
|
|||
const static int static_category = alert::peer_notification;
|
||||
virtual std::string message() const
|
||||
{
|
||||
error_code ec;
|
||||
return peer_alert::message() + " peer error: " + error.message();
|
||||
}
|
||||
|
||||
|
|
|
@ -55,17 +55,15 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#if defined __GNUC__
|
||||
|
||||
# define TORRENT_DEPRECATED __attribute__ ((deprecated))
|
||||
# if __GNUC__ >= 3
|
||||
# define TORRENT_DEPRECATED __attribute__ ((deprecated))
|
||||
# endif
|
||||
|
||||
// GCC pre 4.0 did not have support for the visibility attribute
|
||||
# if __GNUC__ >= 4
|
||||
# if defined(TORRENT_BUILDING_SHARED) || defined(TORRENT_LINKING_SHARED)
|
||||
# define TORRENT_EXPORT __attribute__ ((visibility("default")))
|
||||
# else
|
||||
# define TORRENT_EXPORT
|
||||
# endif
|
||||
# else
|
||||
# define TORRENT_EXPORT
|
||||
# endif
|
||||
|
||||
|
||||
|
@ -76,11 +74,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
# if __SUNPRO_CC >= 0x550
|
||||
# if defined(TORRENT_BUILDING_SHARED) || defined(TORRENT_LINKING_SHARED)
|
||||
# define TORRENT_EXPORT __global
|
||||
# else
|
||||
# define TORRENT_EXPORT
|
||||
# endif
|
||||
# else
|
||||
# define TORRENT_EXPORT
|
||||
# endif
|
||||
|
||||
|
||||
|
@ -95,29 +89,15 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
# define TORRENT_EXPORT __declspec(dllexport)
|
||||
# elif defined(TORRENT_LINKING_SHARED)
|
||||
# define TORRENT_EXPORT __declspec(dllimport)
|
||||
# else
|
||||
# define TORRENT_EXPORT
|
||||
# endif
|
||||
|
||||
#define TORRENT_DEPRECATED_PREFIX __declspec(deprecated)
|
||||
|
||||
|
||||
|
||||
// ======= GENERIC COMPILER =========
|
||||
|
||||
#else
|
||||
# define TORRENT_EXPORT
|
||||
#endif
|
||||
|
||||
|
||||
// ======= PLATFORMS =========
|
||||
|
||||
#ifndef TORRENT_DEPRECATED_PREFIX
|
||||
#define TORRENT_DEPRECATED_PREFIX
|
||||
#endif
|
||||
|
||||
#ifndef TORRENT_DEPRECATED
|
||||
#define TORRENT_DEPRECATED
|
||||
#endif
|
||||
|
||||
// set up defines for target environments
|
||||
#if (defined __APPLE__ && defined __MACH__) || defined __FreeBSD__ || defined __NetBSD__ \
|
||||
|
@ -132,11 +112,27 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#define TORRENT_WINDOWS
|
||||
#elif defined sun || defined __sun
|
||||
#define TORRENT_SOLARIS
|
||||
#elif defined __BEOS__ || defined __HAIKU__
|
||||
#define TORRENT_BEOS
|
||||
#include <storage/StorageDefs.h> // B_PATH_NAME_LENGTH
|
||||
#define TORRENT_HAS_FALLOCATE 0
|
||||
#else
|
||||
#warning unknown OS, assuming BSD
|
||||
#define TORRENT_BSD
|
||||
#endif
|
||||
|
||||
#ifndef TORRENT_EXPORT
|
||||
# define TORRENT_EXPORT
|
||||
#endif
|
||||
|
||||
#ifndef TORRENT_DEPRECATED_PREFIX
|
||||
#define TORRENT_DEPRECATED_PREFIX
|
||||
#endif
|
||||
|
||||
#ifndef TORRENT_DEPRECATED
|
||||
#define TORRENT_DEPRECATED
|
||||
#endif
|
||||
|
||||
#ifndef TORRENT_USE_IPV6
|
||||
#define TORRENT_USE_IPV6 1
|
||||
#endif
|
||||
|
@ -144,7 +140,12 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#define TORRENT_USE_MLOCK 1
|
||||
#define TORRENT_USE_READV 1
|
||||
#define TORRENT_USE_WRITEV 1
|
||||
|
||||
#if !defined TORRENT_USE_IOSTREAM && !defined BOOST_NO_IOSTREAM
|
||||
#define TORRENT_USE_IOSTREAM 1
|
||||
#else
|
||||
#define TORRENT_USE_IOSTREAM 0
|
||||
#endif
|
||||
|
||||
#define TORRENT_USE_I2P 1
|
||||
|
||||
|
@ -161,6 +162,10 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#if defined FILENAME_MAX
|
||||
#define TORRENT_MAX_PATH FILENAME_MAX
|
||||
|
||||
// beos
|
||||
#elif defined B_PATH_NAME_LENGTH
|
||||
#defined TORRENT_MAX_PATH B_PATH_NAME_LENGTH
|
||||
|
||||
// solaris
|
||||
#elif defined MAXPATH
|
||||
#define TORRENT_MAX_PATH MAXPATH
|
||||
|
@ -216,11 +221,15 @@ inline int snprintf(char* buf, int len, char const* fmt, ...)
|
|||
#define TORRENT_ISE_ICONV 0
|
||||
#endif
|
||||
|
||||
#if defined UNICODE
|
||||
#if defined UNICODE && !defined BOOST_NO_STD_WSTRING
|
||||
#define TORRENT_USE_WSTRING 1
|
||||
#else
|
||||
#define TORRENT_USE_WSTRING 0
|
||||
#endif // TORRENT_WINDOWS
|
||||
#endif // UNICODE
|
||||
|
||||
#ifndef TORRENT_HAS_FALLOCATE
|
||||
#define TORRENT_HAS_FALLOCATE 1
|
||||
#endif
|
||||
|
||||
#if !defined(TORRENT_READ_HANDLER_MAX_SIZE)
|
||||
# define TORRENT_READ_HANDLER_MAX_SIZE 256
|
||||
|
@ -241,7 +250,8 @@ inline int snprintf(char* buf, int len, char const* fmt, ...)
|
|||
#if !defined TORRENT_USE_ABSOLUTE_TIME \
|
||||
&& !defined TORRENT_USE_QUERY_PERFORMANCE_TIMER \
|
||||
&& !defined TORRENT_USE_CLOCK_GETTIME \
|
||||
&& !defined TORRENT_USE_BOOST_DATE_TIME
|
||||
&& !defined TORRENT_USE_BOOST_DATE_TIME \
|
||||
&& !defined TORRENT_USE_SYSTEM_TIME
|
||||
|
||||
#if defined(__MACH__)
|
||||
#define TORRENT_USE_ABSOLUTE_TIME 1
|
||||
|
@ -249,6 +259,8 @@ inline int snprintf(char* buf, int len, char const* fmt, ...)
|
|||
#define TORRENT_USE_QUERY_PERFORMANCE_TIMER 1
|
||||
#elif defined(_POSIX_MONOTONIC_CLOCK) && _POSIX_MONOTONIC_CLOCK >= 0
|
||||
#define TORRENT_USE_CLOCK_GETTIME 1
|
||||
#elif defined(TORRENT_BEOS)
|
||||
#define TORRENT_USE_SYSTEM_TIME 1
|
||||
#else
|
||||
#define TORRENT_USE_BOOST_DATE_TIME 1
|
||||
#endif
|
||||
|
|
|
@ -37,15 +37,21 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#define Protocol Protocol_
|
||||
#endif
|
||||
|
||||
#if BOOST_VERSION < 103500
|
||||
#include <asio/basic_deadline_timer.hpp>
|
||||
#include <asio/time_traits.hpp>
|
||||
#if __GNUC__ < 3
|
||||
// in GCC 2.95 templates seems to have all symbols
|
||||
// resolved as they are parsed, so the time_traits
|
||||
// template actually needs the definitions it uses,
|
||||
// even though it's never instantiated
|
||||
#include <boost/date_time/posix_time/posix_time_types.hpp>
|
||||
#else
|
||||
#include <boost/asio/basic_deadline_timer.hpp>
|
||||
#include <boost/asio/time_traits.hpp>
|
||||
#include <boost/date_time/posix_time/posix_time_duration.hpp>
|
||||
#endif
|
||||
|
||||
#include <boost/date_time/posix_time/posix_time_duration.hpp>
|
||||
#if BOOST_VERSION < 103500
|
||||
#include <asio/basic_deadline_timer.hpp>
|
||||
#else
|
||||
#include <boost/asio/basic_deadline_timer.hpp>
|
||||
#endif
|
||||
|
||||
#ifdef __OBJC__
|
||||
#undef Protocol
|
||||
|
|
|
@ -34,7 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#define TORRENT_ESCAPE_STRING_HPP_INCLUDED
|
||||
|
||||
#include <string>
|
||||
#include <limits>
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/size_type.hpp"
|
||||
|
|
|
@ -124,7 +124,7 @@ namespace libtorrent
|
|||
}
|
||||
#endif
|
||||
|
||||
void update(std::string const& data) { update(&data[0], data.size()); }
|
||||
void update(std::string const& data) { update(data.c_str(), data.size()); }
|
||||
void update(const char* data, int len)
|
||||
{
|
||||
TORRENT_ASSERT(data != 0);
|
||||
|
|
|
@ -139,7 +139,7 @@ namespace libtorrent
|
|||
|
||||
inline void write_string(std::string const& str, char*& start)
|
||||
{
|
||||
std::memcpy((void*)start, &str[0], str.size());
|
||||
std::memcpy((void*)start, str.c_str(), str.size());
|
||||
start += str.size();
|
||||
}
|
||||
|
||||
|
|
|
@ -149,9 +149,6 @@ namespace detail
|
|||
|
||||
void add_rule(Addr first, Addr last, int flags)
|
||||
{
|
||||
using boost::next;
|
||||
using boost::prior;
|
||||
|
||||
TORRENT_ASSERT(!m_access_list.empty());
|
||||
TORRENT_ASSERT(first < last || first == last);
|
||||
|
||||
|
@ -164,13 +161,13 @@ namespace detail
|
|||
TORRENT_ASSERT(j != i);
|
||||
|
||||
int first_access = i->access;
|
||||
int last_access = prior(j)->access;
|
||||
int last_access = boost::prior(j)->access;
|
||||
|
||||
if (i->start != first && first_access != flags)
|
||||
{
|
||||
i = m_access_list.insert(i, range(first, flags));
|
||||
}
|
||||
else if (i != m_access_list.begin() && prior(i)->access == flags)
|
||||
else if (i != m_access_list.begin() && boost::prior(i)->access == flags)
|
||||
{
|
||||
--i;
|
||||
first_access = i->access;
|
||||
|
|
|
@ -91,14 +91,14 @@ namespace libtorrent
|
|||
{
|
||||
TORRENT_ASSERT(s.size() >= 20);
|
||||
int sl = int(s.size()) < size ? int(s.size()) : size;
|
||||
std::memcpy(m_number, &s[0], sl);
|
||||
std::memcpy(m_number, s.c_str(), sl);
|
||||
}
|
||||
|
||||
void assign(std::string const& s)
|
||||
{
|
||||
TORRENT_ASSERT(s.size() >= 20);
|
||||
int sl = int(s.size()) < size ? int(s.size()) : size;
|
||||
std::memcpy(m_number, &s[0], sl);
|
||||
std::memcpy(m_number, s.c_str(), sl);
|
||||
}
|
||||
|
||||
void assign(char const* str)
|
||||
|
|
|
@ -465,9 +465,13 @@ namespace libtorrent
|
|||
downloading_piece& add_download_piece();
|
||||
void erase_download_piece(std::vector<downloading_piece>::iterator i);
|
||||
|
||||
// some compilers (e.g. gcc 2.95, does not inherit access
|
||||
// privileges to nested classes)
|
||||
public:
|
||||
// the number of seeds. These are not added to
|
||||
// the availability counters of the pieces
|
||||
int m_seeds;
|
||||
private:
|
||||
|
||||
// the following vectors are mutable because they sometimes may
|
||||
// be updated lazily, triggered by const functions
|
||||
|
|
|
@ -169,7 +169,7 @@ namespace libtorrent
|
|||
|
||||
error_code const& error() const { return m_error; }
|
||||
std::string const& error_file() const { return m_error_file; }
|
||||
void clear_error() { m_error = error_code(); m_error_file.clear(); }
|
||||
void clear_error() { m_error = error_code(); m_error_file.resize(0); }
|
||||
|
||||
mutable error_code m_error;
|
||||
mutable std::string m_error_file;
|
||||
|
|
|
@ -128,7 +128,7 @@ namespace libtorrent
|
|||
s * 1000000 * 60 * 60));
|
||||
}
|
||||
|
||||
#elif defined TORRENT_USE_CLOCK_GETTIME
|
||||
#elif defined TORRENT_USE_CLOCK_GETTIME || defined TORRENT_USE_SYSTEM_TIME
|
||||
|
||||
inline int total_seconds(time_duration td)
|
||||
{ return td.diff / 1000000; }
|
||||
|
|
|
@ -33,7 +33,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifndef TORRENT_UTF8_HPP_INCLUDED
|
||||
#define TORRENT_UTF8_HPP_INCLUDED
|
||||
|
||||
#if !defined BOOST_NO_STD_WSTRING
|
||||
#include "libtorrent/config.hpp"
|
||||
|
||||
#if TORRENT_USE_WSTRING
|
||||
|
||||
#include <string>
|
||||
#include <cwchar>
|
||||
|
|
|
@ -38,6 +38,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/socket_io.hpp"
|
||||
#include "libtorrent/time.hpp"
|
||||
#include "libtorrent/error_code.hpp"
|
||||
#include "libtorrent/escape_string.hpp"
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
namespace libtorrent {
|
||||
|
|
|
@ -44,10 +44,15 @@ namespace libtorrent
|
|||
{
|
||||
char* page_aligned_allocator::malloc(const size_type bytes)
|
||||
{
|
||||
#ifdef TORRENT_WINDOWS
|
||||
return reinterpret_cast<char*>(VirtualAlloc(0, bytes, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE));
|
||||
#if defined TORRENT_WINDOWS
|
||||
return (char*)VirtualAlloc(0, bytes, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
|
||||
#elif defined TORRENT_BEOS
|
||||
// we could potentially use create_area() here, but
|
||||
// you can't free it through its pointer, you need to
|
||||
// associate the area_id with the pointer somehow
|
||||
return (char*)::malloc(bytes);
|
||||
#else
|
||||
return reinterpret_cast<char*>(valloc(bytes));
|
||||
return (char*)valloc(bytes);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -55,6 +60,8 @@ namespace libtorrent
|
|||
{
|
||||
#ifdef TORRENT_WINDOWS
|
||||
VirtualFree(block, 0, MEM_RELEASE);
|
||||
#elif defined TORRENT_BEOS
|
||||
return ::free(block);
|
||||
#else
|
||||
::free(block);
|
||||
#endif
|
||||
|
|
|
@ -41,7 +41,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <stdlib.h>
|
||||
|
||||
// uClibc++ doesn't have cxxabi.h
|
||||
#if defined __GNUC__ && !defined __UCLIBCXX_MAJOR__
|
||||
#if defined __GNUC__ && __GNUC__ >= 3 \
|
||||
&& !defined __UCLIBCXX_MAJOR__
|
||||
|
||||
#include <cxxabi.h>
|
||||
|
||||
|
|
|
@ -57,7 +57,6 @@ namespace libtorrent
|
|||
m_abort = true;
|
||||
m_queue.clear();
|
||||
m_queued_bytes = 0;
|
||||
error_code ec;
|
||||
}
|
||||
|
||||
#ifdef TORRENT_DEBUG
|
||||
|
|
|
@ -34,7 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/pch.hpp"
|
||||
|
||||
#include <vector>
|
||||
#include <limits>
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#include "libtorrent/bt_peer_connection.hpp"
|
||||
|
|
|
@ -35,7 +35,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <string>
|
||||
#include <cctype>
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
#include <boost/limits.hpp>
|
||||
#include <cstring>
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
|
|
|
@ -1443,7 +1443,7 @@ namespace libtorrent
|
|||
ec.assign(errno, get_posix_category());
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
#elif TORRENT_HAS_FALLOCATE
|
||||
int ret = posix_fallocate(m_fd, 0, s);
|
||||
if (ret != 0)
|
||||
{
|
||||
|
|
|
@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/pch.hpp"
|
||||
|
||||
#include <vector>
|
||||
#include <limits>
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#include "libtorrent/http_seed_connection.hpp"
|
||||
|
|
|
@ -91,7 +91,7 @@ namespace
|
|||
{
|
||||
fingerprint ret("..", 0, 0, 0, 0);
|
||||
|
||||
if (!std::isalnum(id[0]))
|
||||
if (!is_alpha(id[0]) && !is_digit(id[0]))
|
||||
return boost::optional<fingerprint>();
|
||||
|
||||
if (std::equal(id.begin()+4, id.begin()+6, "--"))
|
||||
|
|
|
@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/pch.hpp"
|
||||
|
||||
#include <vector>
|
||||
#include <limits>
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#include "libtorrent/peer_connection.hpp"
|
||||
|
|
14
src/time.cpp
14
src/time.cpp
|
@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <ctime>
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
#include <limits>
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/version.hpp>
|
||||
#include "libtorrent/config.hpp"
|
||||
#include "libtorrent/time.hpp"
|
||||
|
@ -182,7 +182,17 @@ namespace libtorrent
|
|||
}
|
||||
}
|
||||
|
||||
#endif // TORRENT_USE_CLOCK_GETTIME
|
||||
#elif defined TORRENT_USE_SYSTEM_TIME
|
||||
|
||||
#include <kernel/OS.h>
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
ptime time_now_hires()
|
||||
{ return ptime(get_system_time()); }
|
||||
}
|
||||
|
||||
#endif // TORRENT_USE_SYSTEM_TIME
|
||||
|
||||
#endif // TORRENT_USE_BOOST_DATE_TIME
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/pch.hpp"
|
||||
|
||||
#include <vector>
|
||||
#include <limits>
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
|
Loading…
Reference in New Issue