mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-16 06:06:16 +00:00
* Switch the order rak::advance_bidirectional iterates.
* When testing for mincore, cast the address pointer to (char*). * Failure during syncing causes the download to stop, unless flag_ignore_error is set. * Trigger storage error signal for HashTorrent in DownloadWrapper::receive_initial_hash. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@774 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
+11
-19
@@ -56,15 +56,6 @@ for_each_pre(_InputIter __first, _InputIter __last, _Function __f) {
|
|||||||
return __f;
|
return __f;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename InputIter, typename Function, typename Accumulator>
|
|
||||||
Accumulator
|
|
||||||
accumulate(InputIter first, InputIter last, Function function, Accumulator acc) {
|
|
||||||
while (first != last)
|
|
||||||
acc += function(*first++);
|
|
||||||
|
|
||||||
return acc;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return a range with a distance of no more than __distance and
|
// Return a range with a distance of no more than __distance and
|
||||||
// between __first and __last, centered on __middle1.
|
// between __first and __last, centered on __middle1.
|
||||||
template <typename _InputIter, typename _Distance>
|
template <typename _InputIter, typename _Distance>
|
||||||
@@ -73,6 +64,17 @@ advance_bidirectional(_InputIter __first, _InputIter __middle1, _InputIter __las
|
|||||||
_InputIter __middle2 = __middle1;
|
_InputIter __middle2 = __middle1;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
if (!__distance)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (__middle2 != __last) {
|
||||||
|
++__middle2;
|
||||||
|
--__distance;
|
||||||
|
|
||||||
|
} else if (__middle1 == __first) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (!__distance)
|
if (!__distance)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -84,16 +86,6 @@ advance_bidirectional(_InputIter __first, _InputIter __middle1, _InputIter __las
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!__distance)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (__middle2 != __last) {
|
|
||||||
++__middle2;
|
|
||||||
--__distance;
|
|
||||||
|
|
||||||
} else if (__middle1 == __first) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} while (true);
|
} while (true);
|
||||||
|
|
||||||
return std::make_pair(__middle1, __middle2);
|
return std::make_pair(__middle1, __middle2);
|
||||||
|
|||||||
+2
-2
@@ -75,7 +75,7 @@ AC_DEFUN([TORRENT_MINCORE_SIGNEDNESS], [
|
|||||||
AC_COMPILE_IFELSE(
|
AC_COMPILE_IFELSE(
|
||||||
[[#include <sys/types.h>
|
[[#include <sys/types.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
void f() { mincore((void*)0, 0, (unsigned char*)0); }
|
void f() { mincore((char*)0, 0, (unsigned char*)0); }
|
||||||
]],
|
]],
|
||||||
[
|
[
|
||||||
AC_DEFINE(USE_MINCORE, 1, Use mincore)
|
AC_DEFINE(USE_MINCORE, 1, Use mincore)
|
||||||
@@ -86,7 +86,7 @@ AC_DEFUN([TORRENT_MINCORE_SIGNEDNESS], [
|
|||||||
AC_COMPILE_IFELSE(
|
AC_COMPILE_IFELSE(
|
||||||
[[#include <sys/types.h>
|
[[#include <sys/types.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
void f() { mincore((void*)0, 0, (char*)0); }
|
void f() { mincore((char*)0, 0, (char*)0); }
|
||||||
]],
|
]],
|
||||||
[
|
[
|
||||||
AC_DEFINE(USE_MINCORE, 1, Use mincore)
|
AC_DEFINE(USE_MINCORE, 1, Use mincore)
|
||||||
|
|||||||
Reference in New Issue
Block a user