forked from premiere/premiere-libtorrent
android support
This commit is contained in:
parent
fc2fc8dfb2
commit
65fe1b1212
|
@ -33,6 +33,19 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifndef TORRENT_CONFIG_HPP_INCLUDED
|
#ifndef TORRENT_CONFIG_HPP_INCLUDED
|
||||||
#define TORRENT_CONFIG_HPP_INCLUDED
|
#define TORRENT_CONFIG_HPP_INCLUDED
|
||||||
|
|
||||||
|
#if !defined _MSC_VER || _MSC_VER >= 1600
|
||||||
|
#ifndef __STDC_LIMIT_MACROS
|
||||||
|
#define __STDC_LIMIT_MACROS 1
|
||||||
|
#endif
|
||||||
|
#ifndef __STDC_CONSTANT_MACROS
|
||||||
|
#define __STDC_CONSTANT_MACROS 1
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#if !defined INT64_MAX
|
||||||
|
#define INT64_MAX 0x7fffffffffffffffLL
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
#include <boost/version.hpp>
|
#include <boost/version.hpp>
|
||||||
#include <stdio.h> // for snprintf
|
#include <stdio.h> // for snprintf
|
||||||
|
@ -44,15 +57,12 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#if !defined BOOST_ASIO_SEPARATE_COMPILATION && !defined BOOST_ASIO_DYN_LINK
|
#if !defined BOOST_ASIO_SEPARATE_COMPILATION && !defined BOOST_ASIO_DYN_LINK
|
||||||
#error you must define either BOOST_ASIO_SEPARATE_COMPILATION or BOOST_ASIO_DYN_LINK in your project in \
|
#error you must define either BOOST_ASIO_SEPARATE_COMPILATION or BOOST_ASIO_DYN_LINK in your project in \
|
||||||
order for asio's declarations to be correct. If you're linking dynamically against libtorrent, define \
|
order for asios declarations to be correct. If you are linking dynamically against libtorrent, define \
|
||||||
BOOST_ASIO_DYN_LINK otherwise BOOST_ASIO_SEPARATE_COMPILATION. You can also use pkg-config or boost \
|
BOOST_ASIO_DYN_LINK otherwise BOOST_ASIO_SEPARATE_COMPILATION. You can also use pkg-config or boost \
|
||||||
build, to automatically apply these defines
|
build, to automatically apply these defines
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined _MSC_VER || _MSC_VER >= 1600
|
#if !defined _MSC_VER || _MSC_VER >= 1600
|
||||||
#ifndef __STDC_LIMIT_MACROS
|
|
||||||
#define __STDC_LIMIT_MACROS 1
|
|
||||||
#endif
|
|
||||||
#include <stdint.h> // for INT64_MAX
|
#include <stdint.h> // for INT64_MAX
|
||||||
#else
|
#else
|
||||||
#if !defined INT64_MAX
|
#if !defined INT64_MAX
|
||||||
|
@ -215,11 +225,22 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
// ==== LINUX ===
|
// ==== LINUX ===
|
||||||
#elif defined __linux__
|
#elif defined __linux__
|
||||||
#define TORRENT_LINUX
|
#define TORRENT_LINUX
|
||||||
#define TORRENT_USE_IFADDRS 1
|
|
||||||
#define TORRENT_USE_NETLINK 1
|
#define TORRENT_USE_NETLINK 1
|
||||||
#define TORRENT_USE_IFCONF 1
|
#define TORRENT_USE_IFCONF 1
|
||||||
#define TORRENT_HAS_SALEN 0
|
#define TORRENT_HAS_SALEN 0
|
||||||
|
|
||||||
|
// ===== ANDROID ===== (almost linux, sort of)
|
||||||
|
#if defined __ANDROID__
|
||||||
|
#define TORRENT_ANDROID
|
||||||
|
#define TORRENT_HAS_FALLOCATE 0
|
||||||
|
#define TORRENT_USE_ICONV 0
|
||||||
|
#define TORRENT_USE_IFADDRS 0
|
||||||
|
#define TORRENT_USE_MEMALIGN 1
|
||||||
|
#else
|
||||||
|
#define TORRENT_USE_IFADDRS 1
|
||||||
#define TORRENT_USE_POSIX_MEMALIGN 1
|
#define TORRENT_USE_POSIX_MEMALIGN 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#if __amd64__ || __i386__
|
#if __amd64__ || __i386__
|
||||||
#define TORRENT_USE_EXECINFO 1
|
#define TORRENT_USE_EXECINFO 1
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -276,7 +276,6 @@ namespace libtorrent
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef sha1_hash peer_id;
|
typedef sha1_hash peer_id;
|
||||||
typedef sha1_hash sha1_hash;
|
|
||||||
|
|
||||||
#if TORRENT_USE_IOSTREAM
|
#if TORRENT_USE_IOSTREAM
|
||||||
|
|
||||||
|
@ -301,3 +300,4 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TORRENT_PEER_ID_HPP_INCLUDED
|
#endif // TORRENT_PEER_ID_HPP_INCLUDED
|
||||||
|
|
||||||
|
|
12
src/file.cpp
12
src/file.cpp
|
@ -80,7 +80,14 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifdef TORRENT_LINUX
|
#ifdef TORRENT_LINUX
|
||||||
// linux specifics
|
// linux specifics
|
||||||
|
|
||||||
|
#ifdef TORRENT_ANDROID
|
||||||
|
#include <sys/vfs.h>
|
||||||
|
#define statvfs statfs
|
||||||
|
#define fstatvfs fstatfs
|
||||||
|
#else
|
||||||
#include <sys/statvfs.h>
|
#include <sys/statvfs.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#ifdef HAVE_LINUX_FIEMAP_H
|
#ifdef HAVE_LINUX_FIEMAP_H
|
||||||
|
@ -88,6 +95,11 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <linux/fs.h> // FS_IOC_FIEMAP
|
#include <linux/fs.h> // FS_IOC_FIEMAP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef TORRENT_ANDROID
|
||||||
|
#include <sys/syscall.h>
|
||||||
|
#define lseek lseek64
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <asm/unistd.h> // For __NR_fallocate
|
#include <asm/unistd.h> // For __NR_fallocate
|
||||||
|
|
||||||
// circumvent the lack of support in glibc
|
// circumvent the lack of support in glibc
|
||||||
|
|
Loading…
Reference in New Issue