fixed MinGW support
This commit is contained in:
parent
69b625e65d
commit
fe5f908cc6
|
@ -115,6 +115,7 @@ release 0.14.9
|
||||||
* fixed optimistic unchoke timer
|
* fixed optimistic unchoke timer
|
||||||
* fixed bug where torrents with incorrectly formatted web seed URLs would be
|
* fixed bug where torrents with incorrectly formatted web seed URLs would be
|
||||||
connected multiple times
|
connected multiple times
|
||||||
|
* fixed MinGW support
|
||||||
|
|
||||||
release 0.14.8
|
release 0.14.8
|
||||||
|
|
||||||
|
|
|
@ -246,7 +246,7 @@ namespace libtorrent
|
||||||
++in; // 'e'
|
++in; // 'e'
|
||||||
ret = entry(entry::int_t);
|
ret = entry(entry::int_t);
|
||||||
char* end_pointer;
|
char* end_pointer;
|
||||||
#ifdef TORRENT_WINDOWS
|
#if defined TORRENT_WINDOWS && !defined TORRENT_MINGW
|
||||||
ret.integer() = _strtoi64(val.c_str(), &end_pointer, 10);
|
ret.integer() = _strtoi64(val.c_str(), &end_pointer, 10);
|
||||||
#else
|
#else
|
||||||
ret.integer() = strtoll(val.c_str(), &end_pointer, 10);
|
ret.integer() = strtoll(val.c_str(), &end_pointer, 10);
|
||||||
|
|
|
@ -129,8 +129,13 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
// ==== LINUX ===
|
// ==== LINUX ===
|
||||||
#elif defined __linux__
|
#elif defined __linux__
|
||||||
#define TORRENT_LINUX
|
#define TORRENT_LINUX
|
||||||
|
|
||||||
|
// ==== MINGW ===
|
||||||
#elif defined __MINGW32__
|
#elif defined __MINGW32__
|
||||||
#define TORRENT_MINGW
|
#define TORRENT_MINGW
|
||||||
|
#define TORRENT_WINDOWS
|
||||||
|
#define TORRENT_USE_ICONV 0
|
||||||
|
#define TORRENT_USE_RLIMIT 0
|
||||||
|
|
||||||
// ==== WINDOWS ===
|
// ==== WINDOWS ===
|
||||||
#elif defined WIN32
|
#elif defined WIN32
|
||||||
|
@ -139,6 +144,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
// apple uses utf-8 as its locale, so no conversion
|
// apple uses utf-8 as its locale, so no conversion
|
||||||
// is necessary
|
// is necessary
|
||||||
#define TORRENT_USE_ICONV 0
|
#define TORRENT_USE_ICONV 0
|
||||||
|
#define TORRENT_USE_RLIMIT 0
|
||||||
|
|
||||||
// ==== SOLARIS ===
|
// ==== SOLARIS ===
|
||||||
#elif defined sun || defined __sun
|
#elif defined sun || defined __sun
|
||||||
|
@ -192,7 +198,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef TORRENT_WINDOWS
|
#if defined TORRENT_WINDOWS && !defined TORRENT_MINGW
|
||||||
|
|
||||||
// class X needs to have dll-interface to be used by clients of class Y
|
// class X needs to have dll-interface to be used by clients of class Y
|
||||||
#pragma warning(disable:4251)
|
#pragma warning(disable:4251)
|
||||||
|
@ -248,6 +254,10 @@ inline int snprintf(char* buf, int len, char const* fmt, ...)
|
||||||
#define TORRENT_DEPRECATED
|
#define TORRENT_DEPRECATED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef TORRENT_USE_RLIMIT
|
||||||
|
#define TORRENT_USE_RLIMIT 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef TORRENT_USE_IPV6
|
#ifndef TORRENT_USE_IPV6
|
||||||
#define TORRENT_USE_IPV6 1
|
#define TORRENT_USE_IPV6 1
|
||||||
#endif
|
#endif
|
||||||
|
@ -303,7 +313,7 @@ inline int snprintf(char* buf, int len, char const* fmt, ...)
|
||||||
|
|
||||||
#if defined(__MACH__)
|
#if defined(__MACH__)
|
||||||
#define TORRENT_USE_ABSOLUTE_TIME 1
|
#define TORRENT_USE_ABSOLUTE_TIME 1
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32) || defined TORRENT_MINGW
|
||||||
#define TORRENT_USE_QUERY_PERFORMANCE_TIMER 1
|
#define TORRENT_USE_QUERY_PERFORMANCE_TIMER 1
|
||||||
#elif defined(_POSIX_MONOTONIC_CLOCK) && _POSIX_MONOTONIC_CLOCK >= 0
|
#elif defined(_POSIX_MONOTONIC_CLOCK) && _POSIX_MONOTONIC_CLOCK >= 0
|
||||||
#define TORRENT_USE_CLOCK_GETTIME 1
|
#define TORRENT_USE_CLOCK_GETTIME 1
|
||||||
|
|
|
@ -35,7 +35,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include "libtorrent/config.hpp"
|
#include "libtorrent/config.hpp"
|
||||||
|
|
||||||
#if TORRENT_USE_WSTRING
|
// on windows we need these functions for
|
||||||
|
// convert_to_native and convert_from_native
|
||||||
|
#if TORRENT_USE_WSTRING || defined TORRENT_WINDOWS
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cwchar>
|
#include <cwchar>
|
||||||
|
|
|
@ -547,7 +547,7 @@ namespace libtorrent
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined TORRENT_WINDOWS && defined UNICODE
|
#if defined TORRENT_WINDOWS && TORRENT_USE_WSTRING && defined UNICODE
|
||||||
std::wstring convert_to_wstring(std::string const& s)
|
std::wstring convert_to_wstring(std::string const& s)
|
||||||
{
|
{
|
||||||
std::wstring ret;
|
std::wstring ret;
|
||||||
|
|
12
src/file.cpp
12
src/file.cpp
|
@ -1504,6 +1504,11 @@ namespace libtorrent
|
||||||
#ifdef TORRENT_WINDOWS
|
#ifdef TORRENT_WINDOWS
|
||||||
// according to MSDN, clearing the sparse flag of a file only
|
// according to MSDN, clearing the sparse flag of a file only
|
||||||
// works on windows vista and later
|
// works on windows vista and later
|
||||||
|
#ifdef TORRENT_MINGW
|
||||||
|
typedef struct _FILE_SET_SPARSE_BUFFER {
|
||||||
|
BOOLEAN SetSparse;
|
||||||
|
} FILE_SET_SPARSE_BUFFER, *PFILE_SET_SPARSE_BUFFER;
|
||||||
|
#endif
|
||||||
DWORD temp;
|
DWORD temp;
|
||||||
FILE_SET_SPARSE_BUFFER b;
|
FILE_SET_SPARSE_BUFFER b;
|
||||||
b.SetSparse = FALSE;
|
b.SetSparse = FALSE;
|
||||||
|
@ -1536,6 +1541,13 @@ namespace libtorrent
|
||||||
size_type file::sparse_end(size_type start) const
|
size_type file::sparse_end(size_type start) const
|
||||||
{
|
{
|
||||||
#ifdef TORRENT_WINDOWS
|
#ifdef TORRENT_WINDOWS
|
||||||
|
#ifdef TORRENT_MINGW
|
||||||
|
typedef struct _FILE_ALLOCATED_RANGE_BUFFER {
|
||||||
|
LARGE_INTEGER FileOffset;
|
||||||
|
LARGE_INTEGER Length;
|
||||||
|
} FILE_ALLOCATED_RANGE_BUFFER, *PFILE_ALLOCATED_RANGE_BUFFER;
|
||||||
|
#define FSCTL_QUERY_ALLOCATED_RANGES ((0x9 << 16) | (1 << 14) | (51 << 2) | 3)
|
||||||
|
#endif
|
||||||
FILE_ALLOCATED_RANGE_BUFFER buffer;
|
FILE_ALLOCATED_RANGE_BUFFER buffer;
|
||||||
DWORD bytes_returned = 0;
|
DWORD bytes_returned = 0;
|
||||||
FILE_ALLOCATED_RANGE_BUFFER in;
|
FILE_ALLOCATED_RANGE_BUFFER in;
|
||||||
|
|
|
@ -1185,6 +1185,10 @@ namespace aux {
|
||||||
{
|
{
|
||||||
s.sock->set_option(v6only(v6_only), ec);
|
s.sock->set_option(v6only(v6_only), ec);
|
||||||
#ifdef TORRENT_WINDOWS
|
#ifdef TORRENT_WINDOWS
|
||||||
|
|
||||||
|
#ifndef PROTECTION_LEVEL_UNRESTRICTED
|
||||||
|
#define PROTECTION_LEVEL_UNRESTRICTED 10
|
||||||
|
#endif
|
||||||
// enable Teredo on windows
|
// enable Teredo on windows
|
||||||
s.sock->set_option(v6_protection_level(PROTECTION_LEVEL_UNRESTRICTED), ec);
|
s.sock->set_option(v6_protection_level(PROTECTION_LEVEL_UNRESTRICTED), ec);
|
||||||
#endif
|
#endif
|
||||||
|
@ -3446,7 +3450,7 @@ namespace aux {
|
||||||
if (limit <= 0)
|
if (limit <= 0)
|
||||||
{
|
{
|
||||||
limit = (std::numeric_limits<int>::max)();
|
limit = (std::numeric_limits<int>::max)();
|
||||||
#ifndef TORRENT_WINDOWS
|
#if TORRENT_USE_RLIMIT
|
||||||
rlimit l;
|
rlimit l;
|
||||||
if (getrlimit(RLIMIT_NOFILE, &l) == 0
|
if (getrlimit(RLIMIT_NOFILE, &l) == 0
|
||||||
&& l.rlim_cur != RLIM_INFINITY)
|
&& l.rlim_cur != RLIM_INFINITY)
|
||||||
|
|
Loading…
Reference in New Issue