merged mingw fix from RC_0_16
This commit is contained in:
parent
5d993dbc71
commit
c60f373ae4
|
@ -3,6 +3,8 @@
|
||||||
* 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 mingw build for linux crosscompiler
|
||||||
|
|
||||||
0.16.3 release
|
0.16.3 release
|
||||||
|
|
||||||
* fix python binding backwards compatibility in replace_trackers
|
* fix python binding backwards compatibility in replace_trackers
|
||||||
|
|
|
@ -29,7 +29,6 @@ extern "C" {
|
||||||
#include<stdlib.h>
|
#include<stdlib.h>
|
||||||
#include<string.h>
|
#include<string.h>
|
||||||
#include <sys/types.h> /* for fstat */
|
#include <sys/types.h> /* for fstat */
|
||||||
#include <sys/stat.h> /* for fstat */
|
|
||||||
|
|
||||||
#define SEGMENT_RECORD_LENGTH 3
|
#define SEGMENT_RECORD_LENGTH 3
|
||||||
#define STANDARD_RECORD_LENGTH 3
|
#define STANDARD_RECORD_LENGTH 3
|
||||||
|
|
|
@ -34,7 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include "libtorrent/config.hpp"
|
#include "libtorrent/config.hpp"
|
||||||
|
|
||||||
#if defined TORRENT_WINDOWS
|
#if defined TORRENT_WINDOWS || defined TORRENT_MINGW
|
||||||
|
|
||||||
#include <malloc.h>
|
#include <malloc.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)))
|
||||||
|
@ -52,5 +52,3 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -51,8 +51,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "libtorrent/config.hpp"
|
#include "libtorrent/config.hpp"
|
||||||
#include "libtorrent/intrusive_ptr_base.hpp"
|
#include "libtorrent/intrusive_ptr_base.hpp"
|
||||||
|
|
||||||
#include <sys/stat.h>
|
|
||||||
|
|
||||||
#ifdef TORRENT_WINDOWS
|
#ifdef TORRENT_WINDOWS
|
||||||
// windows part
|
// windows part
|
||||||
#ifndef WIN32_LEAN_AND_MEAN
|
#ifndef WIN32_LEAN_AND_MEAN
|
||||||
|
@ -93,16 +91,18 @@ namespace libtorrent
|
||||||
time_t ctime;
|
time_t ctime;
|
||||||
enum {
|
enum {
|
||||||
#if defined TORRENT_WINDOWS
|
#if defined TORRENT_WINDOWS
|
||||||
directory = _S_IFDIR,
|
fifo = 0x1000, // named pipe (fifo)
|
||||||
regular_file = _S_IFREG
|
character_special = 0x2000, // character special
|
||||||
|
directory = 0x4000, // directory
|
||||||
|
regular_file = 0x8000 // regular
|
||||||
#else
|
#else
|
||||||
fifo = S_IFIFO,
|
fifo = 0010000, // named pipe (fifo)
|
||||||
character_special = S_IFCHR,
|
character_special = 0020000, // character special
|
||||||
directory = S_IFDIR,
|
directory = 0040000, // directory
|
||||||
block_special = S_IFBLK,
|
block_special = 0060000, // block special
|
||||||
regular_file = S_IFREG,
|
regular_file = 0100000, // regular
|
||||||
link = S_IFLNK,
|
link = 0120000, // symbolic link
|
||||||
socket = S_IFSOCK
|
socket = 0140000 // socket
|
||||||
#endif
|
#endif
|
||||||
} modes_t;
|
} modes_t;
|
||||||
int mode;
|
int mode;
|
||||||
|
|
27
src/file.cpp
27
src/file.cpp
|
@ -43,6 +43,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <boost/scoped_ptr.hpp>
|
||||||
#include <boost/static_assert.hpp>
|
#include <boost/static_assert.hpp>
|
||||||
|
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#ifdef TORRENT_WINDOWS
|
#ifdef TORRENT_WINDOWS
|
||||||
// windows part
|
// windows part
|
||||||
|
|
||||||
|
@ -57,16 +59,18 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#endif
|
#endif
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <winioctl.h>
|
#include <winioctl.h>
|
||||||
|
#ifndef TORRENT_MINGW
|
||||||
#include <direct.h> // for _getcwd, _mkdir
|
#include <direct.h> // for _getcwd, _mkdir
|
||||||
|
#else
|
||||||
|
#include <dirent.h>
|
||||||
|
#endif
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
|
||||||
#else
|
#else
|
||||||
// posix part
|
// posix part
|
||||||
|
|
||||||
#define _FILE_OFFSET_BITS 64
|
#define _FILE_OFFSET_BITS 64
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h> // for F_LOG2PHYS
|
#include <fcntl.h> // for F_LOG2PHYS
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/statvfs.h>
|
#include <sys/statvfs.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@ -167,7 +171,7 @@ namespace libtorrent
|
||||||
std::string f = convert_to_native(inf);
|
std::string f = convert_to_native(inf);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef TORRENT_WINDOWS
|
#if defined TORRENT_WINDOWS
|
||||||
struct _stati64 ret;
|
struct _stati64 ret;
|
||||||
#if TORRENT_USE_WSTRING
|
#if TORRENT_USE_WSTRING
|
||||||
if (_wstati64(f.c_str(), &ret) < 0)
|
if (_wstati64(f.c_str(), &ret) < 0)
|
||||||
|
@ -196,7 +200,20 @@ namespace libtorrent
|
||||||
s->atime = ret.st_atime;
|
s->atime = ret.st_atime;
|
||||||
s->mtime = ret.st_mtime;
|
s->mtime = ret.st_mtime;
|
||||||
s->ctime = ret.st_ctime;
|
s->ctime = ret.st_ctime;
|
||||||
s->mode = ret.st_mode;
|
#if defined TORRENT_WINDOWS
|
||||||
|
s->mode = ((ret.st_mode & _S_IFREG) ? file_status::regular_file : 0)
|
||||||
|
| ((ret.st_mode & _S_IFDIR) ? file_status::directory : 0)
|
||||||
|
| ((ret.st_mode & _S_IFCHR) ? file_status::character_special : 0)
|
||||||
|
| ((ret.st_mode & _S_IFIFO) ? file_status::fifo : 0);
|
||||||
|
#else
|
||||||
|
s->mode = (S_ISREG(ret.st_mode) ? file_status::regular_file : 0)
|
||||||
|
| (S_ISDIR(ret.st_mode) ? file_status::directory : 0)
|
||||||
|
| (S_ISLNK(ret.st_mode) ? file_status::link : 0)
|
||||||
|
| (S_ISFIFO(ret.st_mode) ? file_status::fifo : 0)
|
||||||
|
| (S_ISCHR(ret.st_mode) ? file_status::character_special : 0)
|
||||||
|
| (S_ISBLK(ret.st_mode) ? file_status::block_special : 0)
|
||||||
|
| (S_ISSOCK(ret.st_mode) ? file_status::socket : 0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void rename(std::string const& inf, std::string const& newf, error_code& ec)
|
void rename(std::string const& inf, std::string const& newf, error_code& ec)
|
||||||
|
@ -538,7 +555,7 @@ namespace libtorrent
|
||||||
|
|
||||||
std::string current_working_directory()
|
std::string current_working_directory()
|
||||||
{
|
{
|
||||||
#ifdef TORRENT_WINDOWS
|
#if defined TORRENT_WINDOWS && !defined TORRENT_MINGW
|
||||||
#if TORRENT_USE_WSTRING
|
#if TORRENT_USE_WSTRING
|
||||||
wchar_t cwd[TORRENT_MAX_PATH];
|
wchar_t cwd[TORRENT_MAX_PATH];
|
||||||
_wgetcwd(cwd, sizeof(cwd) / sizeof(wchar_t));
|
_wgetcwd(cwd, sizeof(cwd) / sizeof(wchar_t));
|
||||||
|
|
Loading…
Reference in New Issue