--- /dev/null
+--- a/src/data/memory_chunk.cc
++++ b/src/data/memory_chunk.cc
+@@ -71,7 +71,7 @@ MemoryChunk::MemoryChunk(char* ptr, char
+ if (page_align() >= m_pagesize)
+ throw internal_error("MemoryChunk::MemoryChunk(...) received an page alignment >= page size");
+
+- if ((ptrdiff_t)ptr % m_pagesize)
++ if ((std::ptrdiff_t)ptr % m_pagesize)
+ throw internal_error("MemoryChunk::MemoryChunk(...) is not aligned to a page");
+ }
+
+--- a/src/torrent/data/block.h
++++ b/src/torrent/data/block.h
+@@ -40,6 +40,7 @@
+ #include <vector>
+ #include <torrent/common.h>
+ #include <torrent/data/block_transfer.h>
++#include <cstdlib>
+
+ namespace torrent {
+
+--- a/src/torrent/data/block_transfer.h
++++ b/src/torrent/data/block_transfer.h
+@@ -39,6 +39,7 @@
+
+ #include <torrent/common.h>
+ #include <torrent/data/piece.h>
++#include <cstdlib>
+
+ namespace torrent {
+
-Index: libtorrent-0.12.6/scripts/checks.m4
-===================================================================
---- libtorrent-0.12.6.orig/scripts/checks.m4
-+++ libtorrent-0.12.6/scripts/checks.m4
+--- a/scripts/checks.m4
++++ b/scripts/checks.m4
@@ -96,7 +96,7 @@ AC_DEFUN([TORRENT_CHECK_KQUEUE], [
AC_DEFUN([TORRENT_CHECK_KQUEUE_SOCKET_ONLY], [
AC_MSG_CHECKING(whether kqueue supports pipes and ptys)
[[#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
-Index: libtorrent-0.12.6/scripts/common.m4
-===================================================================
---- libtorrent-0.12.6.orig/scripts/common.m4
-+++ libtorrent-0.12.6/scripts/common.m4
+--- a/scripts/common.m4
++++ b/scripts/common.m4
@@ -184,7 +184,7 @@ AC_DEFUN([TORRENT_CHECK_MADVISE], [
AC_DEFUN([TORRENT_CHECK_EXECINFO], [
AC_MSG_CHECKING(for execinfo.h)
-Index: libtorrent-0.12.6/src/net/socket_datagram.cc
-===================================================================
---- libtorrent-0.12.6.orig/src/net/socket_datagram.cc
-+++ libtorrent-0.12.6/src/net/socket_datagram.cc
+--- a/src/net/socket_datagram.cc
++++ b/src/net/socket_datagram.cc
@@ -73,6 +73,23 @@ SocketDatagram::write_datagram(const voi
int r;